]> granicus.if.org Git - clang/log
clang
5 years ago[clang][ifs] New interface stubs format (llvm triple based).
Puyan Lotfi [Thu, 22 Aug 2019 23:29:22 +0000 (23:29 +0000)]
[clang][ifs] New interface stubs format (llvm triple based).

After posting llvm-ifs on phabricator, I made some progress in hardening up how
I think the format for Interface Stubs should look. There are a number of
things I think the TBE format was missing (no endianness, no info about the
Object Format because it assumes ELF), so I have added those and broken off
from being as similar to the TBE schema. In a subsequent commit I can drop the
other formats.

An example of how The format will look is as follows:

--- !experimental-ifs-v1
IfsVersion: 1.0
Triple: x86_64-unknown-linux-gnu
ObjectFileFormat: ELF
Symbols:
  _Z9nothiddenv: { Type: Func }
  _Z10cmdVisiblev: { Type: Func }
...

The format is still marked experimental.

Differential Revision: https://reviews.llvm.org/D66446

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369715 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[libclang][NFC] Remove debug comment
Jan Korous [Thu, 22 Aug 2019 23:29:10 +0000 (23:29 +0000)]
[libclang][NFC] Remove debug comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369714 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Bugfix] fix r369705 unit test
Nick Desaulniers [Thu, 22 Aug 2019 23:18:46 +0000 (23:18 +0000)]
[Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington
Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66622

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369713 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Clang][CodeGen] set alias linkage on QualType
Nick Desaulniers [Thu, 22 Aug 2019 20:47:12 +0000 (20:47 +0000)]
[Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: https://github.com/ClangBuiltLinux/linux/issues/631
Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66492

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369705 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoIR. Change strip* family of functions to not look through aliases.
Peter Collingbourne [Thu, 22 Aug 2019 19:56:14 +0000 (19:56 +0000)]
IR. Change strip* family of functions to not look through aliases.

I noticed another instance of the issue where references to aliases were
being replaced with aliasees, this time in InstCombine. In the instance that
I saw it turned out to be only a QoI issue (a symbol ended up being missing
from the symbol table due to the last reference to the alias being removed,
preventing HWASAN from symbolizing a global reference), but it could easily
have manifested as incorrect behaviour.

Since this is the third such issue encountered (previously: D65118, D65314)
it seems to be time to address this common error/QoI issue once and for all
and make the strip* family of functions not look through aliases.

Includes a test for the specific issue that I saw, but no doubt there are
other similar bugs fixed here.

As with D65118 this has been tested to make sure that the optimization isn't
load bearing. I built Clang, Chromium for Linux, Android and Windows as well
as the test-suite and there were no size regressions.

Differential Revision: https://reviews.llvm.org/D66606

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369697 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDisable the ScanDepsReuseFilemanager test on Windows
Alex Lorenz [Thu, 22 Aug 2019 19:00:08 +0000 (19:00 +0000)]
Disable the ScanDepsReuseFilemanager test on Windows

Right now it fails.
I'm going to investigate it and fix it in follow-up commits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369688 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImprove the documentation for OpenCL vector types.
Aaron Ballman [Thu, 22 Aug 2019 18:57:46 +0000 (18:57 +0000)]
Improve the documentation for OpenCL vector types.

This fixes some minor grammatical issues I noticed when reading the docs, and changes the recommended feature testing approach to use __has_attribute instead of __has_extension.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369687 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix the nullPointerConstant() test to get bots back to green.
Aaron Ballman [Thu, 22 Aug 2019 18:56:18 +0000 (18:56 +0000)]
Fix the nullPointerConstant() test to get bots back to green.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369686 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImplement nullPointerConstant() using a better API.
Aaron Ballman [Thu, 22 Aug 2019 18:26:44 +0000 (18:26 +0000)]
Implement nullPointerConstant() using a better API.

Instead of manually attempting to identify whether something is a null pointer constant, use Expr::isNullPointerConstant().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369683 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoIntroduce FileEntryRef and use it when handling includes to report correct dependencies
Alex Lorenz [Thu, 22 Aug 2019 18:15:50 +0000 (18:15 +0000)]
Introduce FileEntryRef and use it when handling includes to report correct dependencies
when the FileManager is reused across invocations

This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns
a reference to the FileEntry, and the name that was used to access the file. In the case of
a VFS with 'use-external-names', the FileEntyRef contains the external name of the file,
not the filename that was used to access it.

The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the
accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using
the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file
is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations.

Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies
are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits.

Differential Revision: https://reviews.llvm.org/D65907

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369680 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[LifetimeAnalysis] Support more STL idioms (template forward declaration...
Richard Smith [Thu, 22 Aug 2019 17:48:11 +0000 (17:48 +0000)]
Revert "[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)"

This reverts commit r369591, because it causes the formerly-reliable
-Wreturn-stack-address warning to start issuing false positives.
Testcase provided on the commit thread.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369677 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRetire llvm::less_ptr. llvm::deref is much more flexible.
Benjamin Kramer [Thu, 22 Aug 2019 17:32:16 +0000 (17:32 +0000)]
Retire llvm::less_ptr. llvm::deref is much more flexible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369675 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Generalization of handling of declare target attribute.
Alexey Bataev [Thu, 22 Aug 2019 16:48:26 +0000 (16:48 +0000)]
[OPENMP]Generalization of handling of declare target attribute.

Used OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration instead of
direct checking of the OMPDeclareTargetDeclAttr attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369668 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update...
Hans Wennborg [Thu, 22 Aug 2019 13:15:36 +0000 (13:15 +0000)]
Revert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer"

This broke compiling some ASan tests with never versions of MSVC/the Win
SDK, see https://crbug.com/996675

> MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
> so should clang-cl:
> https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase
>
> clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
> or if that's not passed it tries to check what the installed version of
> MSVC is and uses that, and failing that it uses a default version that's
> currently 1911. So this changes the default if no -fmsc-version flag is
> passed and no installed MSVC is detected. (It also changes the default
> if -fmsc-version is passed or MSVC is detected, and either indicates
> _MSC_VER >= 1911.)
>
> As mentioned in the MSDN article, the Windows SDK header files in
> version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
> versions do not work correctly with /Zc:twoPhase. If you need to use
> these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
> the old behavior.
>
> Fixes PR43032.
>
> Differential Revision: https://reviews.llvm.org/D66394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369647 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Fix declaration of enqueue_marker
Yaxun Liu [Thu, 22 Aug 2019 11:18:59 +0000 (11:18 +0000)]
[OpenCL] Fix declaration of enqueue_marker

Differential Revision: https://reviews.llvm.org/D66512

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369641 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"
Hans Wennborg [Thu, 22 Aug 2019 09:07:25 +0000 (09:07 +0000)]
Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"

It causes the build to fail with

"inlinable function call in a function with debug info must have a !dbg location"

in Chromium. See llvm-commits thread for more info.

(This also reverts the follow-up in r369474.)

> Fixes PR43012
>
> Differential Revision: https://reviews.llvm.org/D66328

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369633 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemove an unused function, suppress -Wunused-function warning.
Haojian Wu [Thu, 22 Aug 2019 08:49:41 +0000 (08:49 +0000)]
Remove an unused function, suppress -Wunused-function warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369629 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenMP] Permit map with DSA on combined directive
Joel E. Denny [Thu, 22 Aug 2019 03:34:30 +0000 (03:34 +0000)]
[OpenMP] Permit map with DSA on combined directive

For `map`, the following restriction changed in OpenMP 5.0:

* OpenMP 4.5 [2.15.5.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct.

* OpenMP 5.0 [2.19.7.1, Restrictions]: "A list item cannot appear in
  both a map clause and a data-sharing attribute clause on the same
  construct unless the construct is a combined construct."

This patch removes this restriction in the case of combined constructs
and OpenMP 5.0, and it updates Sema not to capture a scalar by copy in
the target region when `firstprivate` and `map` appear for that scalar
on a combined target construct.

This patch also adds a fixme to a test that now reveals that a
diagnostic about loop iteration variables is dropped in the case of
OpenMP 5.0.  That bug exists regardless of this patch's changes.

Reviewed By: ABataev, jdoerfert, hfinkel, kkwli0

Differential Revision: https://reviews.llvm.org/D65835

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369619 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Enable control dependency condition tracking by default
Kristof Umann [Thu, 22 Aug 2019 03:08:48 +0000 (03:08 +0000)]
[analyzer] Enable control dependency condition tracking by default

This patch concludes my GSoC'19 project by enabling track-conditions by default.

Differential Revision: https://reviews.llvm.org/D66381

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369616 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] CastValueChecker: Model isa(), isa_and_nonnull()
Csaba Dabis [Thu, 22 Aug 2019 02:57:59 +0000 (02:57 +0000)]
[analyzer] CastValueChecker: Model isa(), isa_and_nonnull()

Summary: -

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D66423

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369615 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Don't track the condition of foreach loops
Kristof Umann [Thu, 22 Aug 2019 02:44:19 +0000 (02:44 +0000)]
[analyzer] Don't track the condition of foreach loops

As discussed on the mailing list, notes originating from the tracking of foreach
loop conditions are always meaningless.

Differential Revision: https://reviews.llvm.org/D66131

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369613 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] CastValueChecker: Try to fix the buildbots
Csaba Dabis [Thu, 22 Aug 2019 01:41:06 +0000 (01:41 +0000)]
[analyzer] CastValueChecker: Try to fix the buildbots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369609 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] CastValueChecker: Rewrite dead header hotfix
Csaba Dabis [Thu, 22 Aug 2019 00:36:42 +0000 (00:36 +0000)]
[analyzer] CastValueChecker: Rewrite dead header hotfix

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369607 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] CastValueChecker: Store the dynamic types and casts
Csaba Dabis [Thu, 22 Aug 2019 00:20:36 +0000 (00:20 +0000)]
[analyzer] CastValueChecker: Store the dynamic types and casts

Summary:
This patch introduces `DynamicCastInfo` similar to `DynamicTypeInfo` which
is stored in `CastSets` which are storing the dynamic cast informations of
objects based on memory regions. It could be used to store and check the
casts and prevent infeasible paths.

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D66325

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369605 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] TrackConstraintBRVisitor: Do not track unknown values
Csaba Dabis [Thu, 22 Aug 2019 00:06:58 +0000 (00:06 +0000)]
[analyzer] TrackConstraintBRVisitor: Do not track unknown values

Summary: -

Reviewers: NoQ, Szelethus

Reviewed By: NoQ, Szelethus

Differential Revision: https://reviews.llvm.org/D66267

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369604 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Mention whether an event is about a condition in a bug report part 2
Kristof Umann [Wed, 21 Aug 2019 22:38:00 +0000 (22:38 +0000)]
[analyzer] Mention whether an event is about a condition in a bug report part 2

In D65724, I do a pretty thorough explanation about how I'm solving this
problem, I think that summary nails whats happening here ;)

Differential Revision: https://reviews.llvm.org/D65725

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369596 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LifetimeAnalysis] Support more STL idioms (template forward declaration and Dependen...
Matthias Gehre [Wed, 21 Aug 2019 22:08:59 +0000 (22:08 +0000)]
[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

Summary:
This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator
on the template is a DependentNameType - we can only put the gsl::Pointer attribute
on the underlaying record after instantiation)

inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared,
we added the gsl::Pointer on the canonical decl (the forward decl), and later when the
template was instantiated, there was no attribute on the definition so it was not instantiated).

and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to
a incomplete instantiation, and then another was copied from the template definition
when the instantiation was completed).

We now add the attributes to all redeclarations to fix thos issues and make their usage easier.

Reviewers: gribozavr

Subscribers: Szelethus, xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66179

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369591 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Don't make ConditionBRVisitor events prunable when the condition is an...
Kristof Umann [Wed, 21 Aug 2019 21:59:22 +0000 (21:59 +0000)]
[analyzer] Don't make ConditionBRVisitor events prunable when the condition is an interesting field

Exactly what it says on the tin! Note that we're talking about interestingness
in general, hence this isn't a control-dependency-tracking specific patch.

Differential Revision: https://reviews.llvm.org/D65724

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369589 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoNFCI: Simplify SourceManager::translateFile by removing code path that should never...
Alex Lorenz [Wed, 21 Aug 2019 21:37:09 +0000 (21:37 +0000)]
NFCI: Simplify SourceManager::translateFile by removing code path that should never be taken

I noticed that SourceManager::translateFile has code that doesn't really make sense.
In particular, if it fails to find a FileID by comparing FileEntry * values, it tries to
look through files that have the same filename, to see if they have a matching inode to try to
find the right FileID. However, the inode comparison seem redundant, as Clang's FileManager
already deduplicates FileEntry * values by inode.
Thus the comparisons between inodes should never actually succeed, and the comparison between FileEntry * values should be sufficient here.

Differential Revision: https://reviews.llvm.org/D65481

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369585 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer][NFC] Add different interestingness kinds
Kristof Umann [Wed, 21 Aug 2019 21:33:25 +0000 (21:33 +0000)]
[analyzer][NFC] Add different interestingness kinds

We defined (on the mailing list and here on phabricator) 2 different cases where
retrieving information about a control dependency condition is very important:

* When the condition's last write happened in a different stack frame
* When the collapse point of the condition (when we can constrain it to be
true/false) didn't happen in the actual condition.

It seems like we solved this problem with the help of expression value tracking,
and have started working on better diagnostics notes about this process.

Expression value tracking is nothing more than registering a variety of visitors
to construct reports about it. Each of the registered visitors (ReturnVisitor,
FindLastStoreVisitor, NoStoreFuncVisitor, etc) have something to go by: a
MemRegion, an SVal, an ExplodedNode, etc. For this reason, better explaining a
last write is super simple, we can always just pass on some more information to
the visitor in question (as seen in D65575).

ConditionBRVisitor is a different beast, as it was built for a different
purpose. It is responsible for constructing events at, well, conditions, and is
registered only once, and isn't a part of the "expression value tracking
family". Unfortunately, it is also the visitor to tinker with for constructing
better diagnostics about the collapse point problem.

This creates a need for alternative way to communicate with ConditionBRVisitor
that a specific condition is being tracked for for the reason of being a control
dependency. Since at almost all PathDiagnosticEventPiece construction the
visitor checks interestingness, it makes sense to pair interestingness with a
reason as to why we marked an entity as such.

Differential Revision: https://reviews.llvm.org/D65723

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369583 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse C++14 heteregenous lookup for a couple of std::map<std::string, ...>
Benjamin Kramer [Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)]
Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>

These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369581 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Mention whether an event is about a condition in a bug report part 1
Kristof Umann [Wed, 21 Aug 2019 20:43:27 +0000 (20:43 +0000)]
[analyzer] Mention whether an event is about a condition in a bug report part 1

Can't add much more to the title! This is part 1, the case where the collapse
point isn't in the condition point is the responsibility of ConditionBRVisitor,
which I'm addressing in part 2.

Differential Revision: https://reviews.llvm.org/D65575

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369574 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1 under the new pass...
Leonard Chan [Wed, 21 Aug 2019 17:24:14 +0000 (17:24 +0000)]
[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1 under the new pass manager

Match the behavior of D65009 under the new pass manager. This addresses
the test clang/test/CodeGen/split-lto-unit.c when running under the new
PM.

Differential Revision: https://reviews.llvm.org/D66488

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369550 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:52:44 +0000 (15:52 +0000)]
clang: Fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369542 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:49:21 +0000 (15:49 +0000)]
clang: Fix typo in comment

(Sorry for all these commits; trying to sort out why svn doesn't want to store
my password.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369540 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:41:29 +0000 (15:41 +0000)]
clang: Fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369539 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoclang: Fix typo in comment
Nico Weber [Wed, 21 Aug 2019 15:37:27 +0000 (15:37 +0000)]
clang: Fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369536 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemoved some dead code in BugReporter and related files
Dmitri Gribenko [Wed, 21 Aug 2019 08:48:24 +0000 (08:48 +0000)]
Removed some dead code in BugReporter and related files

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66473

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369504 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[PPC Docs] Remove duplicate info about __builtin_setrnd()
David Zarzycki [Wed, 21 Aug 2019 06:48:11 +0000 (06:48 +0000)]
[PPC Docs] Remove duplicate info about __builtin_setrnd()

This looks like a combination of a copy-and-paste (and paste and paste)
error and a commit without reviewing the diff first error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369496 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd triple to new test to try to pacify bots
Reid Kleckner [Tue, 20 Aug 2019 23:32:51 +0000 (23:32 +0000)]
Add triple to new test to try to pacify bots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369474 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DebugInfo] Add debug location to dynamic atexit destructor
Alexandre Ganea [Tue, 20 Aug 2019 22:09:49 +0000 (22:09 +0000)]
[DebugInfo] Add debug location to dynamic atexit destructor

Fixes PR43012

Differential Revision: https://reviews.llvm.org/D66328

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369458 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] NFC: Remove the BugTypes set from BugReporter.
Artem Dergachev [Tue, 20 Aug 2019 21:41:20 +0000 (21:41 +0000)]
[analyzer] NFC: Remove the BugTypes set from BugReporter.

Its only purpose was to avoid a bug that's caused by
making a virtual call in BugReporter's destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369451 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Fix a crash when destroying a non-region.
Artem Dergachev [Tue, 20 Aug 2019 21:41:17 +0000 (21:41 +0000)]
[analyzer] Fix a crash when destroying a non-region.

Add defensive check that prevents a crash when we try to evaluate a destructor
whose this-value is a concrete integer that isn't a null.

Differential Revision: https://reviews.llvm.org/D65349

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369450 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Improve VirtualCallChecker and enable parts of it by default.
Artem Dergachev [Tue, 20 Aug 2019 21:41:14 +0000 (21:41 +0000)]
[analyzer] Improve VirtualCallChecker and enable parts of it by default.

Calling a pure virtual method during construction or destruction
is undefined behavior. It's worth it to warn about it by default.
That part is now known as the cplusplus.PureVirtualCall checker.

Calling a normal virtual method during construction or destruction
may be fine, but does behave unexpectedly, as it skips virtual dispatch.
Do not warn about this by default, but let projects opt in into it
by enabling the optin.cplusplus.VirtualCall checker manually.

Give the two parts differentiated warning text:

  Before:

    Call to virtual function during construction or destruction:
    Call to pure virtual function during construction

    Call to virtual function during construction or destruction:
    Call to virtual function during destruction

  After:

    Pure virtual method call:
    Call to pure virtual method 'X::foo' during construction
        has undefined behavior

    Unexpected loss of virtual dispatch:
    Call to virtual method 'Y::bar' during construction
        bypasses virtual dispatch

Also fix checker names in consumers that support them (eg., clang-tidy)
because we now have different checker names for pure virtual calls and
regular virtual calls.

Also fix capitalization in the bug category.

Differential Revision: https://reviews.llvm.org/D64274

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369449 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NewPM] Run ubsan-coroutines test under the legacy pass manager only
Leonard Chan [Tue, 20 Aug 2019 20:55:36 +0000 (20:55 +0000)]
[NewPM] Run ubsan-coroutines test under the legacy pass manager only

The passes that lower the llvm.coro.* instrinsics have not yet been ported,
so only run under the legacy PM for now.

See https://bugs.llvm.org/show_bug.cgi?id=42867

Differential Revision: https://reviews.llvm.org/D66493

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369442 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP]Fix delayed diagnostics for standalone declare target directive.
Alexey Bataev [Tue, 20 Aug 2019 19:50:13 +0000 (19:50 +0000)]
[OPENMP]Fix delayed diagnostics for standalone declare target directive.

If the function is marked as declare target in a standalone directive,
the delayed diagnostics is not emitted. Patch fixes this problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369432 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema][Typo] Fix assertion failure for expressions with multiple typos
David Goldman [Tue, 20 Aug 2019 19:03:15 +0000 (19:03 +0000)]
[Sema][Typo] Fix assertion failure for expressions with multiple typos

Summary:
As Typo Resolution can create new TypoExprs while resolving typos,
it is necessary to recurse through the expression to search for more
typos.

This should fix the assertion failure in `clang::Sema::~Sema()`:
  `DelayedTypos.empty() && "Uncorrected typos!"`

Notes:
- In case some TypoExprs are created but thrown away, Sema
  now has a Vector that is used to keep track of newly created
  typos.
- For expressions with multiple typos, we only give suggestions
  if we are able to resolve all typos in the expression
- This patch is similar to D37521 except that it does not eagerly
  commit to a correction for the first typo in the expression.
  Instead, it will search for corrections which fix all of the
  typos in the expression.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D62648

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369427 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix name of the error message, NFC.
Alexey Bataev [Tue, 20 Aug 2019 17:50:13 +0000 (17:50 +0000)]
Fix name of the error message, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369418 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attr] Support _attribute__ ((fallthrough))
Nathan Huckleberry [Tue, 20 Aug 2019 17:16:49 +0000 (17:16 +0000)]
[Attr] Support _attribute__ ((fallthrough))

Summary: Fixed extraneous matches of non-NullStmt

Reviewers: aaron.ballman, rsmith, efriedma, xbolva00

Reviewed By: aaron.ballman, rsmith, xbolva00

Subscribers: riccibruno, arphaman, ziangwan, ojeda, xbolva00, nickdesaulniers, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64838

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369414 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LifetimeAnalysis] Add support for free functions
Gabor Horvath [Tue, 20 Aug 2019 16:45:06 +0000 (16:45 +0000)]
[LifetimeAnalysis] Add support for free functions

Differential Revision: https://reviews.llvm.org/D66303

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369408 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agowin: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer
Nico Weber [Tue, 20 Aug 2019 16:28:11 +0000 (16:28 +0000)]
win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer

MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
so should clang-cl:
https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase

clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
or if that's not passed it tries to check what the installed version of
MSVC is and uses that, and failing that it uses a default version that's
currently 1911. So this changes the default if no -fmsc-version flag is
passed and no installed MSVC is detected. (It also changes the default
if -fmsc-version is passed or MSVC is detected, and either indicates
_MSC_VER >= 1911.)

As mentioned in the MSDN article, the Windows SDK header files in
version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
versions do not work correctly with /Zc:twoPhase. If you need to use
these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
the old behavior.

Fixes PR43032.

Differential Revision: https://reviews.llvm.org/D66394

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369402 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang] Use the new Regex::isValid() with no parameter
Jan Kratochvil [Tue, 20 Aug 2019 16:07:31 +0000 (16:07 +0000)]
[clang] Use the new Regex::isValid() with no parameter

Differential Revision: https://reviews.llvm.org/D66463

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369397 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Syntax] Added function to get macro expansion tokens to TokenBuffer.
Johan Vikstrom [Tue, 20 Aug 2019 13:34:01 +0000 (13:34 +0000)]
[Syntax] Added function to get macro expansion tokens to TokenBuffer.

Summary:
Returns the first token in every mapping where the token is an identifier.
This API is required to be able to highlight macro expansions in clangd.

Reviewers: hokein, ilya-biryukov

Subscribers: kadircet, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66470

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369385 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRemoved the 'id' AST matcher, which is superseded by '.bind()'
Dmitri Gribenko [Tue, 20 Aug 2019 13:02:28 +0000 (13:02 +0000)]
Removed the 'id' AST matcher, which is superseded by '.bind()'

Summary:
The 'id' matcher is not even included in the AST Matchers Reference
document, so I don't expect there to be a significant number of users.

There's no reason to provide two ways to do the exact same thing that
only have a minor syntactic difference.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66462

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369380 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Add const, volatile and pointer builtin handling
Sven van Haastregt [Tue, 20 Aug 2019 12:21:03 +0000 (12:21 +0000)]
[OpenCL] Add const, volatile and pointer builtin handling

Const, volatile, and pointer types were previously available, but not
working.  This patch adds handling for OpenCL builtin functions.

Add TableGen definitions for some atomic and asynchronous builtins to
make use of the new functionality.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D63442

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369373 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRudimentary support for Doxygen \retval command
Stephan Bergmann [Tue, 20 Aug 2019 08:36:21 +0000 (08:36 +0000)]
Rudimentary support for Doxygen \retval command

...so that at least a preceding \param etc. that lacks a description gets a
-Wdocumentation warning (instead of erroneously treating the \retval ... text as
its paragraph).

Differential Revision: https://reviews.llvm.org/D66350

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369345 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[CallGraph] Take into accound calls that aren't within any function bodies.
Artem Dergachev [Tue, 20 Aug 2019 02:22:37 +0000 (02:22 +0000)]
[CallGraph] Take into accound calls that aren't within any function bodies.

This patch improves Clang call graph analysis by adding in expressions
that are not found in regular function bodies, such as default arguments
or member initializers.

Patch by Joshua Cranmer!

Differential Revision: https://reviews.llvm.org/D65453

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369321 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter.
Artem Dergachev [Tue, 20 Aug 2019 02:15:50 +0000 (02:15 +0000)]
[analyzer] NFC: Rename GRBugReporter to PathSensitiveBugReporter.

The GR prefix is super ancient.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369320 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] NFC: Drop support for extra text attached to bug reports.
Artem Dergachev [Tue, 20 Aug 2019 02:15:47 +0000 (02:15 +0000)]
[analyzer] NFC: Drop support for extra text attached to bug reports.

It was introduced in 2011 but never used since then.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369319 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks
Anton Afanasyev [Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)]
[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks

Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.

This fixes http://llvm.org/pr41969

Reviewers: russell.gallop, lebedev.ri, thakis

Reviewed By: russell.gallop

Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D63325

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369308 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix poorly formatted HTML in the cxx_status.html file caused by adding
Erich Keane [Mon, 19 Aug 2019 18:14:22 +0000 (18:14 +0000)]
Fix poorly formatted HTML in the cxx_status.html file caused by adding
1668.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369286 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix test where diagnostics changed in P1668 implementation
Erich Keane [Mon, 19 Aug 2019 18:08:52 +0000 (18:08 +0000)]
Fix test where diagnostics changed in P1668 implementation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369284 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUpdate cxx_status.html with P1668 status.
Erich Keane [Mon, 19 Aug 2019 17:57:27 +0000 (17:57 +0000)]
Update cxx_status.html with P1668 status.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369282 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoImplement P1668R1
Erich Keane [Mon, 19 Aug 2019 17:39:59 +0000 (17:39 +0000)]
Implement P1668R1

Allow inline assembly statements in unexecuted branches of constexpr
functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369281 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoDon't keep stale pointers to LoopInfos.
Aaron Ballman [Mon, 19 Aug 2019 13:37:41 +0000 (13:37 +0000)]
Don't keep stale pointers to LoopInfos.

CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.

Patch by Bevin Hansson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369259 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Add generic type handling for builtin functions
Sven van Haastregt [Mon, 19 Aug 2019 11:56:03 +0000 (11:56 +0000)]
[OpenCL] Add generic type handling for builtin functions

Generic types are an abstraction of type sets.  It mimics the way
functions are defined in the OpenCL specification.  For example,
floatN can abstract all the vector sizes of the float type.

This allows to
 * stick more closely to the specification, which uses generic types;
 * factorize definitions of functions with numerous prototypes in the
   tablegen file; and
 * reduce the memory impact of functions with many overloads.

Patch by Pierre Gondois and Sven van Haastregt.

Differential Revision: https://reviews.llvm.org/D65456

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369253 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OpenCL] Fix addr space deduction for pointers/references to arrays.
Anastasia Stulova [Mon, 19 Aug 2019 11:43:16 +0000 (11:43 +0000)]
[OpenCL] Fix addr space deduction for pointers/references to arrays.

Rewrite the logic for detecting if we are deducing addr space of
a pointee type to take into account special logic for arrays. For
pointers/references to arrays we can have any number of parentheses
expressions as well as nested pointers.

Differential Revision: https://reviews.llvm.org/D66137

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369251 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Diagnostics] Diagnose misused xor as pow
David Bolvansky [Sun, 18 Aug 2019 19:14:14 +0000 (19:14 +0000)]
[Diagnostics] Diagnose misused xor as pow

Summary:
Motivation:
https://twitter.com/jfbastien/status/1139298419988549632
https://twitter.com/mikemx7f/status/1139335901790625793
https://codesearch.isocpp.org/cgi-bin/cgi_ppsearch?q=10+%5E&search=Search

Reviewers: jfb, rsmith, regehr, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: lebedev.ri, Quuxplusone, erik.pilkington, riccibruno, dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63423

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369217 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] Fix a bug that joins template closer and =
Owen Pan [Sun, 18 Aug 2019 18:51:39 +0000 (18:51 +0000)]
[clang-format] Fix a bug that joins template closer and =

Also fixes the documentation for SpaceBeforeAssignmentOperators.

See discussions at https://reviews.llvm.org/D66332

Differential Revision: https://reviews.llvm.org/D66384

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369214 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Diagnostics] Improve -Wsizeof-pointer-div
David Bolvansky [Sun, 18 Aug 2019 10:10:09 +0000 (10:10 +0000)]
[Diagnostics] Improve -Wsizeof-pointer-div

Emit diag note with a location of pointer declaration.
Revisited/added tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369206 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[SemaDeclCXX] Allow inheriting constructor declaration to specify a cv-qualified...
Tan S. B [Sat, 17 Aug 2019 20:57:52 +0000 (20:57 +0000)]
[SemaDeclCXX] Allow inheriting constructor declaration to specify a cv-qualified type

Differential Revision: https://reviews.llvm.org/D47419

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369196 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Turn an assert into an if condition
Kristof Umann [Sat, 17 Aug 2019 16:49:54 +0000 (16:49 +0000)]
[analyzer] Turn an assert into an if condition

Shocker, turns out that terminator conditions that are binary operators
aren't always logical operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369195 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Support -mlong-double-80
Troy A. Johnson [Sat, 17 Aug 2019 04:20:24 +0000 (04:20 +0000)]
[X86] Support -mlong-double-80

Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86.  The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.

Differential Revision: https://reviews.llvm.org/D66055

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369183 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReland "[ARM] push LR before __gnu_mcount_nc"
Jian Cai [Fri, 16 Aug 2019 23:30:16 +0000 (23:30 +0000)]
Reland "[ARM] push LR before __gnu_mcount_nc"

This relands r369147 with fixes to unit tests.

https://reviews.llvm.org/D65019

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369173 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[X86] Support -mlong-double-80"
Troy A. Johnson [Fri, 16 Aug 2019 23:18:22 +0000 (23:18 +0000)]
Revert "[X86] Support -mlong-double-80"

This reverts commit 250aafa2c4a1bc2395edfe8d4365545bbe56fffe.
Caused buildbot failures -- still investigating.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369170 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[doc] Fix some minor formatting issues.
Richard Smith [Fri, 16 Aug 2019 22:08:39 +0000 (22:08 +0000)]
[doc] Fix some minor formatting issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369161 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[clang-format] Fix the bug that joins template closer and > or >>
Owen Pan [Fri, 16 Aug 2019 21:49:17 +0000 (21:49 +0000)]
[clang-format] Fix the bug that joins template closer and > or >>

Also fixes a buggy test case.

See PR42404

Differential Revision: https://reviews.llvm.org/D66332

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369157 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Support -mlong-double-80
Troy A. Johnson [Fri, 16 Aug 2019 21:00:22 +0000 (21:00 +0000)]
[X86] Support -mlong-double-80

Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86.  The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.

Differential Revision: https://reviews.llvm.org/D66055

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369152 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert "[ARM] push LR before __gnu_mcount_nc"
Jian Cai [Fri, 16 Aug 2019 20:40:21 +0000 (20:40 +0000)]
Revert "[ARM] push LR before __gnu_mcount_nc"

This reverts commit f4cf3b959333f62b7a7b2d7771f7010c9d8da388.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369149 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Test Commit] Fix typo in diagtool.rst
Troy A. Johnson [Fri, 16 Aug 2019 20:26:48 +0000 (20:26 +0000)]
[Test Commit] Fix typo in diagtool.rst

Test commit after obtaining commit access.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369148 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] push LR before __gnu_mcount_nc
Jian Cai [Fri, 16 Aug 2019 20:21:08 +0000 (20:21 +0000)]
[ARM] push LR before __gnu_mcount_nc

Push LR register before calling __gnu_mcount_nc as it expects the value of LR register to be the top value of
the stack on ARM32.

Differential Revision: https://reviews.llvm.org/D65019

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369147 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[OPENMP5.0]Diagnose global variables in lambda not marked as declare
Alexey Bataev [Fri, 16 Aug 2019 20:15:02 +0000 (20:15 +0000)]
[OPENMP5.0]Diagnose global variables in lambda not marked as declare
target.

According to OpenMP 5.0, if a lambda declaration and definition appears between a declare target directive and the matching end declare target directive, all variables that are captured by the lambda expression must also appear in a to clause.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369146 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoStop abusing SuppressAllDiagnostics when speculatively determining
Richard Smith [Fri, 16 Aug 2019 19:53:22 +0000 (19:53 +0000)]
Stop abusing SuppressAllDiagnostics when speculatively determining
whether an expression would be valid during error recovery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369145 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix typos in LibASTImporter.rst
Gabor Marton [Fri, 16 Aug 2019 12:21:49 +0000 (12:21 +0000)]
Fix typos in LibASTImporter.rst

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369099 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Import ctor initializers after setting flags.
Balazs Keri [Fri, 16 Aug 2019 12:10:03 +0000 (12:10 +0000)]
[ASTImporter] Import ctor initializers after setting flags.

Summary:
Code to import "ctor initializers" at import of functions
is moved to be after the flags in the newly created function
are imported. This fixes an error when the already created but
incomplete (flags are not set) function declaration is accessed.

Reviewers: martong, shafik, a_sidorin, a.sidorin

Reviewed By: shafik

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65935

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369098 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Add inline asm constraint A for RISC-V
Lewis Revill [Fri, 16 Aug 2019 10:23:56 +0000 (10:23 +0000)]
[RISCV] Add inline asm constraint A for RISC-V

This allows the constraint A to be used in inline asm for RISC-V, which
allows an address held in a register to be used.

This patch adds the minimal amount of code required to get operands with
the right constraints to compile.

Differential Revision: https://reviews.llvm.org/D54295

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369093 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Analysis: Silence checkers
Csaba Dabis [Fri, 16 Aug 2019 01:53:14 +0000 (01:53 +0000)]
[analyzer] Analysis: Silence checkers

Summary:
This patch introduces a new `analyzer-config` configuration:
`-analyzer-config silence-checkers`
which could be used to silence the given checkers.

It accepts a semicolon separated list, packed into quotation marks, e.g:
`-analyzer-config silence-checkers="core.DivideZero;core.NullDereference"`

It could be used to "disable" core checkers, so they model the analysis as
before, just if some of them are too noisy it prevents to emit reports.

This patch also adds support for that new option to the scan-build.
Passing the option `-disable-checker core.DivideZero` to the scan-build
will be transferred to `-analyzer-config silence-checkers=core.DivideZero`.

Reviewed By: NoQ, Szelethus

Differential Revision: https://reviews.llvm.org/D66042

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369078 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug
Joel E. Denny [Thu, 15 Aug 2019 21:17:48 +0000 (21:17 +0000)]
[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

I'd like to add these comments to warn others of problems I
encountered when trying to use `RemoveLineIfEmpty`.  I originally
tried to fix the problem, but I realized I could implement the
functionality more easily and efficiently in my calling code where I
can make the simplifying assumption that there are no prior edits to
the line from which text is being removed.  While I've lost the
motivation to write a fix, which doesn't look easy, I figure a warning
to others is better than silence.

I've added a unit test to demonstrate the problem.  I don't know how
to mark it as an expected failure, so I just marked it disabled.

Reviewed By: jkorous

Differential Revision: https://reviews.llvm.org/D61466

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369049 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoMark the test as unsupported on darwin, NFC.
Alexey Bataev [Thu, 15 Aug 2019 20:31:47 +0000 (20:31 +0000)]
Mark the test as unsupported on darwin, NFC.

The bundler may fail on darwin, mark the test as not compatible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369044 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema] Implement DR2386 for C++17 structured binding
Reid Kleckner [Thu, 15 Aug 2019 19:45:28 +0000 (19:45 +0000)]
[Sema] Implement DR2386 for C++17 structured binding

Allow implementations to provide complete definitions of
std::tuple_size<T>, but to omit the 'value' member to signal that T is
not tuple-like. The Microsoft standard library implements
std::tuple_size<const T> this way.

If the value member exists, clang still validates that it is an ICE, but
if it does not, then the type is considered to not be tuple-like.

Fixes PR33236

Reviewers: rsmith

Differential Revision: https://reviews.llvm.org/D66040

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369043 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Correctly handle va_arg of zero-sized structures
Guanzhong Chen [Thu, 15 Aug 2019 19:33:36 +0000 (19:33 +0000)]
[WebAssembly] Correctly handle va_arg of zero-sized structures

Summary:
D66168 passes size 0 structs indirectly, while the wasm backend expects it to
be passed directly. This causes subsequent variadic arguments to be read
incorrectly.

This diff changes it so that size 0 structs are passed directly.

Reviewers: dschuff, tlively, sbc100

Reviewed By: dschuff

Subscribers: jgravelle-google, aheejin, sunfish, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66255

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369042 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRename this file from cx2.c to c2x.c; NFC.
Aaron Ballman [Thu, 15 Aug 2019 18:37:30 +0000 (18:37 +0000)]
Rename this file from cx2.c to c2x.c; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369035 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAllow standards-based attributes to have leading and trailing underscores.
Aaron Ballman [Thu, 15 Aug 2019 18:35:44 +0000 (18:35 +0000)]
Allow standards-based attributes to have leading and trailing underscores.

This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369033 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix the test, NFC.
Alexey Bataev [Thu, 15 Aug 2019 17:53:49 +0000 (17:53 +0000)]
Fix the test, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369028 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoTest commit #2.
George Karpenkov [Thu, 15 Aug 2019 17:17:21 +0000 (17:17 +0000)]
Test commit #2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369020 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Driver][Bundler] Improve bundling of object files.
Alexey Bataev [Thu, 15 Aug 2019 17:15:35 +0000 (17:15 +0000)]
[Driver][Bundler] Improve bundling of object files.

Summary:
Previously, object files were bundled using partial linking. It resulted
in the following structure of the bundled objects:
```
<host_code>
clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__<target>
<target_code>
```
But when we tried to unbundle object files, it worked correctly only for
the target objects. The host object remains bundled. It produced a lot of
junk sections in the host object files and in some cases may caused
incorrect linking.

Patch improves bundling of the object files. After this patch the
bundled object looks like this:

```
<host_code>
clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__<target>
<target_code>
__CLANG_OFFLOAD_BUNDLE__<host>
<host_code>
```

With this structure we are able to unbundle the host object files too so
that after unbundling they are the same as were before.
The host section is bundled twice. The bundled section is used to
unbundle the original host section.

Reviewers: yaxunl, tra, jlebar, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65819

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369019 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BUNDLER]Improve the test, NFC.
Alexey Bataev [Thu, 15 Aug 2019 16:28:24 +0000 (16:28 +0000)]
[BUNDLER]Improve the test, NFC.

Summary:
Make the test more portable and do not rely on the pre-bundled object
file.

Reviewers: Hahnfeld, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66296

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369015 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoReplace llvm::integer_sequence and friends with the C++14 standard version
Benjamin Kramer [Thu, 15 Aug 2019 10:56:05 +0000 (10:56 +0000)]
Replace llvm::integer_sequence and friends with the C++14 standard version

The implementation in libc++ takes O(1) compile time, ours was O(n).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368990 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert rL368939 "Remove LVALUE / RVALUE workarounds"
Russell Gallop [Thu, 15 Aug 2019 10:12:11 +0000 (10:12 +0000)]
Revert rL368939 "Remove LVALUE / RVALUE workarounds"

This reverts commit cad8356d699b36c73abb267f65db575ddacbd652.

To unbreak Windows bots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368985 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[analyzer] Warn about -analyzer-configs being meant for development purposes only
Kristof Umann [Thu, 15 Aug 2019 08:53:16 +0000 (08:53 +0000)]
[analyzer] Warn about -analyzer-configs being meant for development purposes only

This is more of a temporary fix, long term, we should convert AnalyzerOptions.def
into the universally beloved (*coughs*) TableGen format, where they can more
easily be separated into developer-only, alpha, and user-facing configs.

Differential Revision: https://reviews.llvm.org/D66261

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368980 91177308-0d34-0410-b5e6-96231b3b80d8