]> granicus.if.org Git - clang/log
clang
5 years ago[clang] [Basic] Enable __has_feature(leak_sanitizer)
Michal Gorny [Sun, 22 Sep 2019 20:55:01 +0000 (20:55 +0000)]
[clang] [Basic] Enable __has_feature(leak_sanitizer)

Add a 'leak_sanitizer' feature akin to existing '*_sanitizer' features
to let programmers switch code paths accounting for leak sanitizers
being enabled.

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

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

5 years ago[CLANG][BPF] permit any argument type for __builtin_preserve_access_index()
Yonghong Song [Sun, 22 Sep 2019 17:33:48 +0000 (17:33 +0000)]
[CLANG][BPF] permit any argument type for __builtin_preserve_access_index()

Commit c15aa241f821 ("[CLANG][BPF] change __builtin_preserve_access_index()
signature") changed the builtin function signature to
  PointerT __builtin_preserve_access_index(PointerT ptr)
with a pointer type as the argument/return type, where argument and
return types must be the same.

There is really no reason for this constraint. The builtin just
presented a code region so that IR builtins
  __builtin_{array, struct, union}_preserve_access_index
can be applied.

This patch removed the pointer type restriction to permit any
argument type as long as it is permitted by the compiler.

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

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

5 years agoClang-format: Add Whitesmiths indentation style
Paul Hoad [Sun, 22 Sep 2019 12:00:34 +0000 (12:00 +0000)]
Clang-format: Add Whitesmiths indentation style

Summary:
This patch adds support for the Whitesmiths indentation style to clang-format. It’s an update to a patch submitted in 2015 (D6833), but reworks it to use the newer API.

There are still some issues with this patch, primarily around `switch` and `case` support. The added unit test won’t currently pass because of the remaining issues.

Reviewers: mboehme, MyDeveloperDay, djasper

Reviewed By: MyDeveloperDay

Subscribers: krasimir, MyDeveloperDay, echristo, cfe-commits

Patch By: @timwoj (Tim Wojtulewicz)

Tags: #clang

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

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

5 years agoMove classes into anonymous namespaces. NFC.
Benjamin Kramer [Sun, 22 Sep 2019 09:28:47 +0000 (09:28 +0000)]
Move classes into anonymous namespaces. NFC.

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

5 years agoNFC: Change ObjCQualified*TypesAreCompatible to take
James Y Knight [Sat, 21 Sep 2019 22:31:28 +0000 (22:31 +0000)]
NFC: Change ObjCQualified*TypesAreCompatible to take
ObjCObjectPointerType arguments.

All callers already had one, just creating a QualType to pass, after
which the function cast it right back.

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

5 years agoAttempt to fix a windows buildbot failure
Kristof Umann [Sat, 21 Sep 2019 07:56:40 +0000 (07:56 +0000)]
Attempt to fix a windows buildbot failure

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

5 years ago[Clang Interpreter] Fixed Bug 43362, build failure on GCC
Nandor Licker [Sat, 21 Sep 2019 05:29:18 +0000 (05:29 +0000)]
[Clang Interpreter] Fixed Bug 43362, build failure on GCC

free() was not directly included in InterpStack.cpp, added include now.

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

5 years agoFix bad APInt compare.
Richard Trieu [Sat, 21 Sep 2019 04:18:54 +0000 (04:18 +0000)]
Fix bad APInt compare.

APInt comparison require both to have the same bitwidth.  Since only the value
is needed, use the compare function APInt::isSameValue instead.

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

5 years agoMerge and improve code that detects same value in comparisons.
Richard Trieu [Sat, 21 Sep 2019 03:02:26 +0000 (03:02 +0000)]
Merge and improve code that detects same value in comparisons.

-Wtautological-overlap-compare and self-comparison from -Wtautological-compare
relay on detecting the same operand in different locations.  Previously, each
warning had it's own operand checker.  Now, both are merged together into
one function that each can call.  The function also now looks through member
access and array accesses.

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

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

5 years agoRevert assertion added by r372394
Yaxun Liu [Sat, 21 Sep 2019 02:51:44 +0000 (02:51 +0000)]
Revert assertion added by r372394

The assertion added by r372394 causes CUDA test in test-suite to assert.

The assertion was not there originally, so revert it.

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

5 years agoImprove -Wtautological-overlap-compare
Richard Trieu [Sat, 21 Sep 2019 02:37:10 +0000 (02:37 +0000)]
Improve -Wtautological-overlap-compare

Allow this warning to detect a larger number of constant values, including
negative numbers, and handle non-int types better.

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

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

5 years ago[clang-scan-deps] strip the --serialize-diagnostics argument
Alex Lorenz [Sat, 21 Sep 2019 00:17:26 +0000 (00:17 +0000)]
[clang-scan-deps] strip the --serialize-diagnostics argument

This ensures that clang-scan-deps won't write out diagnostics when
scanning dependencies.

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

5 years agoRemove outdated FIXME.
Richard Smith [Fri, 20 Sep 2019 23:12:51 +0000 (23:12 +0000)]
Remove outdated FIXME.

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

5 years agoFix assertion failure when constant evaluation of a switch jumps over an
Richard Smith [Fri, 20 Sep 2019 23:08:59 +0000 (23:08 +0000)]
Fix assertion failure when constant evaluation of a switch jumps over an
uninitialized variable in an init-statement of a 'for' or 'if'.

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

5 years ago[SystemZ] Support z15 processor name
Ulrich Weigand [Fri, 20 Sep 2019 23:06:03 +0000 (23:06 +0000)]
[SystemZ] Support z15 processor name

The recently announced IBM z15 processor implements the architecture
already supported as "arch13" in LLVM.  This patch adds support for
"z15" as an alternate architecture name for arch13.

Corrsponding LLVM support was committed as rev. 372435.

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

5 years agoEnsure AtomicExpr goes through SEMA checking after TreeTransform
Erich Keane [Fri, 20 Sep 2019 19:17:31 +0000 (19:17 +0000)]
Ensure AtomicExpr goes through SEMA checking after TreeTransform

RebuildAtomicExpr was skipping doing semantic analysis which broke in
the cases where the expressions were not dependent. This resulted in the
ImplicitCastExpr from an array to a pointer being lost, causing a crash
in IR CodeGen.

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

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

5 years agoFix a documentation error
Kristof Umann [Fri, 20 Sep 2019 18:28:04 +0000 (18:28 +0000)]
Fix a documentation error

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

5 years ago[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
Richard Smith [Fri, 20 Sep 2019 18:09:05 +0000 (18:09 +0000)]
[www] Turn 'Clang 9' boxes green in C++ status pages now Clang 9 is
released.

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

5 years agoReland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'
Kristof Umann [Fri, 20 Sep 2019 17:59:20 +0000 (17:59 +0000)]
Reland '[analyzer][MallocChecker][NFC] Document and reorganize some functions'

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

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

5 years ago[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.
Yitzhak Mandelbaum [Fri, 20 Sep 2019 17:11:03 +0000 (17:11 +0000)]
[libTooling] Add `ifBound`, `elseBranch` RangeSelector combinators.

Summary:
Adds two new combinators and corresponding tests to the RangeSelector library.
* `ifBound` -- conditional evaluation of range-selectors, based on whether a
   given node id is bound in the match.
* `elseBranch` -- selects the source range of the else and its statement.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[CUDA][HIP] Fix hostness of defaulted constructor
Yaxun Liu [Fri, 20 Sep 2019 14:28:09 +0000 (14:28 +0000)]
[CUDA][HIP] Fix hostness of defaulted constructor
Clang does not respect the explicit device host attributes of defaulted special members.
Also clang does not respect the hostness of special members determined by their
first declarations.
Clang also adds duplicate implicit device or host attributes in certain cases.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D67509

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

5 years ago[SystemZ] Add SystemZ as supporting target in help text for -mfentry.
Jonas Paulsson [Fri, 20 Sep 2019 13:13:50 +0000 (13:13 +0000)]
[SystemZ]  Add SystemZ as supporting target in help text for -mfentry.

=> "Insert calls to fentry at function entry (x86/SystemZ only)"

Review: Ulrich Weigand

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

5 years ago[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places
Benjamin Kramer [Fri, 20 Sep 2019 12:59:29 +0000 (12:59 +0000)]
[StaticAnalyzer] Use llvm::StringLiteral instead of StringRef in few places

StringRef's constexpr constructor seems to be extremely slow in MSVC
2017, so don't use it for generated tables. Should make PR43369 a bit
better, no functionality change.

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

5 years agoFinish building the full-expression for a static_assert expression
Richard Smith [Fri, 20 Sep 2019 03:29:19 +0000 (03:29 +0000)]
Finish building the full-expression for a static_assert expression
before evaluating it rather than afterwards.

This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.

No significant functionality change intended (though this fixes a bug
only visible through libclang / -ast-dump / tooling: we now store the
converted condition on the StaticAssertDecl rather than the original).

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

5 years ago[NFCI] Always initialize const members of AttributeCommonInfo
Alex Langford [Fri, 20 Sep 2019 00:16:32 +0000 (00:16 +0000)]
[NFCI] Always initialize const members of AttributeCommonInfo

Some compilers require that const fields of an object must be explicitly
initialized by the constructor. I ran into this issue building with
clang 3.8 on Ubuntu 16.04.

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

5 years ago[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.
Nicholas Allegra [Thu, 19 Sep 2019 23:00:31 +0000 (23:00 +0000)]
[Consumed] Treat by-value class arguments as consuming by default, like rvalue refs.

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

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

5 years agoFix for stringized function-macro args continued across lines
Alex Lorenz [Thu, 19 Sep 2019 22:39:24 +0000 (22:39 +0000)]
Fix for stringized function-macro args continued across lines

In case of certain #define'd macros, there's a space just before line continuation
that the minimized-source lexer was missing to include, resulting in invalid stringize.

Patch by: kousikk (Kousik Kumar)

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

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

5 years agoModel converted constant expressions as full-expressions.
Richard Smith [Thu, 19 Sep 2019 22:00:16 +0000 (22:00 +0000)]
Model converted constant expressions as full-expressions.

This is groundwork for C++20's P0784R7, where non-trivial destructors
can be constexpr, so we need ExprWithCleanups markers in constant
expressions.

No functionality change intended.

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

5 years ago[CUDA][HIP] Re-apply part of r372318.
Michael Liao [Thu, 19 Sep 2019 21:26:18 +0000 (21:26 +0000)]
[CUDA][HIP] Re-apply part of r372318.

- r372318 causes violation of `use-of-uninitialized-value` detected by
  MemorySanitizer. Once `Viable` field is set to false, `FailureKind`
  needs setting as well as it will be checked during destruction if
  `Viable` is not true.
- Revert the part trying to skip `std::vector` erasing.

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

5 years agoRevert "[CUDA][HIP] Fix typo in `BestViableFunction`"
Mitch Phillips [Thu, 19 Sep 2019 21:11:28 +0000 (21:11 +0000)]
Revert "[CUDA][HIP] Fix typo in `BestViableFunction`"

Broke the msan buildbots (see comments on rL372318 for more details).

This reverts commit eb231d15825ac345b546f4c99372d1cac8f14f02.

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

5 years agoRevert r372325 - Reverting r372323 because it broke color tests on Linux.
Aaron Ballman [Thu, 19 Sep 2019 15:10:51 +0000 (15:10 +0000)]
Revert r372325 - Reverting r372323 because it broke color tests on Linux.

This corrects the testing issues.

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

5 years agoReverting r372323 because it broke color tests on Linux.
Aaron Ballman [Thu, 19 Sep 2019 13:59:53 +0000 (13:59 +0000)]
Reverting r372323 because it broke color tests on Linux.

http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/17919

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

5 years agoRemove an unsafe member variable that wasn't needed; NFC.
Aaron Ballman [Thu, 19 Sep 2019 13:51:50 +0000 (13:51 +0000)]
Remove an unsafe member variable that wasn't needed; NFC.

People use the AST dumping interface while debugging, so it's not safe to assume that a declaration will be dumped before a constant expression is dumped. This means the Context member may not get set properly and problems would happen. Rather than rely on the interface that requires the ASTContext, call the generic dump() interface instead; this allows us to remove the Context member variable.

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

5 years ago[OpenCL] Add version handling and add vector ld/st builtins
Sven van Haastregt [Thu, 19 Sep 2019 13:41:51 +0000 (13:41 +0000)]
[OpenCL] Add version handling and add vector ld/st builtins

Allow setting a MinVersion, stating from which OpenCL version a
builtin function is available, and a MaxVersion, stating from which
OpenCL version a builtin function should not be available anymore.

Guard some definitions of the "work-item" builtin functions according
to the OpenCL versions from which they are available.

Add the "vector data load and store" builtin functions (e.g.
vload/vstore), whose signatures differ before and after OpenCL 2.0 in
the pointer argument address spaces.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

5 years agoClean out unused diagnostics. NFC.
Benjamin Kramer [Thu, 19 Sep 2019 13:35:27 +0000 (13:35 +0000)]
Clean out unused diagnostics. NFC.

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

5 years ago[CUDA][HIP] Fix typo in `BestViableFunction`
Michael Liao [Thu, 19 Sep 2019 13:14:03 +0000 (13:14 +0000)]
[CUDA][HIP] Fix typo in `BestViableFunction`

Summary:
- Should consider viable ones only when checking SameSide candidates.
- Replace erasing with clearing viable flag to reduce data
  moving/copying.
- Add one and revise another one as the diagnostic message are more
  relevant compared to previous one.

Reviewers: tra

Subscribers: cfe-commits, yaxunl

Tags: #clang

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

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

5 years ago[TestCommit] Trivial change to test commit access.
Mark Murray [Thu, 19 Sep 2019 09:24:42 +0000 (09:24 +0000)]
[TestCommit] Trivial change to test commit access.

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

5 years ago[TestCommit] Trivial change to test commit access.
Mark Murray [Thu, 19 Sep 2019 09:02:12 +0000 (09:02 +0000)]
[TestCommit] Trivial change to test commit access.

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

5 years ago[Builtins] Delete setjmp_syscall and qsetjmp
Fangrui Song [Thu, 19 Sep 2019 04:41:38 +0000 (04:41 +0000)]
[Builtins] Delete setjmp_syscall and qsetjmp

Similar to the resolution of gcc PR71876.
Nobody uses them or needs the [-Wincomplete-setjmp-declaration]
diagnostic.

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

5 years ago[CLANG][BPF] change __builtin_preserve_access_index() signature
Yonghong Song [Thu, 19 Sep 2019 02:59:43 +0000 (02:59 +0000)]
[CLANG][BPF] change __builtin_preserve_access_index() signature

The clang intrinsic __builtin_preserve_access_index() currently
has signature:
  const void * __builtin_preserve_access_index(const void * ptr)

This may cause compiler warning when:
  - parameter type is "volatile void *" or "const volatile void *", or
  - the assign-to type of the intrinsic does not have "const" qualifier.
Further, this signature does not allow dereference of the
builtin result pointer as it is a "const void *" type, which
adds extra step for the user to do type casting.

Let us change the signature to:
  PointerT __builtin_preserve_access_index(PointerT ptr)
such that the result and argument types are the same.
With this, directly dereferencing the builtin return value
becomes possible.

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

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

5 years agoInitialize all fields in ABIArgInfo.
Serge Guelton [Thu, 19 Sep 2019 00:54:40 +0000 (00:54 +0000)]
Initialize all fields in ABIArgInfo.

Due to usage of an uninitialized fields, we end up with
a Conditional jump or move depends on uninitialised value

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

Commited on behalf of Martin Liska <mliska@suse.cz>

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

5 years ago[analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic locati...
Kristof Umann [Wed, 18 Sep 2019 22:24:26 +0000 (22:24 +0000)]
[analyzer] PR43102: Fix an assertion and an out-of-bounds error for diagnostic location construction

Summary:
https://bugs.llvm.org/show_bug.cgi?id=43102

In today's edition of "Is this any better now that it isn't crashing?", I'd like to show you a very interesting test case with loop widening.

Looking at the included test case, it's immediately obvious that this is not only a false positive, but also a very bad bug report in general. We can see how the analyzer mistakenly invalidated `b`, instead of its pointee, resulting in it reporting a null pointer dereference error. Not only that, the point at which this change of value is noted at is at the loop, rather then at the method call.

It turns out that `FindLastStoreVisitor` works correctly, rather the supplied explodedgraph is faulty, because `BlockEdge` really is the `ProgramPoint` where this happens.
{F9855739}
So it's fair to say that this needs improving on multiple fronts. In any case, at least the crash is gone.

Full ExplodedGraph: {F9855743}

Reviewers: NoQ, xazax.hun, baloghadamsoftware, Charusso, dcoughlin, rnkovacs, TWeaver

Subscribers: JesperAntonsson, uabelho, Ka-Ka, bjope, whisperity, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, cfe-commits

Tags: #clang

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

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

5 years agofix build, adjust test also for Windows path separator
Lubos Lunak [Wed, 18 Sep 2019 21:41:45 +0000 (21:41 +0000)]
fix build, adjust test also for Windows path separator

Introduced in 1e9c1d2b7bfc.

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

5 years agoOn PowerPC, Secure-PLT by default for FreeBSD 13 and higher
Dimitry Andric [Wed, 18 Sep 2019 20:58:03 +0000 (20:58 +0000)]
On PowerPC, Secure-PLT by default for FreeBSD 13 and higher

Summary:
In https://svnweb.freebsd.org/changeset/base/349351, FreeBSD 13 and
higher transitioned to Secure-PLT for PowerPC.  This part contains the
changes in clang's PPC architecture defaults.

Reviewers: emaste, jhibbits, hfinkel

Reviewed By: jhibbits

Subscribers: wuzish, nemanjai, krytarowski, kbarton, MaskRay, jsji, shchenz, steven.zhang, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Fix for PR43349: Crash for privatized loop bound.
Alexey Bataev [Wed, 18 Sep 2019 19:24:07 +0000 (19:24 +0000)]
[OPENMP]Fix for PR43349: Crash for privatized loop bound.

If the variable, used in the loop boundaries, is not captured in the
construct, this variable must be considered as undefined if it was
privatized.

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

5 years agoactually also compile output in tests for -frewrite-includes
Lubos Lunak [Wed, 18 Sep 2019 19:12:14 +0000 (19:12 +0000)]
actually also compile output in tests for -frewrite-includes

Checking that the created output matches something is nice, but
this should also check whether the output makes sense.

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

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

5 years ago[clang-format][PR41899] PointerAlignment: Left leads to useless space in lambda intia...
Paul Hoad [Wed, 18 Sep 2019 19:11:40 +0000 (19:11 +0000)]
[clang-format][PR41899] PointerAlignment: Left leads to useless space in lambda intializer expression

Summary:
https://bugs.llvm.org/show_bug.cgi?id=41899

```auto lambda = [&a = a]() { a = 2; };```

is formatted as

```auto lambda = [& a = a]() { a = 2; };```

With an extra space if PointerAlignment is set to Left

> The space "& a" looks strange when there is no type in the lambda's intializer expression. This can be worked around with by setting "PointerAlignment: Right", but ideally "PointerAlignment: Left" would not add a space in this case.

Reviewers: klimek, owenpan, krasimir, timwoj

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years agomake -frewrite-includes also rewrite conditions in #if/#elif
Lubos Lunak [Wed, 18 Sep 2019 19:09:41 +0000 (19:09 +0000)]
make -frewrite-includes also rewrite conditions in #if/#elif

Those conditions may use __has_include, which needs to be rewritten.
The existing code has already tried to rewrite just __has_include,
but it didn't work with macro expansion, so e.g. Qt's
"#define QT_HAS_INCLUDE(x) __has_include(x)" didn't get handled
properly. Since the preprocessor run knows what each condition evaluates
to, just rewrite the entire condition. This of course requires that
the -frewrite-include pass has the same setup as the following
compilation, but that has always been the requirement.

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

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

5 years ago[Sema] Suppress -Wformat diagnostics for bool types when printed using %hhd
Erik Pilkington [Wed, 18 Sep 2019 19:05:14 +0000 (19:05 +0000)]
[Sema] Suppress -Wformat diagnostics for bool types when printed using %hhd

Also, add a diagnostic under -Wformat for printing a boolean value as a
character.

rdar://54579473

Differential revision: https://reviews.llvm.org/D66856

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

5 years ago[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line...
Paul Hoad [Wed, 18 Sep 2019 18:57:09 +0000 (18:57 +0000)]
[clang-format][PR41964] Fix crash with SIGFPE when TabWidth is set to 0 and line starts with tab

Summary:
clang-format 8.0 crashes with SIGFPE (floating point exception) when formatting following file:
app.cpp:
void a() {
//line starts with '\t'
}

$ clang-format -style='{TabWidth: 0}' app.cpp

Reviewers: owenpan, klimek, russellmcc, timwoj

Reviewed By: klimek

Subscribers: cfe-commits

Tags: #clang-tools-extra, #clang

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

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

5 years ago[c++20] P1331R2: Allow transient use of uninitialized objects in
Richard Smith [Wed, 18 Sep 2019 17:37:44 +0000 (17:37 +0000)]
[c++20] P1331R2: Allow transient use of uninitialized objects in
constant evaluation.

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

5 years ago[OPENMP5.0]Allow multiple context selectors in the context selector
Alexey Bataev [Wed, 18 Sep 2019 16:24:31 +0000 (16:24 +0000)]
[OPENMP5.0]Allow multiple context selectors in the context selector
sets.

According to OpenMP 5.0, context selector set might include several
context selectors, separated with commas. Patch fixes this problem.

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

5 years agoRecommit -r372180
Erich Keane [Wed, 18 Sep 2019 15:09:49 +0000 (15:09 +0000)]
Recommit -r372180

Commit message below, original caused the sphinx build bot to fail, this
one should fix it.

Create UsersManual section entitled 'Controlling Floating Point
Behavior'

Create a new section for documenting the floating point options. Move
all the floating point options into this section, and add new entries
for the floating point options that exist but weren't previously
described in the UsersManual.

Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D67517

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

5 years agoRevert r372082 "[Clang] Pragma vectorize_width() implies vectorize(enable)"
Hans Wennborg [Wed, 18 Sep 2019 13:41:51 +0000 (13:41 +0000)]
Revert r372082 "[Clang] Pragma vectorize_width() implies vectorize(enable)"

This broke the Chromium build. Consider the following code:

  float ScaleSumSamples_C(const float* src, float* dst, float scale, int width) {
    float fsum = 0.f;
    int i;
  #if defined(__clang__)
  #pragma clang loop vectorize_width(4)
  #endif
    for (i = 0; i < width; ++i) {
      float v = *src++;
      fsum += v * v;
      *dst++ = v * scale;
    }
    return fsum;
  }

Compiling at -Oz, Clang  now warns:

  $ clang++ -target x86_64 -Oz -c /tmp/a.cc
  /tmp/a.cc:1:7: warning: loop not vectorized: the optimizer was unable to
  perform the requested transformation; the transformation might be disabled or
  specified as part of an unsupported transformation ordering
  [-Wpass-failed=transform-warning]

this suggests it's not actually enabling vectorization hard enough.

At -Os it asserts instead:

  $ build.release/bin/clang++ -target x86_64 -Os -c /tmp/a.cc
  clang-10: /work/llvm.monorepo/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2734: void
  llvm::InnerLoopVectorizer::emitMemRuntimeChecks(llvm::Loop*, llvm::BasicBlock*): Assertion `
  !BB->getParent()->hasOptSize() && "Cannot emit memory checks when optimizing for size"' failed.

Of course neither of these are what the developer expected from the pragma.

> Specifying the vectorization width was supposed to implicitly enable
> vectorization, except that it wasn't really doing this. It was only
> setting the vectorize.width metadata, but not vectorize.enable.
>
> This should fix PR27643.
>
> Differential Revision: https://reviews.llvm.org/D66290

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

5 years ago[mips] Pass "xgot" flag as a subtarget feature
Simon Atanasyan [Wed, 18 Sep 2019 12:24:57 +0000 (12:24 +0000)]
[mips] Pass "xgot" flag as a subtarget feature

We need "xgot" flag in the MipsAsmParser to implement correct expansion
of some pseudo instructions in case of using 32-bit GOT (XGOT).
MipsAsmParser does not have reference to MipsSubtarget but has a
reference to "feature bit set".

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

5 years ago[AST] CommentLexer - Remove (optional) Invalid parameter from getSpelling.
Simon Pilgrim [Wed, 18 Sep 2019 12:11:16 +0000 (12:11 +0000)]
[AST] CommentLexer - Remove (optional) Invalid parameter from getSpelling.

The static analyzer noticed that we were dereferencing it even when the default null value was being used. Further investigation showed that we never explicitly set the parameter so I've just removed it entirely.

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

5 years ago[lldb] Print better diagnostics for user expressions and modules
Raphael Isemann [Wed, 18 Sep 2019 08:53:35 +0000 (08:53 +0000)]
[lldb] Print better diagnostics for user expressions and modules

Summary:
Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions.

For example, in the expression below the user made a type error, but it's not clear from the diagnostic what went wrong:
```
(lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
error: invalid operands to binary expression ('int' and 'double')
```

This patch enables full Clang diagnostics in our expression evaluator. After this patch the diagnostics for the expression look like this:

```
(lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
error: <user expression 1>:1:54: invalid operands to binary expression ('int' and 'float')
printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
                                               ~~~~~~^~~~
```

To make this possible, we now emulate a user expression file within our diagnostics. This prevents that the user is exposed to
our internal wrapper code we inject.

Note that the diagnostics that refer to declarations from the debug information (e.g. 'note' diagnostics pointing to a called function)
will not be improved by this as they don't have any source locations associated with them, so caret or line printing isn't possible.
We instead just suppress these diagnostics as we already do with warnings as they would otherwise just be a context message
without any context (and the original diagnostic in the user expression should be enough to explain the issue).

Fixes rdar://24306342

Reviewers: JDevlieghere, aprantl, shafik, #lldb

Reviewed By: JDevlieghere, #lldb

Subscribers: usaxena95, davide, jingham, aprantl, arphaman, kadircet, lldb-commits

Tags: #lldb

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

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

5 years ago[X86] Prevent assertion when calling a function that returns double with -mno-sse2...
Craig Topper [Wed, 18 Sep 2019 01:57:46 +0000 (01:57 +0000)]
[X86] Prevent assertion when calling a function that returns double with -mno-sse2 on x86-64.

As seen in the most recent updates to PR10498

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

5 years ago[Timers] Fix printing some `-ftime-report` sections twice. Fixes PR40328.
Volodymyr Sapsai [Wed, 18 Sep 2019 00:05:45 +0000 (00:05 +0000)]
[Timers] Fix printing some `-ftime-report` sections twice. Fixes PR40328.

Starting from r324788 timer groups aren't cleared automatically when
printed out. As a result some timer groups were printed one more time.
For example, "Pass execution timing report" was printed again in
`ManagedStatic<PassTimingInfo>` destructor, "DWARF Emission" in
`ManagedStatic<Name2PairMap> NamedGroupedTimers` destructor.

Fix by clearing timer groups manually.

Reviewers: thegameg, george.karpenkov

Reviewed By: thegameg

Subscribers: aprantl, jkorous, dexonsmith, ributzka, aras-p, cfe-commits

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

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

5 years ago[ARM] Update clang for removal of vfp2d16 and vfp2d16sp
Eli Friedman [Tue, 17 Sep 2019 21:43:19 +0000 (21:43 +0000)]
[ARM] Update clang for removal of vfp2d16 and vfp2d16sp

Matching fix for https://reviews.llvm.org/D67375 (r372186).

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

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

5 years agoRevert "Create UsersManual section entitled 'Controlling Floating Point"
Erich Keane [Tue, 17 Sep 2019 21:27:07 +0000 (21:27 +0000)]
Revert "Create UsersManual section entitled 'Controlling Floating Point"

This reverts commit a08d5a4b0ebd44dc64f41049ed4e97a3c6d31498.

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

5 years ago[Sema] Split of versions of -Wimplicit-{float,int}-conversion for Objective-C BOOL
Erik Pilkington [Tue, 17 Sep 2019 21:11:51 +0000 (21:11 +0000)]
[Sema] Split of versions of -Wimplicit-{float,int}-conversion for Objective-C BOOL

Also, add a diagnostic group, -Wobjc-signed-char-bool, to control all these
related diagnostics.

rdar://51954400

Differential revision: https://reviews.llvm.org/D67559

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

5 years agoCreate UsersManual section entitled 'Controlling Floating Point
Erich Keane [Tue, 17 Sep 2019 20:45:23 +0000 (20:45 +0000)]
Create UsersManual section entitled 'Controlling Floating Point
Behavior'

Create a new section for documenting the floating point options. Move
all the floating point options into this section, and add new entries
for the floating point options that exist but weren't previously
  described in the UsersManual.

Patch By: mibintc
Differential Revision: https://reviews.llvm.org/D67517

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

5 years agoIgnore exception specifier mismatch when merging redeclarations
Reid Kleckner [Tue, 17 Sep 2019 20:29:10 +0000 (20:29 +0000)]
Ignore exception specifier mismatch when merging redeclarations

Exception specifiers are now part of the function type in C++17.
Normally, it is illegal to redeclare the same function or specialize a
template with a different exception specifier, but under
-fms-compatibility, we accept it with a warning. Without this change,
the function types would not match due to the exception specifier, and
clang would claim that the types were "incompatible". Now we emit the
warning and merge the redeclaration as we would in C++14 and earlier.

Fixes PR42842, which is about compiling _com_ptr_t in C++17.

Based on a patch by Alex Fusco <alexfusco@google.com>!

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

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

5 years ago[clang-scan-deps] Add verbose mode
Jan Korous [Tue, 17 Sep 2019 19:45:24 +0000 (19:45 +0000)]
[clang-scan-deps] Add verbose mode

When running in the default mode we don't print anything other than actual output to stdout to make automated processing easier.

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

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

5 years agoUse 'BOOL' instead of BOOL in diagnostic messages
Erik Pilkington [Tue, 17 Sep 2019 18:02:45 +0000 (18:02 +0000)]
Use 'BOOL' instead of BOOL in diagnostic messages

Type names should be enclosed in single quotes.

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

5 years ago[OPENMP] Rework the test, NFC.
Alexey Bataev [Tue, 17 Sep 2019 17:44:27 +0000 (17:44 +0000)]
[OPENMP] Rework the test, NFC.

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

5 years ago[OPENMP5.0]Introduce attribute for declare variant directive.
Alexey Bataev [Tue, 17 Sep 2019 17:36:49 +0000 (17:36 +0000)]
[OPENMP5.0]Introduce attribute for declare variant directive.

Added attribute for declare variant directive. It will allow to handle
declare variant directive at the codegen and will allow to add extra
checks.

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

5 years ago[OPENMP]Try to rework the test to pacify the buildbots, NFC.
Alexey Bataev [Tue, 17 Sep 2019 15:11:52 +0000 (15:11 +0000)]
[OPENMP]Try to rework the test to pacify the buildbots, NFC.

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

5 years ago[clang-format] Fix cleanup of `AnnotatedLine` to include children nodes.
Yitzhak Mandelbaum [Tue, 17 Sep 2019 15:10:39 +0000 (15:10 +0000)]
[clang-format] Fix cleanup of `AnnotatedLine` to include children nodes.

Summary:
AnnotatedLine has a tree structure, and things like the body of a lambda will be
a child of the lambda expression. For example,

    [&]() { foo(a); };

will have an AnnotatedLine with a child:

    [&]() {};
     '- foo(a);

Currently, when the `Cleaner` class analyzes the affected lines, it does not
cleanup the lines' children nodes, which results in missed cleanup
opportunities, like the lambda body in the example above.

This revision extends the algorithm to visit children, thereby fixing the above problem.

Patch by Eric Li.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd SpellingNotCalculated to Attribute Enums to suppress UBSan warnings
Erich Keane [Tue, 17 Sep 2019 14:11:51 +0000 (14:11 +0000)]
Add SpellingNotCalculated to Attribute Enums to suppress UBSan warnings

UBSan downstreams noticed that the assignment of SpellingNotCalculated
to the spellings caused warnings.

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

5 years ago[OpenCL] Tidy up some comments; NFC
Sven van Haastregt [Tue, 17 Sep 2019 13:32:56 +0000 (13:32 +0000)]
[OpenCL] Tidy up some comments; NFC

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

5 years agoHide implementation details in namespaces.
Benjamin Kramer [Tue, 17 Sep 2019 12:56:29 +0000 (12:56 +0000)]
Hide implementation details in namespaces.

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

5 years ago[NFC] Updated test
David Bolvansky [Tue, 17 Sep 2019 09:53:14 +0000 (09:53 +0000)]
[NFC] Updated test

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

5 years ago[Clang] Pragma vectorize_width() implies vectorize(enable)
Sjoerd Meijer [Tue, 17 Sep 2019 08:43:11 +0000 (08:43 +0000)]
[Clang] Pragma vectorize_width() implies vectorize(enable)

Specifying the vectorization width was supposed to implicitly enable
vectorization, except that it wasn't really doing this. It was only
setting the vectorize.width metadata, but not vectorize.enable.

This should fix PR27643.

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

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

5 years ago[RISCV] Add option aliases: -mcmodel=medany and -mcmodel=medlow
Kito Cheng [Tue, 17 Sep 2019 08:19:17 +0000 (08:19 +0000)]
[RISCV] Add option aliases: -mcmodel=medany and -mcmodel=medlow

RISC-V GCC use -mcmodel=medany and -mcmodel=medlow, but LLVM use
-mcmodel=small and -mcmodel=medium.

Add those two option aliases for provide same user interface between
GCC and LLVM.

Reviewed By: lenary

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

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

5 years ago[RISCV] Define __riscv_cmodel_medlow and __riscv_cmodel_medany correctly
Kito Cheng [Tue, 17 Sep 2019 08:09:56 +0000 (08:09 +0000)]
[RISCV] Define __riscv_cmodel_medlow and __riscv_cmodel_medany correctly

RISC-V LLVM was only implement small/medlow code model, so it defined
__riscv_cmodel_medlow directly without check.

Now, we have medium/medany code model in RISC-V back-end, it should
define according the actually code model.

Reviewed By: lewis-revill

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

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

5 years agoFix reliance on -flax-vector-conversions in AVX intrinsics headers and
Richard Smith [Tue, 17 Sep 2019 03:56:30 +0000 (03:56 +0000)]
Fix reliance on -flax-vector-conversions in AVX intrinsics headers and
corresponding tests.

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

5 years agoFix reliance on lax vector conversions in tests for x86 intrinsics.
Richard Smith [Tue, 17 Sep 2019 03:56:28 +0000 (03:56 +0000)]
Fix reliance on lax vector conversions in tests for x86 intrinsics.

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

5 years agoRemove reliance on lax vector conversions from altivec.h in VSX mode.
Richard Smith [Tue, 17 Sep 2019 03:56:26 +0000 (03:56 +0000)]
Remove reliance on lax vector conversions from altivec.h in VSX mode.

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

5 years agoPush lambda scope earlier when transforming lambda expression
Nicholas Allegra [Tue, 17 Sep 2019 01:43:33 +0000 (01:43 +0000)]
Push lambda scope earlier when transforming lambda expression

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

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

5 years ago[OPENMP] Fix the test, NFC
Alexey Bataev [Tue, 17 Sep 2019 00:08:50 +0000 (00:08 +0000)]
[OPENMP] Fix the test, NFC

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

5 years ago[OPENMP]Fix the test, NFC.
Alexey Bataev [Mon, 16 Sep 2019 22:17:10 +0000 (22:17 +0000)]
[OPENMP]Fix the test, NFC.

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

5 years ago[Modules][Objective-C] Use complete decl from module when diagnosing missing import
Bruno Cardoso Lopes [Mon, 16 Sep 2019 22:00:29 +0000 (22:00 +0000)]
[Modules][Objective-C] Use complete decl from module when diagnosing missing import

Summary:
Otherwise the definition (first found) for ObjCInterfaceDecl's might
precede the module one, which will eventually lead to crash, since
diagnoseMissingImport needs one coming from a module.

This behavior changed after Richard's r342018, which started to look
into the definition of ObjCInterfaceDecls.

rdar://problem/49237144

Reviewers: rsmith, arphaman

Subscribers: jkorous, dexonsmith, ributzka, cfe-commits

Tags: #clang

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

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

5 years agodo not emit -Wunused-macros warnings in -frewrite-includes mode (PR15614)
Lubos Lunak [Mon, 16 Sep 2019 19:18:37 +0000 (19:18 +0000)]
do not emit -Wunused-macros warnings in -frewrite-includes mode (PR15614)

-frewrite-includes calls PP.SetMacroExpansionOnlyInDirectives() to avoid
macro expansions that are useless in that mode, but this can lead
to -Wunused-macros false positives. As -frewrite-includes does not emit
normal warnings, block -Wunused-macros too.

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

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

5 years ago[Clang][Codegen] Disable arm_acle.c test.
Roman Lebedev [Mon, 16 Sep 2019 17:46:08 +0000 (17:46 +0000)]
[Clang][Codegen] Disable arm_acle.c test.

This test is broken by design. Clang codegen tests should not depend
on llvm middle-end behaviour, they should *only* test clang codegen.
Yet this test runs whole optimization pipeline.
I've really tried to fix it, but there isn't just a few things
that depend on passes, but everything there does.

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

5 years ago[Clang][Codegen] Relax available-externally-suppress.c test
Roman Lebedev [Mon, 16 Sep 2019 17:46:01 +0000 (17:46 +0000)]
[Clang][Codegen] Relax available-externally-suppress.c test

That test is broken by design.
It depends on llvm middle-end behavior.
No clang codegen test should be doing that.
This one is salvageable by relaxing check lines.

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

5 years ago[OPENMP]Fix parsing/sema for function templates with declare simd.
Alexey Bataev [Mon, 16 Sep 2019 17:06:31 +0000 (17:06 +0000)]
[OPENMP]Fix parsing/sema for function templates with declare simd.

Need to return original declaration group with FunctionTemplateDecl, not
the inner FunctionDecl, to correctly handle parsing of directives with
the templates parameters.

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

5 years agoMove some definitions from Sema to Basic to fix shared libs build
Erich Keane [Mon, 16 Sep 2019 13:58:59 +0000 (13:58 +0000)]
Move some definitions from Sema to Basic to fix shared libs build

r371875 moved some functionality around to a Basic header file, but
didn't move its definitions as well.  This patch moves some things
around so that shared library building can work.

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

5 years ago[clangd] Fix a crash when renaming operator.
Haojian Wu [Mon, 16 Sep 2019 10:16:56 +0000 (10:16 +0000)]
[clangd] Fix a crash when renaming operator.

Summary:
The renamelib uses a tricky way to calculate the end location by relying
on decl name, this is incorrect for the overloaded operator (the name is
"operator++" instead of "++"), which will cause out-of-file offset.

We also disable renaming operator symbol, this case is tricky, and
renamelib doesnt handle it properly.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years agoChange signature of __builtin_rotateright64 back to unsigned
Karl-Johan Karlsson [Mon, 16 Sep 2019 09:52:23 +0000 (09:52 +0000)]
Change signature of __builtin_rotateright64 back to unsigned

The signature of __builtin_rotateright64 was by misstake changed from
unsigned to signed in r360863, this patch will change it back to
unsigned as intended.

This fixes pr43309

Reviewers: efriedma, hans

Reviewed By: hans

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

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

5 years ago[OpenMP] Fix OMPClauseReader::readClause() uninitialized variable warning. NFCI.
Simon Pilgrim [Sun, 15 Sep 2019 16:05:20 +0000 (16:05 +0000)]
[OpenMP] Fix OMPClauseReader::readClause() uninitialized variable warning. NFCI.

Fixes static analyzer uninitialized variable warning for the OMPClause - the function appears to cover all cases, but I've added an assertion to make sure.

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

5 years ago[Diagnostics] Added silence note for -Wsizeof-array-div; suggest extra parens
David Bolvansky [Sat, 14 Sep 2019 19:38:55 +0000 (19:38 +0000)]
[Diagnostics] Added silence note for -Wsizeof-array-div; suggest extra parens

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

5 years ago[clang-scan-deps] Add -M to work around -MT issue after r371918
Fangrui Song [Sat, 14 Sep 2019 07:25:27 +0000 (07:25 +0000)]
[clang-scan-deps] Add -M to work around -MT issue after r371918

gcc will complain if -MT is used but neither -M nor -MM is specified:

> cc1: error: to generate dependencies you must specify either -M or -MM

r371918 changed our behavior to match GCC, but apparently
clang-scan-deps is not happy.

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

5 years ago[Driver] Fix multiple bugs related to dependency file options: -M -MM -MD -MMD -MT -MQ
Fangrui Song [Sat, 14 Sep 2019 06:01:22 +0000 (06:01 +0000)]
[Driver] Fix multiple bugs related to dependency file options: -M -MM -MD -MMD -MT -MQ

-M -o test.i => dependency file is test.d, not test.i
-MM -o test.i => dependency file is test.d, not test.i
-M -MMD => bogus warning -Wunused-command-line-argument
-M MT dummy => -w not rendered

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

5 years ago[Driver] Improve Clang::getDependencyFileName and its tests after rC371853
Fangrui Song [Sat, 14 Sep 2019 04:13:15 +0000 (04:13 +0000)]
[Driver] Improve Clang::getDependencyFileName and its tests after rC371853

The test file name metadata-with-dots.c is confusing because -MD and -MMD
have nothing to do with metadata.

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

5 years ago[WebAssembly] Narrowing and widening SIMD ops
Thomas Lively [Fri, 13 Sep 2019 22:54:41 +0000 (22:54 +0000)]
[WebAssembly] Narrowing and widening SIMD ops

Summary:
Implements target-specific LLVM intrinsics and clang builtins for
these new SIMD operations, as described at https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#integer-to-integer-narrowing.

Reviewers: aheejin

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

Tags: #clang, #llvm

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

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

5 years agoMake test check position independent as they sometimes come out reversed. NFCI.
Douglas Yung [Fri, 13 Sep 2019 22:12:27 +0000 (22:12 +0000)]
Make test check position independent as they sometimes come out reversed. NFCI.

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

5 years ago[clang-scan-deps] Fix for headers having the same name as a directory
Alex Lorenz [Fri, 13 Sep 2019 22:12:02 +0000 (22:12 +0000)]
[clang-scan-deps] Fix for headers having the same name as a directory

Scan deps tool crashes when called on a C++ file, containing an include
that has the same name as a directory.
The tool crashes since it finds foo/dir and tries to read that as a file and fails.

Patch by: kousikk (Kousik Kumar)

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

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

5 years agoFix test to use %t for newly created files.
Tim Shen [Fri, 13 Sep 2019 21:06:47 +0000 (21:06 +0000)]
Fix test to use %t for newly created files.

This is both for consistency with other `mkdir`s in tests, and
fixing permission issues with the non-temporary cwd during testing (they
are not always writable).

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