]> granicus.if.org Git - clang/log
clang
5 years ago[LifetimeAnalysis] Fix some false positives
Gabor Horvath [Tue, 3 Sep 2019 16:17:24 +0000 (16:17 +0000)]
[LifetimeAnalysis] Fix some false positives

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

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

5 years ago[analyzer] Add a checker option to detect nested dead stores
Kristof Umann [Tue, 3 Sep 2019 15:22:43 +0000 (15:22 +0000)]
[analyzer] Add a checker option to detect nested dead stores

Enables the users to specify an optional flag which would warn for more dead
stores.
Previously it ignored if the dead store happened e.g. in an if condition.

if ((X = generate())) { // dead store to X
}

This patch introduces the `WarnForDeadNestedAssignments` option to the checker,
which is `false` by default - so this change would not affect any previous
users.
I have updated the code, tests and the docs as well. If I missed something, tell
me.

I also ran the analysis on Clang which generated 14 more reports compared to the
unmodified version. All of them seemed reasonable for me.

Related previous patches:
rGf224820b45c6847b91071da8d7ade59f373b96f3

Reviewers: NoQ, krememek, Szelethus, baloghadamsoftware

Reviewed By: Szelethus

Patch by Balázs Benics!

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

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

5 years ago[OpenCL] Drop spurious semicolon in generated file; NFC
Sven van Haastregt [Tue, 3 Sep 2019 11:23:24 +0000 (11:23 +0000)]
[OpenCL] Drop spurious semicolon in generated file; NFC

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

5 years agoFixit for -Wfinal-dtor-non-final-class
David Bolvansky [Tue, 3 Sep 2019 10:54:25 +0000 (10:54 +0000)]
Fixit for -Wfinal-dtor-non-final-class

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

5 years agoAdded fixit notes for -Wfinal-dtor-non-final-class
David Bolvansky [Tue, 3 Sep 2019 10:32:21 +0000 (10:32 +0000)]
Added fixit notes for -Wfinal-dtor-non-final-class

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

5 years ago[ARM NEON] Avoid duplicated decarations
Diogo N. Sampaio [Tue, 3 Sep 2019 09:16:44 +0000 (09:16 +0000)]
[ARM NEON] Avoid duplicated decarations

Summary:
The declaration of arm neon intrinsics that are
"big endian safe" print the same code for big
and small endian targets.
This patch avoids duplicates by checking if an
intrinsic is safe to have a single definition.
(decreases header 11k lines out of 73k).

Reviewers: t.p.northover, ostannard, labrinea

Reviewed By: ostannard

Subscribers: kristof.beyls, cfe-commits, olista01

Tags: #clang

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

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

5 years ago[RISCV] Correct Logic around ilp32e macros
Sam Elliott [Tue, 3 Sep 2019 08:47:58 +0000 (08:47 +0000)]
[RISCV] Correct Logic around ilp32e macros

Summary:
GCC seperates the `__riscv_float_abi_*` macros and the
`__riscv_abi_rve` macro. If the chosen abi is ilp32e, `gcc -march=rv32i
-mabi=ilp32i -E -dM` shows that both `__riscv_float_abi_soft` and
`__riscv_abi_rve` are set.

This patch corrects the compiler logic around these defines.

At the moment, this patch will not change clang's behaviour, because we do not
accept the `ilp32e` abi yet.

Reviewers: luismarques, asb

Reviewed By: luismarques

Subscribers: rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, cfe-commits

Tags: #clang

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

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

5 years ago[x86] Fix bugs of some intrinsic functions in CLANG : _mm512_stream_ps, _mm512_stream...
Pengfei Wang [Tue, 3 Sep 2019 02:06:15 +0000 (02:06 +0000)]
[x86] Fix bugs of some intrinsic functions in CLANG : _mm512_stream_ps, _mm512_stream_pd, _mm512_stream_si512

Reviewers: craig.topper, pengfei, LuoYuanke, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Patch by Bing Yu (yubing)

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

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

5 years agoRename -Wc++20-designator to -Wc++2a-designator for consistency and add
Richard Smith [Mon, 2 Sep 2019 23:27:54 +0000 (23:27 +0000)]
Rename -Wc++20-designator to -Wc++2a-designator for consistency and add
some test coverage for the flag.

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

5 years agoSplit -Wreorder into different warnings for reordering a constructor
Richard Smith [Mon, 2 Sep 2019 23:17:32 +0000 (23:17 +0000)]
Split -Wreorder into different warnings for reordering a constructor
mem-initializer list and for reordering a designated initializer list.

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

5 years ago[Wdocumentation] fixes an assertion failure with typedefed function and block pointer
Dmitri Gribenko [Mon, 2 Sep 2019 18:24:33 +0000 (18:24 +0000)]
[Wdocumentation] fixes an assertion failure with typedefed function and block pointer

Summary:
The assertion happens when compiling with -Wdocumentation with variable declaration to a typedefed function pointer. I not too familiar with the ObjC syntax but first two tests assert without this patch.

Fixes https://bugs.llvm.org/show_bug.cgi?id=42844

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoThinLTO: Document the option BOOTSTRAP_LLVM_ENABLE_LTO
Sylvestre Ledru [Mon, 2 Sep 2019 15:34:53 +0000 (15:34 +0000)]
ThinLTO: Document the option BOOTSTRAP_LLVM_ENABLE_LTO

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

5 years ago[unittests][AST] CommentParser: don't name variable 'DEBUG'
Roman Lebedev [Mon, 2 Sep 2019 12:34:21 +0000 (12:34 +0000)]
[unittests][AST] CommentParser: don't name variable 'DEBUG'

It's may be an already-defined macro name,
resulting in compilation errors.

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Mon, 2 Sep 2019 11:34:47 +0000 (11:34 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370636 (git commit 8327fed9475a14c3376b4860c75370c730e08f33)

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

5 years ago[AST] AST structural equivalence to work internally with pairs.
Balazs Keri [Mon, 2 Sep 2019 11:01:09 +0000 (11:01 +0000)]
[AST] AST structural equivalence to work internally with pairs.

Summary:
The structural equivalence check stores now pairs of nodes in the
'from' and 'to' context instead of only the node in 'from' context
and a corresponding one in 'to' context. This is needed to handle
cases when a Decl in the 'from' context is to be compared with
multiple Decls in the 'to' context.

Reviewers: martong, a_sidorin

Reviewed By: martong, a_sidorin

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

Tags: #clang

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

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Mon, 2 Sep 2019 10:38:08 +0000 (10:38 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] At import of records re-order indirect fields too.
Balazs Keri [Mon, 2 Sep 2019 07:17:01 +0000 (07:17 +0000)]
[ASTImporter] At import of records re-order indirect fields too.

Summary:
Correct order of fields and indirect fields in imported RecordDecl
is needed for correct work of record layout calculations.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: martong, a_sidorin

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

Tags: #clang

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

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

5 years agoFix variable HasArrayDesignator set but not used warning. NFCI.
Simon Pilgrim [Sun, 1 Sep 2019 13:10:08 +0000 (13:10 +0000)]
Fix variable HasArrayDesignator set but not used warning. NFCI.

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

5 years ago[clang] Devirtualization for classes with destructors marked as 'final'
David Bolvansky [Sat, 31 Aug 2019 18:52:44 +0000 (18:52 +0000)]
[clang] Devirtualization for classes with destructors marked as 'final'

A class with a destructor marked final cannot be derived from, so it should afford the same devirtualization opportunities as marking the entire class final.

Patch by logan-5 (Logan Smith)
Reviewed by rsmith

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

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

5 years ago[NFC] Fix for rL370594
David Bolvansky [Sat, 31 Aug 2019 18:35:44 +0000 (18:35 +0000)]
[NFC] Fix for rL370594

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

5 years ago[clang] Warning for non-final classes with final destructors
David Bolvansky [Sat, 31 Aug 2019 18:31:19 +0000 (18:31 +0000)]
[clang] Warning for non-final classes with final destructors

Marking a class' destructor final prevents the class from being inherited from. However, it is a subtle and awkward way to express that at best, and unintended at worst. It may also generate worse code (in other compilers) than marking the class itself final. For these reasons, this revision adds a warning for nonfinal classes with final destructors, with a note to suggest marking the class final to silence the warning.

See https://reviews.llvm.org/D66621 for more background.

Patch by logan-5 (Logan Smith)

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

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Sat, 31 Aug 2019 15:15:39 +0000 (15:15 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370584 (git commit afcb3de117265a69d21e5673356e925a454d7d02)

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Sat, 31 Aug 2019 15:00:38 +0000 (15:00 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years agoIntroduce a DirectoryEntryRef that stores both a reference and an
Alex Lorenz [Sat, 31 Aug 2019 01:26:04 +0000 (01:26 +0000)]
Introduce a DirectoryEntryRef that stores both a reference and an
accessed name to the directory entry

This commit introduces a parallel API that returns a DirectoryEntryRef
to the FileManager, similar to the parallel FileEntryRef API. All
uses will have to be update in follow-up patches. The immediate use of the new API in this
patch fixes the issue where a file manager was reused in clang-scan-deps,
but reported an different file path whenever a framework lookup was done through a symlink.

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

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

5 years ago[c++20] Add support for designated direct-list-initialization syntax.
Richard Smith [Sat, 31 Aug 2019 01:00:37 +0000 (01:00 +0000)]
[c++20] Add support for designated direct-list-initialization syntax.

This completes the implementation of P0329R4.

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

5 years ago[WebAssembly] Add SIMD QFMA/QFMS
Thomas Lively [Sat, 31 Aug 2019 00:12:29 +0000 (00:12 +0000)]
[WebAssembly] Add SIMD QFMA/QFMS

Summary:
Adds clang builtins and LLVM intrinsics for these experimental
instructions. They are not implemented in engines yet, but that is ok
because the user must opt into using them by calling the builtins.

Reviewers: aheejin, dschuff

Reviewed By: aheejin

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[c++20] Disallow template argument deduction from a braced-init-list
Richard Smith [Sat, 31 Aug 2019 00:05:50 +0000 (00:05 +0000)]
[c++20] Disallow template argument deduction from a braced-init-list
containing designators. The C++20 wording doesn't actually say what
happens in this case, but treating this as a non-deduced context seems
like the most natural behavior.

(We might want to consider deducing through array designators as an
extension in the future, but will need to be careful to deduce the array
bound properly if we do so. That's not permitted herein.)

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

5 years agoASTReader: Bypass overridden files when reading PCHs
Duncan P. N. Exon Smith [Fri, 30 Aug 2019 22:59:25 +0000 (22:59 +0000)]
ASTReader: Bypass overridden files when reading PCHs

If contents of a file that is part of a PCM are overridden when reading
it, but weren't overridden when the PCM was being built, the ASTReader
will emit an error.  Now it creates a separate FileEntry for recovery,
bypassing the overridden content instead of discarding it.  The
pre-existing testcase clang/test/PCH/remap-file-from-pch.cpp confirms
that the new recovery method works correctly.

This resolves a long-standing FIXME to avoid hypothetically invalidating
another precompiled module that's already using the overridden contents.

This also removes ContentCache-related API that would be unsafe to use
across `CompilerInstance`s in an implicit modules build.  This helps to
unblock us sinking it from SourceManager into FileManager in the future,
which would allow us to delete `InMemoryModuleCache`.

https://reviews.llvm.org/D66710

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

5 years ago[c++20] Implement semantic restrictions for C++20 designated
Richard Smith [Fri, 30 Aug 2019 22:52:55 +0000 (22:52 +0000)]
[c++20] Implement semantic restrictions for C++20 designated
initializers.

This has some interesting interactions with our existing extensions to
support C99 designated initializers as an extension in C++. Those are
resolved as follows:

 * We continue to permit the full breadth of C99 designated initializers
   in C++, with the exception that we disallow a partial overwrite of an
   initializer with a non-trivially-destructible type. (Full overwrite
   is OK, because we won't run the first initializer at all.)

 * The C99 extensions are disallowed in SFINAE contexts and during
   overload resolution, where they could change the meaning of valid
   programs.

 * C++20 disallows reordering of initializers. We only check for that for
   the simple cases that the C++20 rules permit (designators of the form
   '.field_name =' and continue to allow reordering in other cases).
   It would be nice to improve this behavior in future.

 * All C99 designated initializer extensions produce a warning by
   default in C++20 mode. People are going to learn the C++ rules based
   on what Clang diagnoses, so it's important we diagnose these properly
   by default.

 * In C++ <= 17, we apply the C++20 rules rather than the C99 rules, and
   so still diagnose C99 extensions as described above. We continue to
   accept designated C++20-compatible initializers in C++ <= 17 silently
   by default (but naturally still reject under -pedantic-errors).

This is not a complete implementation of P0329R4. In particular, that
paper introduces new non-C99-compatible syntax { .field { init } }, and
we do not support that yet.

This is based on a previous patch by Don Hinton, though I've made
substantial changes when addressing the above interactions.

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

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 21:32:00 +0000 (21:32 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370531 (git commit d4c1002e0bbbbab50f6891cdd2f5bd3a8f3a3584)

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 21:17:03 +0000 (21:17 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[clang-scan-deps] NFC, remove outdated implementation comment
Alex Lorenz [Fri, 30 Aug 2019 17:34:22 +0000 (17:34 +0000)]
[clang-scan-deps] NFC, remove outdated implementation comment

There's no need to purge symlinked entries in the FileManager,
as the new FileEntryRef API allows us to compute dependencies more
accurately when the FileManager is reused.

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

5 years agoFileManager: Remove ShouldCloseOpenFile argument from getBufferForFile, NFC
Duncan P. N. Exon Smith [Fri, 30 Aug 2019 16:56:26 +0000 (16:56 +0000)]
FileManager: Remove ShouldCloseOpenFile argument from getBufferForFile, NFC

Remove this dead code.  We always close it.

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

5 years agoRevert [Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 15:41:45 +0000 (15:41 +0000)]
Revert [Clang Interpreter] Initial patch for the constexpr interpreter

This reverts r370476 (git commit a5590950549719d0d9ea69ed164b0c8c0f4e02e6)

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

5 years ago[Clang Interpreter] Initial patch for the constexpr interpreter
Nandor Licker [Fri, 30 Aug 2019 15:02:09 +0000 (15:02 +0000)]
[Clang Interpreter] Initial patch for the constexpr interpreter

Summary:
This patch introduces the skeleton of the constexpr interpreter,
capable of evaluating a simple constexpr functions consisting of
if statements. The interpreter is described in more detail in the
RFC. Further patches will add more features.

Reviewers: Bigcheese, jfb, rsmith

Subscribers: bruno, uenoku, ldionne, Tyker, thegameg, tschuett, dexonsmith, mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Do not look up lambda classes
Gabor Marton [Fri, 30 Aug 2019 10:55:41 +0000 (10:55 +0000)]
[ASTImporter] Do not look up lambda classes

Summary:
Consider this code:
```
      void f() {
        auto L0 = [](){};
        auto L1 = [](){};
      }

```
First we import `L0` then `L1`. Currently we end up having only one
CXXRecordDecl for the two different lambdas. And that is a problem if
the body of their op() is different. This happens because when we import
`L1` then lookup finds the existing `L0` and since they are structurally
equivalent we just map the imported L0 to be the counterpart of L1.

We have the same problem in this case:
```
      template <typename F0, typename F1>
      void f(F0 L0 = [](){}, F1 L1 = [](){}) {}

```

In StructuralEquivalenceContext we could distinquish lambdas only by
their source location in these cases. But we the lambdas are actually
structrually equivalent they differn only by the source location.

Thus, the  solution is to disable lookup completely if the decl in
the "from" context is a lambda.
However, that could have other problems: what if the lambda is defined
in a header file and included in several TUs? I think we'd have as many
duplicates as many includes we have. I think we could live with that,
because the lambda classes are TU local anyway, we cannot just access
them from another TU.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years ago[ASTImporter] Propagate errors during import of overridden methods.
Balazs Keri [Fri, 30 Aug 2019 10:12:14 +0000 (10:12 +0000)]
[ASTImporter] Propagate errors during import of overridden methods.

Summary:
If importing overridden methods fails for a method it can be seen
incorrectly as non-virtual. To avoid this inconsistency the method
is marked with import error to avoid later use of it.

Reviewers: martong, a.sidorin, shafik, a_sidorin

Reviewed By: martong, shafik

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

Tags: #clang

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

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

5 years ago[Tooling] Migrated APIs that take ownership of objects to unique_ptr
Dmitri Gribenko [Fri, 30 Aug 2019 09:29:34 +0000 (09:29 +0000)]
[Tooling] Migrated APIs that take ownership of objects to unique_ptr

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[CodeGen]: fix error message for "=r" asm constraint
Alexander Potapenko [Fri, 30 Aug 2019 08:58:46 +0000 (08:58 +0000)]
[CodeGen]: fix error message for "=r" asm constraint

Summary:
Nico Weber reported that the following code:
  char buf[9];
  asm("" : "=r" (buf));

yields the "impossible constraint in asm: can't store struct into a register"
error message, although |buf| is not a struct (see
http://crbug.com/999160).

Make the error message more generic and add a test for it.
Also make sure other tests in x86_64-PR42672.c check for the full error
message.

Reviewers: eli.friedman, thakis

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang-scan-deps] NFC, refactor the DependencyScanningWorker to use a consumer
Alex Lorenz [Fri, 30 Aug 2019 01:25:57 +0000 (01:25 +0000)]
[clang-scan-deps] NFC, refactor the DependencyScanningWorker to use a consumer
to report the dependencies to the client

This will allow the scanner to report modular dependencies to the consumer.
This will also allow the scanner to accept regular cc1 clang invocations, e.g.
in an implementation of a libclang C API for clang-scan-deps, that I will add
follow-up patches for in the future.

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

5 years ago[Modules] Make ReadModuleMapFileBlock errors reliable
Bruno Cardoso Lopes [Thu, 29 Aug 2019 23:14:08 +0000 (23:14 +0000)]
[Modules] Make ReadModuleMapFileBlock errors reliable

This prevents a crash when an error should be emitted instead.

During implicit module builds, there are cases where ReadASTCore is called with
ImportedBy set to nullptr, which breaks expectations in ReadModuleMapFileBlock,
leading to crashes.

Fix this by improving ReadModuleMapFileBlock to handle ImportedBy correctly.
This only happens non deterministically in the wild, when the underlying file
system changes while concurrent compiler invocations use implicit modules,
forcing rebuilds which see an inconsistent filesystem state. That said, there's
no much to do w.r.t. writing tests here.

rdar://problem/48828801

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

5 years ago[CMake][Fuchsia] Enable experimental pass manager by default
Petr Hosek [Thu, 29 Aug 2019 23:12:06 +0000 (23:12 +0000)]
[CMake][Fuchsia] Enable experimental pass manager by default

We plan on using experimental new pass manager for Fuchsia toolchain.

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

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

5 years ago[clang-scan-deps] reuse the file manager across invocations of
Alex Lorenz [Thu, 29 Aug 2019 22:56:38 +0000 (22:56 +0000)]
[clang-scan-deps] reuse the file manager across invocations of
the dependency scanner on a single worker thread

This behavior can be controlled using the new `-reuse-filemanager` clang-scan-deps
option. By default the file manager is reused.

The added test/ClangScanDeps/symlink.cpp is able to pass with
the reused filemanager after the related FileEntryRef changes
landed earlier. The test test/ClangScanDeps/subframework_header_dir_symlink.m
still fails when the file manager is reused (I run the FileCheck with not to
make it PASS). I will address this in a follow-up patch that improves
the DirectoryEntry name modelling in the FileManager.

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

5 years agoFix silent wrong-code bugs and crashes with designated initialization.
Richard Smith [Thu, 29 Aug 2019 22:49:34 +0000 (22:49 +0000)]
Fix silent wrong-code bugs and crashes with designated initialization.

We failed to correctly handle the 'holes' left behind by designated
initializers in VerifyOnly mode. This would result in us thinking that a
designated initialization would be valid, only to find that it is not
actually valid when we come to build it. In a +Asserts build, that would
assert, and in a -Asserts build, that would silently lose some part of
the initialization or crash.

With this change, when an InitListExpr contains any designators, we now
always build a structured list so that we can track the locations of the
'holes' that we need to go back and fill in.

We could in principle do better: we only need the structured form if
there is a designator that jumps backwards (and can otherwise check for
the holes as we progress through the initializer list), but dealing with
that turns out to be rather complicated, so it's not done as part of
this patch.

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

5 years agoRefactor InitListChecker to check only a single (explicit) initializer
Richard Smith [Thu, 29 Aug 2019 22:49:33 +0000 (22:49 +0000)]
Refactor InitListChecker to check only a single (explicit) initializer
list, rather than recursively checking multiple lists in C.

This simplification is in preparation for making InitListChecker
maintain more state that's specific to the explicit initializer list,
particularly when handling designated initialization.

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

5 years agoRefactor InitListChecker to make it a bit clearer that hasError is only
Richard Smith [Thu, 29 Aug 2019 22:49:32 +0000 (22:49 +0000)]
Refactor InitListChecker to make it a bit clearer that hasError is only
set to true in VerifyOnly mode in cases where it's also set to true when
actually building the initializer list.

Add FIXMEs for the two cases where that's not true. No functionality
change intended.

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

5 years ago[NFC] Test commit - sorted headers.
Nandor Licker [Thu, 29 Aug 2019 21:57:47 +0000 (21:57 +0000)]
[NFC] Test commit - sorted headers.

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

5 years ago[CFG] Fix CFG for statement-expressions in return values.
Artem Dergachev [Thu, 29 Aug 2019 20:37:28 +0000 (20:37 +0000)]
[CFG] Fix CFG for statement-expressions in return values.

We're building the CFG from bottom to top, so when the return-value expression
has a non-trivial CFG on its own, we need to continue building from the entry
to the return-value expression CFG rather than from the block to which
we've just appended the return statement.

Fixes a false positive warning "control may reach end of non-void function".

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

5 years agoAvoid crash when dumping NULL Type as JSON.
Aaron Ballman [Thu, 29 Aug 2019 20:00:40 +0000 (20:00 +0000)]
Avoid crash when dumping NULL Type as JSON.

Patch by Bert Belder.

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

5 years agoRemove `FileManager::invalidateCache` as it has no callers anymore. NFC.
Volodymyr Sapsai [Thu, 29 Aug 2019 19:51:25 +0000 (19:51 +0000)]
Remove `FileManager::invalidateCache` as it has no callers anymore. NFC.

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

5 years ago[X86] Remove what little support we had for MPX
Craig Topper [Thu, 29 Aug 2019 18:09:02 +0000 (18:09 +0000)]
[X86] Remove what little support we had for MPX

-Deprecate -mmpx and -mno-mpx command line options
-Remove CPUID detection of mpx for -march=native
-Remove MPX from all CPUs
-Remove MPX preprocessor define

I've left the "mpx" string in the backend so we don't fail on old IR, but its not connected to anything.

gcc has also deprecated these command line options. https://www.phoronix.com/scan.php?page=news_item&px=GCC-Patch-To-Drop-MPX

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

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

5 years agoAdded 'inline' to functions defined in headers to avoid ODR violations
Dmitri Gribenko [Thu, 29 Aug 2019 16:58:13 +0000 (16:58 +0000)]
Added 'inline' to functions defined in headers to avoid ODR violations

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

5 years agoChanged FrontendActionFactory::create to return a std::unique_ptr
Dmitri Gribenko [Thu, 29 Aug 2019 16:38:36 +0000 (16:38 +0000)]
Changed FrontendActionFactory::create to return a std::unique_ptr

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years agoRemoved a function declaration that doesn't have a definition
Dmitri Gribenko [Thu, 29 Aug 2019 14:21:05 +0000 (14:21 +0000)]
Removed a function declaration that doesn't have a definition

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

5 years agoFix variable ‘IsInitCapturePack’ set but not used warning. NFCI.
Simon Pilgrim [Thu, 29 Aug 2019 12:41:19 +0000 (12:41 +0000)]
Fix variable ‘IsInitCapturePack’ set but not used warning. NFCI.

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

5 years agoRemoved `AnyFunctionDecl`, it is unused.
Dmitri Gribenko [Thu, 29 Aug 2019 12:17:21 +0000 (12:17 +0000)]
Removed `AnyFunctionDecl`, it is unused.

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

5 years agoRemoved two function declarations that don't have definitions
Dmitri Gribenko [Thu, 29 Aug 2019 12:10:15 +0000 (12:10 +0000)]
Removed two function declarations that don't have definitions

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

5 years ago[Index] Added a ShouldSkipFunctionBody callback to libIndex, and refactored clients...
Dmitri Gribenko [Thu, 29 Aug 2019 11:47:34 +0000 (11:47 +0000)]
[Index] Added a ShouldSkipFunctionBody callback to libIndex, and refactored clients to use it instead of inventing their own solution

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[Index] Stopped wrapping FrontendActions in libIndex and its users
Dmitri Gribenko [Thu, 29 Aug 2019 11:43:05 +0000 (11:43 +0000)]
[Index] Stopped wrapping FrontendActions in libIndex and its users

Exposed a new function, createIndexingASTConsumer, that creates an
ASTConsumer. ASTConsumers compose well.

Removed wrapping functionality from createIndexingAction.

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

5 years ago[Index] Moved the IndexDataConsumer::finish call into the IndexASTConsumer from Index...
Dmitri Gribenko [Thu, 29 Aug 2019 11:38:43 +0000 (11:38 +0000)]
[Index] Moved the IndexDataConsumer::finish call into the IndexASTConsumer from IndexAction

Doing so removes the last reason to expose a FrontendAction from
libIndex.

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

5 years ago[CodeGen]: don't treat structures returned in registers as memory inputs
Alexander Potapenko [Thu, 29 Aug 2019 11:21:41 +0000 (11:21 +0000)]
[CodeGen]: don't treat structures returned in registers as memory inputs

Summary:
The "=r" output constraint for a structure variable passed to inline asm
shouldn't be converted to "=*r", as this changes the asm directive
semantics and prevents DSE optimizations.
Instead, preserve the constraints and return such structures as integers
of corresponding size, which are converted back to structures when
storing the result.

Fixes PR42672.

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Index] Create PP callbacks in the ASTConsumer
Dmitri Gribenko [Thu, 29 Aug 2019 10:23:29 +0000 (10:23 +0000)]
[Index] Create PP callbacks in the ASTConsumer

Doing so removes one reason to create a custom FrontendAction.
FrontendActions are not desirable because they are difficult to compose.
ASTConsumers are much easier to compose.

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

5 years ago[OpenCL] Fix diagnosing enqueue_kernel call with too few args
Sven van Haastregt [Thu, 29 Aug 2019 10:21:06 +0000 (10:21 +0000)]
[OpenCL] Fix diagnosing enqueue_kernel call with too few args

The err_typecheck_call_too_few_args diagnostic takes arguments, but
none were provided causing clang to crash when attempting to diagnose
an enqueue_kernel call with too few arguments.

Fixes llvm.org/PR42045

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

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

5 years ago[Index] Marked a bunch of classes 'final'
Dmitri Gribenko [Thu, 29 Aug 2019 10:16:41 +0000 (10:16 +0000)]
[Index] Marked a bunch of classes 'final'

This file defines multiple inheritance hierarchies and 'final' helps
with readability.

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

5 years ago[Analyzer] Iterator Checkers - Make range errors and invalidated access fatal
Adam Balogh [Thu, 29 Aug 2019 09:35:47 +0000 (09:35 +0000)]
[Analyzer] Iterator Checkers - Make range errors and invalidated access fatal

Range errors (dereferencing or incrementing the past-the-end iterator or
decrementing the iterator of the first element of the range) and access of
invalidated iterators lead to undefined behavior. There is no point to
continue the analysis after such an error on the same execution path, but
terminate it by a sink node (fatal error). This also improves the
performance and helps avoiding double reports (e.g. in case of nested
iterators).

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

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

5 years ago[Test][Time profiler] Fix test for python3
Anton Afanasyev [Thu, 29 Aug 2019 06:49:05 +0000 (06:49 +0000)]
[Test][Time profiler] Fix test for python3

Summary:
Fix test checking time profiler generates correct tracing json-file.
`filter` works differently for python2 and python3, so unifying this.

Reviewers: mgehre, nathanchance

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRemoved dead code from clang/AST/NSAPI.h
Dmitri Gribenko [Thu, 29 Aug 2019 06:30:12 +0000 (06:30 +0000)]
Removed dead code from clang/AST/NSAPI.h

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[x86] Adding support for some missing intrinsics: _mm512_cvtsi512_si32
Pengfei Wang [Thu, 29 Aug 2019 06:18:34 +0000 (06:18 +0000)]
[x86] Adding support for some missing intrinsics: _mm512_cvtsi512_si32

Summary:
Adding support for some missing intrinsics:
_mm512_cvtsi512_si32

Reviewers: craig.topper, pengfei, LuoYuanke, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: llvm-commits

Patch by Bing Yu (yubing)

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

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

5 years ago[Modules] Fix rebuilding an updated module for each of its consumers.
Volodymyr Sapsai [Wed, 28 Aug 2019 23:31:32 +0000 (23:31 +0000)]
[Modules] Fix rebuilding an updated module for each of its consumers.

Marking a module for a rebuild when its signature differs from the
expected one causes redundant module rebuilds for incremental builds.
When a module is updated, its signature changes. But its consumers still
have the old signature and loading them will result in signature
mismatches. It will correctly cause the rebuilds for the consumers but
we don't need to rebuild the common module for each of them as it is
already up to date.

In practice this bug causes longer build times. We are doing more work
than required and only a single process can build a module, so parallel
builds degrade to a single-process mode where extra processes are just
waiting on a file lock.

Fix by not marking a module dependency for a rebuild on signature
mismatch. We'll check if it is up to date when we load it.

rdar://problem/50212358

Reviewers: dexonsmith, bruno, rsmith

Reviewed By: dexonsmith, bruno

Subscribers: jkorous, ributzka, cfe-commits, aprantl

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

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

5 years agoFix a passing XFAIL test
Erik Pilkington [Wed, 28 Aug 2019 22:38:36 +0000 (22:38 +0000)]
Fix a passing XFAIL test

Now that we can gracefully handle stack exhaustion, this test was passing in
darwin && asan. Instead, just unsupport it when threading is unavailable.

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

5 years ago[analyzer] Fix more analyzer warnings on analyzer and libAnalysis.
Artem Dergachev [Wed, 28 Aug 2019 21:19:58 +0000 (21:19 +0000)]
[analyzer] Fix more analyzer warnings on analyzer and libAnalysis.

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

5 years agoFix always_inline 'target' compatibility check code for Lambdas
Erich Keane [Wed, 28 Aug 2019 20:59:25 +0000 (20:59 +0000)]
Fix always_inline 'target' compatibility check code for Lambdas

The previous version of this used CurFuncDecl in CodeGenFunction,
however this doesn't include lambdas.  However, CurCodeDecl DOES. Switch
the check to use CurCodeDecl so that the actual function being emitted
gets checked, preventing an error in ISEL.

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

5 years ago[CFG] Make representation of destructor calls more accurate.
Artem Dergachev [Wed, 28 Aug 2019 18:44:42 +0000 (18:44 +0000)]
[CFG] Make representation of destructor calls more accurate.

Respect C++17 copy elision; previously it would generate destructor calls
for elided temporaries, including in initialization and return statements.

Don't generate duplicate destructor calls for statement expressions.

Fix destructors in initialization lists and comma operators.

Improve printing of implicit destructors.

Patch by Nicholas Allegra!

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

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

5 years ago[analyzer] Fix analyzer warnings on analyzer.
Artem Dergachev [Wed, 28 Aug 2019 18:44:38 +0000 (18:44 +0000)]
[analyzer] Fix analyzer warnings on analyzer.

Write tests for the actual crash that was found. Write comments and refactor
code around 17 style bugs and suppress 3 false positives.

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

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

5 years ago[analyzer] pr43036: Fix support for operator 'sizeof...'.
Artem Dergachev [Wed, 28 Aug 2019 18:44:35 +0000 (18:44 +0000)]
[analyzer] pr43036: Fix support for operator 'sizeof...'.

It was known to be a compile-time constant so it wasn't evaluated during
symbolic execution, but it wasn't evaluated as a compile-time constant either.

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

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

5 years ago[analyzer] Trust global initializers when analyzing main().
Artem Dergachev [Wed, 28 Aug 2019 18:44:32 +0000 (18:44 +0000)]
[analyzer] Trust global initializers when analyzing main().

If the global variable has an initializer, we'll ignore it because we're usually
not analyzing the program from the beginning, which means that the global
variable may have changed before we start our analysis.

However when we're analyzing main() as the top-level function, we can rely
on global initializers to still be valid. At least in C; in C++ we have global
constructors that can still break this logic.

This patch allows the Static Analyzer to load constant initializers from
global variables if the top-level function of the current analysis is main().

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

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

5 years agoTry fixing CRLF issues in Git with [clang-scan-deps] Minimizer: Correctly handle...
Alexandre Ganea [Wed, 28 Aug 2019 15:14:37 +0000 (15:14 +0000)]
Try fixing CRLF issues in Git with [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line endings

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

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

5 years ago[OPENMP][Analysis] Add analysis of the map clauses.
Alexey Bataev [Wed, 28 Aug 2019 14:55:08 +0000 (14:55 +0000)]
[OPENMP][Analysis] Add analysis of the map clauses.

Summary:
Added basic analysis of map clauses. Only map clauses with to and tofrom
map type must be analyzed since all other map types (alloc, delete, etc.) do not require to use the value of the initial variable, instead they create the new copy of the variable.

Reviewers: NoQ

Subscribers: guansong, cfe-commits, kkwli0, caomhin

Tags: #clang

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

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

5 years agoDelete minimize_source_to_dependency_directives_invalid_error.c
Hans Wennborg [Wed, 28 Aug 2019 09:14:00 +0000 (09:14 +0000)]
Delete minimize_source_to_dependency_directives_invalid_error.c

It was added in r370129 with a .gitattributes file that means the file
always shows up as having a local diff in Git checkouts (at least on
Linux). Deleting it until we can figure out the right way to do this.

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

5 years agoFixup build of clang-interpreter example after change in r370122.
Douglas Yung [Wed, 28 Aug 2019 02:13:24 +0000 (02:13 +0000)]
Fixup build of clang-interpreter example after change in r370122.

This should fix the build failure on llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast.

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

5 years ago[Clang][Bundler] Do not require host triple for extracting device bundles
Sergey Dmitriev [Wed, 28 Aug 2019 01:26:13 +0000 (01:26 +0000)]
[Clang][Bundler] Do not require host triple for extracting device bundles

Bundler currently requires host triple to be provided no matter if you are performing bundling or unbundling, but for unbundling operation such requirement is too restrictive. You may for example want to examine device part of the object for a particular offload target, but you have to extract host part as well even though you do not need it. Host triple isn't really needed for unbundling, so this patch removes that requirement.

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

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

5 years agoRevert "Change the X86 datalayout to add three address spaces for 32 bit signed,"
Vlad Tsyrklevich [Wed, 28 Aug 2019 01:08:54 +0000 (01:08 +0000)]
Revert "Change the X86 datalayout to add three address spaces for 32 bit signed,"

This reverts commit r370083 because it caused check-lld failures on
sanitizer-x86_64-linux-fast.

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

5 years agoFix "commas at the end of enumerator lists are a C99-specific"
Vitaly Buka [Wed, 28 Aug 2019 01:04:50 +0000 (01:04 +0000)]
Fix "commas at the end of enumerator lists are a C99-specific"

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

5 years ago[ObjC] Fix type checking for qualified id block parameters.
Volodymyr Sapsai [Wed, 28 Aug 2019 00:25:06 +0000 (00:25 +0000)]
[ObjC] Fix type checking for qualified id block parameters.

When checking if block types are compatible, we are checking for
compatibility their return types and parameters' types. As these types
have different variance, we need to check them in different order.

rdar://problem/52788423

Reviewers: erik.pilkington, arphaman

Reviewed By: arphaman

Subscribers: jkorous, dexonsmith, ributzka, cfe-commits

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

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

5 years agoRe-land [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR...
Alexandre Ganea [Wed, 28 Aug 2019 00:04:06 +0000 (00:04 +0000)]
Re-land [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line endings

Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly.

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

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

5 years ago[preprocessor] Add an opportunity to retain excluded conditional blocks
Evgeny Mankov [Tue, 27 Aug 2019 22:15:32 +0000 (22:15 +0000)]
[preprocessor] Add an opportunity to retain excluded conditional blocks

It is handy for clang tooling, for instance, in source to source transformation.

Reviewers: vpykhtin (Valery Pykhtin), erichkeane (Erich Keane)

Subscribers: rsmith (Richard Smith), akyrtzi (Argyrios Kyrtzidis)

Tags: #clang

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

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

5 years agoArrayRef'ized CompilerInvocation::CreateFromArgs
Dmitri Gribenko [Tue, 27 Aug 2019 22:13:31 +0000 (22:13 +0000)]
ArrayRef'ized CompilerInvocation::CreateFromArgs

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang][Index][NFC] Move IndexDataConsumer default implementation
Jan Korous [Tue, 27 Aug 2019 21:49:39 +0000 (21:49 +0000)]
[clang][Index][NFC] Move IndexDataConsumer default implementation

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

5 years ago[Clang][Bundler] Fix for a hang when unbundling fat binary
Sergey Dmitriev [Tue, 27 Aug 2019 21:47:52 +0000 (21:47 +0000)]
[Clang][Bundler] Fix for a hang when unbundling fat binary

clang-offload-bundler tool may hang under certain conditions when it extracts a subset of all available device bundles from the fat binary that is handled by the BinaryFileHandler. This patch fixes this problem.

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

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

5 years agoDiagnose _Bool as a C99 extension.
Aaron Ballman [Tue, 27 Aug 2019 20:33:05 +0000 (20:33 +0000)]
Diagnose _Bool as a C99 extension.

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

5 years agoDebug Info: Support for DW_AT_export_symbols for anonymous structs
Shafik Yaghmour [Tue, 27 Aug 2019 20:17:35 +0000 (20:17 +0000)]
Debug Info: Support for DW_AT_export_symbols for anonymous structs

This implements the DWARF 5 feature described in:

http://dwarfstd.org/ShowIssue.php?issue=141212.1

To support recognizing anonymous structs:

  struct A {
    struct { // Anonymous struct
        int y;
    };
  } a;

This patch adds support in CGDebugInfo::CreateLimitedType(...) for this new flag and an accompanying test to verify this feature.

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

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

5 years agoAMDGPU: Always emit amdgpu-flat-work-group-size
Matt Arsenault [Tue, 27 Aug 2019 19:25:40 +0000 (19:25 +0000)]
AMDGPU: Always emit amdgpu-flat-work-group-size

The backend default maximum should be the hardware maximum, so the
frontend should set the implementation defined default maximum.

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

5 years agoDiagnose both _Complex and _Imaginary as C99 extensions.
Aaron Ballman [Tue, 27 Aug 2019 19:15:24 +0000 (19:15 +0000)]
Diagnose both _Complex and _Imaginary as C99 extensions.

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

5 years ago[driver][xray] fix the macOS support checker by supporting -macos
Alex Lorenz [Tue, 27 Aug 2019 18:26:36 +0000 (18:26 +0000)]
[driver][xray] fix the macOS support checker by supporting -macos
triple in addition to -darwin

The previous check incorrectly checked for macOS support by
allowing -darwin triples only, and -macos triple was not supported.

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

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

5 years agoMove EH spec mismatches under -fms-compatibility
Reid Kleckner [Tue, 27 Aug 2019 17:52:03 +0000 (17:52 +0000)]
Move EH spec mismatches under -fms-compatibility

-fms-extensions is intended to enable conforming language extensions and
-fms-compatibility is intended to language rule relaxations, so a user
could plausibly compile with -fno-ms-compatibility on Windows while
still using dllexport, for example.  This exception specification
validation behavior has been handled as a warning since before
-fms-compatibility was added in 2011. I think it's just an oversight
that it hasn't been moved yet.

This will help users find conformance issues in their code such as those
found in _com_ptr_t as described in https://llvm.org/PR42842.

Reviewers: hans

Subscribers: STL_MSFT, cfe-commits

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

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

5 years agoChange the X86 datalayout to add three address spaces for 32 bit signed,
Amy Huang [Tue, 27 Aug 2019 17:46:53 +0000 (17:46 +0000)]
Change the X86 datalayout to add three address spaces for 32 bit signed,
32 bit unsigned, and 64 bit pointers.

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

5 years agoUse FileEntryRef for PPCallbacks::HasInclude
Alex Lorenz [Tue, 27 Aug 2019 17:32:42 +0000 (17:32 +0000)]
Use FileEntryRef for PPCallbacks::HasInclude

This fixes the issue where a filename dependendency was missing if the file that
was referenced with __has_include() was accessed through a symlink in an earlier run,
if the file manager was reused between runs.

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

5 years ago[RISCV] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for RV32/RV64 targets...
Sam Elliott [Tue, 27 Aug 2019 15:41:16 +0000 (15:41 +0000)]
[RISCV] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for RV32/RV64 targets with atomics

Summary: This ensures that libcalls aren't generated when the target supports atomics. Atomics aren't in the base RV32I/RV64I instruction sets, so MaxAtomicInlineWidth and MaxAtomicPromoteWidth are set only when the atomics extension is being targeted. This must be done in setMaxAtomicWidth, as this should be done after handleTargetFeatures has been called.

Reviewers: jfb, jyknight, wmi, asb

Reviewed By: asb

Subscribers: pzheng, MaskRay, s.egerton, lenary, dexonsmith, psnobl, benna, Jim, JohnLLVM, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, lewis-revill, cfe-commits

Tags: #clang

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

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

5 years agoUpdate the SARIF exporter to SARIF 2.1
Joe Ranieri [Tue, 27 Aug 2019 14:43:54 +0000 (14:43 +0000)]
Update the SARIF exporter to SARIF 2.1

This updates the SARIF exporter to produce SARIF 2.1 output. The bulk of the diffs come from two changes to SARIF:
* https://github.com/oasis-tcs/sarif-spec/issues/309
* https://github.com/oasis-tcs/sarif-spec/issues/179

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

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

5 years agoReplace some custom C11 extension warnings with the generic warning.
Aaron Ballman [Tue, 27 Aug 2019 14:41:39 +0000 (14:41 +0000)]
Replace some custom C11 extension warnings with the generic warning.

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