]> granicus.if.org Git - clang/log
clang
6 years agoRevert "Reland "Move #include manipulation code to new lib/Tooling/Inclusions.""
Eric Liu [Wed, 30 May 2018 12:09:58 +0000 (12:09 +0000)]
Revert "Reland "Move #include manipulation code to new lib/Tooling/Inclusions.""

This reverts commit r333532. Revert for now to fix an internal bot issue.

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

6 years agoReland "Move #include manipulation code to new lib/Tooling/Inclusions."
Eric Liu [Wed, 30 May 2018 11:51:48 +0000 (11:51 +0000)]
Reland "Move #include manipulation code to new lib/Tooling/Inclusions."

This reverts commit r332751 (i.e. reland r332720) after fixing module
build.

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

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

6 years ago[analyzer] Remove the redundant check about same state transition in `ArrayBoundCheck...
Henry Wong [Wed, 30 May 2018 11:46:45 +0000 (11:46 +0000)]
[analyzer] Remove the redundant check about same state transition in `ArrayBoundCheckerV2.cpp`.

Summary: Since the `addTransitionImpl()` has a check about same state transition, there is no need to check it in `ArrayBoundCheckerV2.cpp`.

Reviewers: NoQ, xazax.hun, george.karpenkov

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC

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

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

6 years agoFix a (possible) division by zero check in the CmpRuns script
Mikhail R. Gadelha [Wed, 30 May 2018 11:17:55 +0000 (11:17 +0000)]
Fix a (possible) division by zero check in the CmpRuns script

I missed updating the check in r333375

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

6 years ago[ASTImporter] Corrected lookup at import of templated record decl
Gabor Marton [Wed, 30 May 2018 09:19:26 +0000 (09:19 +0000)]
[ASTImporter] Corrected lookup at import of templated record decl

Summary:
When a CXXRecordDecl under ClassTemplateDecl is imported, check
the templated record decl for similarity instead of the template.

Reviewers: a.sidorin

Reviewed By: a.sidorin

Subscribers: martong, cfe-commits

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

Patch by Balazs Keri!

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

6 years agoAdd missing curly from r333509
Hans Wennborg [Wed, 30 May 2018 08:05:24 +0000 (08:05 +0000)]
Add missing curly from r333509

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

6 years agoFix -Wunused in NDEBUG introduced by HIP r333484
Sam McCall [Wed, 30 May 2018 08:03:43 +0000 (08:03 +0000)]
Fix -Wunused in NDEBUG introduced by HIP r333484

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

6 years agoSupport __iso_volatile_load8 etc on aarch64-win32.
Simon Tatham [Wed, 30 May 2018 07:54:05 +0000 (07:54 +0000)]
Support __iso_volatile_load8 etc on aarch64-win32.

These intrinsics are used by MSVC's header files on AArch64 Windows as
well as AArch32, so we should support them for both targets. I've
factored them out of CodeGenFunction::EmitARMBuiltinExpr into separate
functions that EmitAArch64BuiltinExpr can call as well.

Reviewers: javed.absar, mstorsjo

Reviewed By: mstorsjo

Subscribers: kristof.beyls, cfe-commits

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

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

6 years ago[Sparc] Add floating-point register names
Daniel Cederman [Wed, 30 May 2018 06:02:18 +0000 (06:02 +0000)]
[Sparc] Add floating-point register names

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: eraman, fedor.sergeev, jrtc27, cfe-commits

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

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

6 years ago[X86] Remove masking from the AVX512VNNI builtins. Use a select in IR instead.
Craig Topper [Wed, 30 May 2018 05:26:04 +0000 (05:26 +0000)]
[X86] Remove masking from the AVX512VNNI builtins. Use a select in IR instead.

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

6 years agoProtect a clang-cl file path with --.
Peter Collingbourne [Wed, 30 May 2018 04:08:34 +0000 (04:08 +0000)]
Protect a clang-cl file path with --.

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

6 years agoUpdate NRVO logic to support early return
Taiju Tsuiki [Wed, 30 May 2018 03:53:16 +0000 (03:53 +0000)]
Update NRVO logic to support early return

Summary:
The previous implementation misses an opportunity to apply NRVO (Named Return Value
Optimization) below. That discourages user to write early return code.

```
struct Foo {};

Foo f(bool b) {
  if (b)
    return Foo();
  Foo oo;
  return oo;
}
```
That is, we can/should apply RVO for a local variable if:
 * It's directly returned by at least one return statement.
 * And, all reachable return statements in its scope returns the variable directly.
While, the previous implementation disables the RVO in a scope if there are multiple return
statements that refers different variables.

On the new algorithm, local variables are in NRVO_Candidate state at first, and a return
statement changes it to NRVO_Disabled for all visible variables but the return statement refers.
Then, at the end of the function AST traversal, NRVO is enabled for variables in NRVO_Candidate
state and refers from at least one return statement.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, Quuxplusone, arthur.j.odwyer, cfe-commits

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

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

6 years agoSema: Add a flag for rejecting member pointers with incomplete base types.
Peter Collingbourne [Wed, 30 May 2018 03:40:04 +0000 (03:40 +0000)]
Sema: Add a flag for rejecting member pointers with incomplete base types.

Codebases that need to be compatible with the Microsoft ABI can pass
this flag to avoid issues caused by the lack of a fixed ABI for
incomplete member pointers.

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

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

6 years ago[X86] Fix the names of a bunch of icelake intrinsics.
Craig Topper [Wed, 30 May 2018 03:38:15 +0000 (03:38 +0000)]
[X86] Fix the names of a bunch of icelake intrinsics.

Mostly this fixes the names of all the 128-bit intrinsics to start with _mm_ instead of _mm128_ as is the convention and what the Intel docs say.

This also fixes the name of the bitshuffle intrinsics to say epi64 for 128 and 256 bit versions.

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

6 years agoFix test failure after r333485. Try 2.
Eric Fiselier [Wed, 30 May 2018 02:20:40 +0000 (02:20 +0000)]
Fix test failure after r333485. Try 2.

Sorry for the breakage.

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

6 years agoMake the mangled name collision diagnostic a bit more useful by listing the mangling.
Richard Smith [Wed, 30 May 2018 01:52:16 +0000 (01:52 +0000)]
Make the mangled name collision diagnostic a bit more useful by listing the mangling.

This helps especially when the collision is for a template specialization,
where the template arguments are not available from anywhere else in the
diagnostic, and are likely relevant to the problem.

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

6 years agoFix test failure after r333485.
Eric Fiselier [Wed, 30 May 2018 01:22:14 +0000 (01:22 +0000)]
Fix test failure after r333485.

I missed adjusting a test under Misc in the last commit.
This patch updates that test.

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

6 years ago[ODRHash] Support FunctionTemplateDecl in records.
Richard Trieu [Wed, 30 May 2018 01:12:26 +0000 (01:12 +0000)]
[ODRHash] Support FunctionTemplateDecl in records.

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

6 years ago[Sema] Use %sub to cleanup overload diagnostics
Eric Fiselier [Wed, 30 May 2018 01:00:41 +0000 (01:00 +0000)]
[Sema] Use %sub to cleanup overload diagnostics

Summary:
This patch adds the newly added `%sub` diagnostic modifier to cleanup repetition in the overload candidate diagnostics.

I think this should be good to go.

@rsmith: Some of the notes now emit `function template` where they only said `function` previously. It seems OK to me, but I would like your sign off on it.

Reviewers: rsmith, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits, rsmith

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

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

6 years agoAdd HIP toolchain
Yaxun Liu [Wed, 30 May 2018 00:53:50 +0000 (00:53 +0000)]
Add HIP toolchain

This patch adds HIP toolchain to support HIP language mode. It includes:

Create specific compiler jobs for HIP.

Choose specific libraries for HIP.

With contribution from Greg Rodgers.

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

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

6 years agoAdd action builder for HIP
Yaxun Liu [Wed, 30 May 2018 00:49:10 +0000 (00:49 +0000)]
Add action builder for HIP

To support separate compile/link and linking across device IR in different source files,
a new HIP action builder is introduced. Basically it compiles/links host and device
code separately, and embed fat binary in host linking stage through linker script.

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

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

6 years agoRevert r332839.
Richard Smith [Wed, 30 May 2018 00:45:10 +0000 (00:45 +0000)]
Revert r332839.

This is causing miscompiles and "definition with same mangled name as another
definition" errors.

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

6 years agoCheck pointer null-ness before dereferencing it.
Richard Trieu [Tue, 29 May 2018 22:43:00 +0000 (22:43 +0000)]
Check pointer null-ness before dereferencing it.

-Warc-repeated-use-of-weak may trigger a segmentation fault when the Decl
being checked is outside of a function scope, leaving the current function
info pointer null.  This adds a check before using the function info.

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

6 years ago[Driver] Rename DefaultTargetTriple to TargetTriple
Petr Hosek [Tue, 29 May 2018 22:35:39 +0000 (22:35 +0000)]
[Driver] Rename DefaultTargetTriple to TargetTriple

While this value is initialized with the DefaultTargetTriple, it
can be later overriden using the -target flag so TargetTriple is
a more accurate name. This change also provides an accessor which
could be accessed from ToolChain implementations.

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

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

6 years ago[CodeGen][Darwin] Set the calling-convention of thread-local variable
Akira Hatanaka [Tue, 29 May 2018 18:28:49 +0000 (18:28 +0000)]
[CodeGen][Darwin] Set the calling-convention of thread-local variable
initialization functions to 'cxx_fast_tlscc'.

This fixes a bug where instructions calling initialization functions for
thread-local static members of c++ template classes were using calling
convention 'cxx_fast_tlscc' while the called functions weren't annotated
with the calling convention.

rdar://problem/40447463

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

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

6 years ago[X86] Tag some 128/256 load/store instructions as requiring avx512vl instead of avx512f.
Craig Topper [Tue, 29 May 2018 18:23:22 +0000 (18:23 +0000)]
[X86] Tag some 128/256 load/store instructions as requiring avx512vl instead of avx512f.

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

6 years agoadd test for r332053
Nico Weber [Tue, 29 May 2018 14:48:30 +0000 (14:48 +0000)]
add test for r332053

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

6 years ago[analyzer] const init: handle non-explicit cases more accurately
Rafael Stahl [Tue, 29 May 2018 14:14:22 +0000 (14:14 +0000)]
[analyzer] const init: handle non-explicit cases more accurately

Summary: If the access is out of bounds, return UndefinedVal. If it is missing an explicit init, return the implicit zero value it must have.

Reviewers: NoQ, xazax.hun, george.karpenkov

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits

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

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

6 years agoFix emission of phony dependency targets when adding extra deps
David Stenberg [Tue, 29 May 2018 13:07:58 +0000 (13:07 +0000)]
Fix emission of phony dependency targets when adding extra deps

Summary:
This commit fixes a bug where passing extra dependency entries
(using -fdepfile-entry) would result in -MP incorrectly emitting
a phony target for the input file, and no phony target for the
first extra dependency.

The extra dependencies are added first to the filename vector in
DFGImpl. That clashed with the emission of the phony targets, as
the code assumed that the first index always correspond to the
input file.

Reviewers: rsmith, pcc, krasin, bruno, vsapsai

Reviewed By: vsapsai

Subscribers: vsapsai, bruno, cfe-commits

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

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

6 years agoTesting commit access with whitespace change.
Rafael Stahl [Tue, 29 May 2018 08:12:15 +0000 (08:12 +0000)]
Testing commit access with whitespace change.

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

6 years ago[X86] Merge the 3 different flavors of masked vpermi2var/vpermt2var builtins to a...
Craig Topper [Tue, 29 May 2018 03:26:38 +0000 (03:26 +0000)]
[X86] Merge the 3 different flavors of masked vpermi2var/vpermt2var builtins to a single version without masking. Use select builtins with appropriate operand instead.

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

6 years ago[RISCV] Add -mrelax/-mno-relax flags to enable/disable RISCV linker relaxation
Shiva Chen [Tue, 29 May 2018 00:44:15 +0000 (00:44 +0000)]
[RISCV] Add -mrelax/-mno-relax flags to enable/disable RISCV linker relaxation

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

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

6 years ago[coroutines] Pass implicit object parameter to promise ctor (fix BUG37604)
Gor Nishanov [Mon, 28 May 2018 18:08:47 +0000 (18:08 +0000)]
[coroutines] Pass implicit object parameter to promise ctor (fix BUG37604)

Summary:
Complete the implementation of p0914r1.
Implicit object parameter should be passed to a promise constructor.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=37604
Reviewers: modocache, rsmith, lewissbaker

Reviewed By: modocache

Subscribers: cfe-commits, EricWF

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

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

6 years agoIntroduces --stats-only option to only show changes in statistics.
Mikhail R. Gadelha [Mon, 28 May 2018 15:40:39 +0000 (15:40 +0000)]
Introduces --stats-only option to only show changes in statistics.

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

6 years ago[DebugInfo] Fix typo. NFC
Fangrui Song [Sun, 27 May 2018 07:23:04 +0000 (07:23 +0000)]
[DebugInfo] Fix typo. NFC

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

6 years agoRevert r333347 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Sat, 26 May 2018 18:57:41 +0000 (18:57 +0000)]
Revert r333347 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible."

This wasn't supposed to be commited yet.

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

6 years ago[X86] Remove mask from avx512ifma builtins. Use a select instruction instead.
Craig Topper [Sat, 26 May 2018 18:55:26 +0000 (18:55 +0000)]
[X86] Remove mask from avx512ifma builtins. Use a select instruction instead.

This reduces from 12 builtins to 6 since we no longer need a mask and maskz version.

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

6 years ago[X86] Rewrite the max and min reduction intrinsics to make better use of other functi...
Craig Topper [Sat, 26 May 2018 18:55:24 +0000 (18:55 +0000)]
[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.

Summary:
We only need to use 512 bit vectors all the way through v8i64 reductions since those max instructions are new to avx512f and only available in 512 bits until SKX.

For v16i32 and floating point we have legacy 128/256 bit instructions we can use.

I've tried to use other intrinsics to reduce the verbosity of the code and avoid having to mention all the shuffles. I've also removed all the -1 shuffle indices so the output sequence is fully specified and not left to backend optimization.

Reviewers: RKSimon, spatel, GBuella

Subscribers: cfe-commits

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

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

6 years ago[ClangDiagnostics] Silence warning about fallthrough after PrintFatalError
David Bolvansky [Sat, 26 May 2018 09:24:00 +0000 (09:24 +0000)]
[ClangDiagnostics] Silence warning about fallthrough after PrintFatalError

Summary:
ClangDiagnosticsEmitter.cpp:1047:57: warning: this statement may fall through [-Wimplicit-fallthrough=]
       Builder.PrintFatalError("Unknown modifier type: " + Modifier);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
ClangDiagnosticsEmitter.cpp:1048:5: note: here
     case MT_Select: {
                   ^

Reviewers: rsmith, rtrieu

Reviewed By: rtrieu

Subscribers: rtrieu, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

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

6 years agoTest commit; please ignore.
George Burgess IV [Sat, 26 May 2018 02:29:14 +0000 (02:29 +0000)]
Test commit; please ignore.

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

6 years ago[analyzer] Add security checks for bcmp(), bcopy(), bzero().
Artem Dergachev [Sat, 26 May 2018 00:04:26 +0000 (00:04 +0000)]
[analyzer] Add security checks for bcmp(), bcopy(), bzero().

These functions are obsolete. The analyzer would advice to replace them with
memcmp(), memcpy() or memmove(), or memset().

Patch by Tom Rix!

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

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

6 years agoFix typo + reflow comment; NFC
George Burgess IV [Fri, 25 May 2018 23:40:59 +0000 (23:40 +0000)]
Fix typo + reflow comment; NFC

Reflow brings said comment below 80 cols

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

6 years ago[X86] Add const to another builtin that was missed from r331814.
Craig Topper [Fri, 25 May 2018 22:52:29 +0000 (22:52 +0000)]
[X86] Add const to another builtin that was missed from r331814.

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

6 years ago[X86] Correct the target features on two avx512bw builtins that were incorrectly...
Craig Topper [Fri, 25 May 2018 22:43:20 +0000 (22:43 +0000)]
[X86] Correct the target features on two avx512bw builtins that were incorrectly labeled as avx512f.

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

6 years agoRevert "[DebugInfo] Don't bother with MD5 checksums of preprocessed files."
Paul Robinson [Fri, 25 May 2018 22:35:59 +0000 (22:35 +0000)]
Revert "[DebugInfo] Don't bother with MD5 checksums of preprocessed files."

This reverts commit d734f2aa3f76fbf355ecd2bbe081d0c1f49867ab.
Also known as r333311.  A very small but nonzero number of bots fail.

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

6 years ago[X86] Mark a few more builtins const that were missed in r331814.
Craig Topper [Fri, 25 May 2018 22:07:43 +0000 (22:07 +0000)]
[X86] Mark a few more builtins const that were missed in r331814.

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

6 years agoSupport Swift calling convention for PPC64 targets
Bob Wilson [Fri, 25 May 2018 21:26:03 +0000 (21:26 +0000)]
Support Swift calling convention for PPC64 targets

This adds basic support for the Swift calling convention with PPC64 targets.
Patch provided by Atul Sowani in bug report #37223

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

6 years ago[DebugInfo] Don't bother with MD5 checksums of preprocessed files.
Paul Robinson [Fri, 25 May 2018 20:59:29 +0000 (20:59 +0000)]
[DebugInfo] Don't bother with MD5 checksums of preprocessed files.

The checksum will not reflect the real source, so there's no clear
reason to include them in the debug info.  Also this was causing a
crash on the DWARF side.

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

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

6 years ago[Support] Avoid normalization in sys::getDefaultTargetTriple
Petr Hosek [Fri, 25 May 2018 20:39:37 +0000 (20:39 +0000)]
[Support] Avoid normalization in sys::getDefaultTargetTriple

The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

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

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

6 years agoConvert clang-interpreter to ORC JIT API
Stephane Sezer [Fri, 25 May 2018 20:23:42 +0000 (20:23 +0000)]
Convert clang-interpreter to ORC JIT API

Summary: This mostly re-uses code from the KaleidoscopeJIT example.

Reviewers: ddunbar, lhames

Reviewed By: lhames

Subscribers: mgrang, alexshap, mgorny, xiaobai, cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Fixed codegen for orphaned parallel region.
Alexey Bataev [Fri, 25 May 2018 20:16:03 +0000 (20:16 +0000)]
[OPENMP, NVPTX] Fixed codegen for orphaned parallel region.

If orphaned parallel region is found, the next code must be emitted:
```
if(__kmpc_is_spmd_exec_mode() || __kmpc_parallel_level(loc, gtid))
  Serialized execution.
else if (IsMasterThread())
  Prepare and signal worker.
else
  Outined function call.
```

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

6 years agoFollow-up fix for nonnull atomic non-member functions
JF Bastien [Fri, 25 May 2018 17:36:49 +0000 (17:36 +0000)]
Follow-up fix for nonnull atomic non-member functions

Handling of the third parameter was only checking for *_n and not for the C11 variant, which means that cmpxchg of a 'desired' 0 value was erroneously warning. Handle C11 properly, and add extgensive tests for this as well as NULL pointers in a bunch of places.

Fixes r333246 from D47229.

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

6 years ago[Sema] Add tests for weak functions
Jonas Hahnfeld [Fri, 25 May 2018 15:56:12 +0000 (15:56 +0000)]
[Sema] Add tests for weak functions

I found these checks to be missing, just add some simple cases.

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

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

6 years ago[analyzer] Added a getLValue method to ProgramState for bases
Kristof Umann [Fri, 25 May 2018 14:48:33 +0000 (14:48 +0000)]
[analyzer] Added a getLValue method to ProgramState for bases

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

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

6 years agoFix members initialization order in constructor (fails with -Werror)
Ivan Donchevskii [Fri, 25 May 2018 13:46:07 +0000 (13:46 +0000)]
Fix members initialization order in constructor (fails with -Werror)

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

6 years ago[analyzer] Added template argument lists to the Pathdiagnostic output
Kristof Umann [Fri, 25 May 2018 13:18:38 +0000 (13:18 +0000)]
[analyzer] Added template argument lists to the Pathdiagnostic output

Because template parameter lists were not displayed
in the plist output, it was difficult to decide in
some cases whether a given checker found a true or a
false positive. This patch aims to correct this.

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

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

6 years agoOptionally add code completion results for arrow instead of dot
Ivan Donchevskii [Fri, 25 May 2018 12:56:26 +0000 (12:56 +0000)]
Optionally add code completion results for arrow instead of dot

Currently getting such completions requires source correction, reparsing
and calling completion again. And if it shows no results and rollback is
required then it costs one more reparse.

With this change it's possible to get all results which can be later
filtered to split changes which require correction.

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

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

6 years ago[ASTImporter] Fix ClassTemplateSpecialization in wrong DC
Gabor Marton [Fri, 25 May 2018 11:21:24 +0000 (11:21 +0000)]
[ASTImporter] Fix ClassTemplateSpecialization in wrong DC

Summary:
ClassTemplateSpecialization is put in the wrong DeclContex if implicitly
instantiated. This patch fixes it.

Reviewers: a.sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[x86] invpcid intrinsic
Gabor Buella [Fri, 25 May 2018 06:34:42 +0000 (06:34 +0000)]
[x86] invpcid intrinsic

An intrinsic for an old instruction, as described in the Intel SDM.

Reviewers: craig.topper, rnk

Reviewed By: craig.topper, rnk

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

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

6 years agoMake atomic non-member functions as nonnull
JF Bastien [Fri, 25 May 2018 00:07:09 +0000 (00:07 +0000)]
Make atomic non-member functions as nonnull

Summary:
As a companion to libc++ patch https://reviews.llvm.org/D47225, mark builtin atomic non-member functions which accept pointers as nonnull.

The atomic non-member functions accept pointers to std::atomic / std::atomic_flag as well as to the non-atomic value. These are all dereferenced unconditionally when lowered, and therefore will fault if null. It's a tiny gotcha for new users, especially when they pass in NULL as expected value (instead of passing a pointer to a NULL value).

<rdar://problem/18473124>

Reviewers: arphaman

Subscribers: aheejin, cfe-commits

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

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

6 years agoImprove diagonstic for braced-init-list as operand to ?: expression.
Richard Smith [Thu, 24 May 2018 22:02:52 +0000 (22:02 +0000)]
Improve diagonstic for braced-init-list as operand to ?: expression.

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

6 years agoSwitch a couple of users of LangOpts::GNUMode to the more appropriate LangOpts::GNUKe...
Richard Smith [Thu, 24 May 2018 21:51:52 +0000 (21:51 +0000)]
Switch a couple of users of LangOpts::GNUMode to the more appropriate LangOpts::GNUKeywords.

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

6 years agoImprove diagnostics for config mismatches with -fmodule-file.
Richard Smith [Thu, 24 May 2018 20:03:51 +0000 (20:03 +0000)]
Improve diagnostics for config mismatches with -fmodule-file.

Unless the user uses -Wno-module-file-config-mismatch (or -Wno-error=...),
allow the AST reader to produce errors describing the nature of the config
mismatch.

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

6 years ago[X86] Fix a bad cast in _mm512_mask_abs_epi32 and _mm512_maskz_abs_epi32.
Craig Topper [Thu, 24 May 2018 17:32:49 +0000 (17:32 +0000)]
[X86] Fix a bad cast in _mm512_mask_abs_epi32 and _mm512_maskz_abs_epi32.

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

6 years ago[bash-completion] Fix tab separation on macOS
Ben Langmuir [Thu, 24 May 2018 16:25:40 +0000 (16:25 +0000)]
[bash-completion] Fix tab separation on macOS

We have a regex that needs to match a tab character in the command
output, but on macOS sed doesn't support '\t', causing it to split on
the 't' character instead. Fix by having bash expand the \t first.

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

6 years agoDisable an in-memory vfs file path test on windows.
Eric Liu [Thu, 24 May 2018 13:52:48 +0000 (13:52 +0000)]
Disable an in-memory vfs file path test on windows.

The test uses unix paths and doesn't make sense to run on windows.

Fix bot failure caused by r333172:
 http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10799

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

6 years ago[analyzer] Move RangeSet related declarations into the RangedConstraintManager header.
Mikhail R. Gadelha [Thu, 24 May 2018 12:16:35 +0000 (12:16 +0000)]
[analyzer] Move RangeSet related declarations into the RangedConstraintManager header.

Summary: I could also move `RangedConstraintManager.h` under `include/` if you agree as it seems slightly out of place under `lib/`.

Patch by Réka Kovács

Reviewers: NoQ, george.karpenkov, dcoughlin, rnkovacs

Reviewed By: NoQ

Subscribers: mikhail.ramalho, whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, dkrupp, cfe-commits

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

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

6 years ago[VFS] Implement getRealPath in InMemoryFileSystem.
Eric Liu [Thu, 24 May 2018 11:17:00 +0000 (11:17 +0000)]
[VFS] Implement getRealPath in InMemoryFileSystem.

Reviewers: bkramer

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Fix putting ObjC message arguments in one line for multiline receiver
Jacek Olesiak [Thu, 24 May 2018 10:50:36 +0000 (10:50 +0000)]
[clang-format] Fix putting ObjC message arguments in one line for multiline receiver

Summary:
Reapply reverted changes from D46879.

Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.:
```
[[object block:^{
  return 42;
}] aa:42 bb:42];
```
will be formatted:
```
[[object block:^{
  return 42;
}] aa:42
   bb:42];
```
even though arguments could fit into one line. This change fixes this behavior.

Test Plan:
make -j12 FormatTests && tools/clang/unittests/Format/FormatTests

Reviewers: benhamilton, krasimir

Reviewed By: benhamilton, krasimir

Subscribers: djasper, klimek, cfe-commits

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

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

6 years agoFix ASTImporterTest on Windows after r333082
Hans Wennborg [Thu, 24 May 2018 10:49:38 +0000 (10:49 +0000)]
Fix ASTImporterTest on Windows after r333082

With MS compatibility, Sema adds an implicit definition of type_info,
which was causing the matchers to return 3 instead of 2.

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

6 years ago[ASTImporter] Add unit tests for structural equivalence
Gabor Marton [Thu, 24 May 2018 08:41:07 +0000 (08:41 +0000)]
[ASTImporter] Add unit tests for structural equivalence

Summary:
This patch add new tests for structural equivalence. For that a new
common header is created which holds the test related language specific
types and functions.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[X86] NFC Include immintrin.h in CodeGen tests
Gabor Buella [Thu, 24 May 2018 07:09:08 +0000 (07:09 +0000)]
[X86] NFC Include immintrin.h in CodeGen tests

Following r333110:
"Move all Intel defined intrinsic includes into immintrin.h"

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

6 years ago [Sparc] Use the leon arch for Leon3's when using an external assembler
Daniel Cederman [Thu, 24 May 2018 06:16:02 +0000 (06:16 +0000)]
 [Sparc] Use the leon arch for Leon3's when using an external assembler

Summary: This allows the use of the casa instruction available in most Leon3's.

Reviewers: jyknight

Reviewed By: jyknight

Subscribers: joerg, fedor.sergeev, jrtc27, cfe-commits

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

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

6 years agoAdd Builtins.def support for fread and fwrite to ensure that -fno-builtin-
Eric Christopher [Thu, 24 May 2018 06:09:28 +0000 (06:09 +0000)]
Add Builtins.def support for fread and fwrite to ensure that -fno-builtin-
works with them and test accordingly.

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

6 years agoMigrate libcalls-fno-builtin.c test from checking optimized assembly
Eric Christopher [Thu, 24 May 2018 06:00:50 +0000 (06:00 +0000)]
Migrate libcalls-fno-builtin.c test from checking optimized assembly
to checking for attributes on the call site - and fix up builtin
functions that we were testing for but not ensuring wouldn't be
optimized by the backend.

Leave one set of asm tests to make sure that we're also communicating
builtin-ness to TLI.

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

6 years ago[Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr
Steven Wu [Thu, 24 May 2018 01:01:43 +0000 (01:01 +0000)]
[Sema][ObjC] Do not DiagnoseUseOfDecl in LookupMemberExpr

Summary:
Remove the call to DiagnoseUseOfDecl in LookupMemberExpr because:
1. LookupMemberExpr eagerly lookup both getter and setter, reguardless
if they are used or not. It causes wrong diagnostics if you are only
using getter.
2. LookupMemberExpr only diagnoses getter, but not setter.
3. ObjCPropertyOpBuilder already DiagnoseUseOfDecl when building getter
and setter. Doing it again in LookupMemberExpr causes duplicated
diagnostics.

rdar://problem/38479756

Reviewers: erik.pilkington, arphaman, doug.gregor

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

6 years agoUse zeroinitializer for (trailing zero portion of) large array initializers
Richard Smith [Wed, 23 May 2018 23:41:38 +0000 (23:41 +0000)]
Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

This re-commits r333044 with a fix for PR37560.

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

6 years agoRework __builtin_classify_type support to better match GCC and to not assert on
Richard Smith [Wed, 23 May 2018 21:18:00 +0000 (21:18 +0000)]
Rework __builtin_classify_type support to better match GCC and to not assert on
unusual types.

Following the observed behavior of GCC, we now return -1 for vector types
(along with all of our extensions that GCC doesn't support), and for atomic
types we classify the underlying type.

GCC appears to have changed its classification for function and array arguments
between version 5 and version 6. Previously it would classify them as pointers
in C and as functions or arrays in C++, but from version 6 onwards, it
classifies them as pointers. We now follow the more recent GCC behavior rather
than emulating what I can only assume to be a historical bug in their C++
support for this builtin.

Finally, no version of GCC that I can find has ever used the "method"
classification for C++ pointers to member functions. Instead, GCC classifies
them as record types, presumably reflecting an internal implementation detail,
but whatever the reason we now produce compatible results.

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

6 years ago[X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h.
Craig Topper [Wed, 23 May 2018 21:04:26 +0000 (21:04 +0000)]
[X86] Move the include of clzerointrin.h from immintrin.h back to x86intrin.h.

This is an AMD intrinsic not an Intel intrinsic so it shouldn't be in immintrin.h

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

6 years ago[modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual
Raphael Isemann [Wed, 23 May 2018 20:59:46 +0000 (20:59 +0000)]
[modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual

Summary:
Since clang r332929 these two headers throw errors when included from somewhere else than their wrapper header. It seems marking them as textual is the best way to fix the builds.

Fixes this new module build error:
    While building module '_Builtin_intrinsics' imported from ...:
    In file included from <module-includes>:2:
    In file included from lib/clang/7.0.0/include/immintrin.h:54:
    In file included from lib/clang/7.0.0/include/wmmintrin.h:29:
    lib/clang/7.0.0/include/__wmmintrin_aes.h:25:2: error: "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."
    #error "Never use <__wmmintrin_aes.h> directly; include <wmmintrin.h> instead."

Reviewers: rsmith, v.g.vassilev, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

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

6 years ago[X86] Move all Intel defined intrinsic includes into immintrin.h
Craig Topper [Wed, 23 May 2018 18:32:58 +0000 (18:32 +0000)]
[X86] Move all Intel defined intrinsic includes into immintrin.h

This matches the Intel documentation which shows them available by importing immintrin.h. x86intrin.h also includes immintrin.h so anyone including x86intrin.h will still get them.

This is different than gcc, but I don't think we were a perfect match there already. I'm unclear what gcc's policy is about how they choose which to add things to.

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

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

6 years ago[CUDA] Fixed the list of GPUs supported by CUDA-9.
Artem Belevich [Wed, 23 May 2018 16:45:23 +0000 (16:45 +0000)]
[CUDA] Fixed the list of GPUs supported by CUDA-9.

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

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

6 years agoTest Commit. Fix namespace comment
Mikhail R. Gadelha [Wed, 23 May 2018 15:49:12 +0000 (15:49 +0000)]
Test Commit. Fix namespace comment

Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333094 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang-format] fix buildbots after r333085
Krasimir Georgiev [Wed, 23 May 2018 15:21:33 +0000 (15:21 +0000)]
[clang-format] fix buildbots after r333085

Old gcc versions don't like raw string literals in macros.

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

6 years ago[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl
Gabor Marton [Wed, 23 May 2018 14:24:02 +0000 (14:24 +0000)]
[ASTImporter] Fix missing implict CXXRecordDecl in ClassTemplateSpecializationDecl

Summary:
Currently we do not import the implicit CXXRecordDecl of a
ClassTemplateSpecializationDecl. This patch fixes it.

Reviewers: a.sidorin, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Break template declarations followed by comments
Krasimir Georgiev [Wed, 23 May 2018 14:18:19 +0000 (14:18 +0000)]
[clang-format] Break template declarations followed by comments

Summary:
This patch fixes two bugs in clang-format where the template wrapper doesn't skip over
comments causing a long template declaration to not be split into multiple lines.
These were latent and exposed by r332436.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

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

6 years agoFix duplicate class template definitions problem
Gabor Marton [Wed, 23 May 2018 13:53:36 +0000 (13:53 +0000)]
Fix duplicate class template definitions problem

Summary:
We fail to import a `ClassTemplateDecl` if the "To" context already
contains a definition and then a forward decl.  This is because
`localUncachedLookup` does not find the definition.  This is not a
lookup error, the parser behaves differently than assumed in the
importer code.  A `DeclContext` contains one DenseMap (`LookupPtr`)
which maps names to lists.  The list is a special list `StoredDeclsList`
which is optimized to have one element.  During building the initial
AST, the parser first adds the definition to the `DeclContext`.  Then
during parsing the second declaration (the forward decl) the parser
again calls `DeclContext::addDecl` but that will not add a new element
to the `StoredDeclsList` rarther it simply overwrites the old element
with the most recent one.  This patch fixes the error by finding the
definition in the redecl chain.  Added tests for the same issue with
`CXXRecordDecl` and with `ClassTemplateSpecializationDecl`.  These tests
pass and they pass because in `VisitRecordDecl` and in
`VisitClassTemplateSpecializationDecl` we already use
`D->getDefinition()` after the lookup.

Reviewers: a.sidorin, xazax.hun, szepet

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoTest commit
Kristof Umann [Wed, 23 May 2018 12:48:55 +0000 (12:48 +0000)]
Test commit

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

6 years agoFix unaligned memory access when reading INPUT_FILE_OFFSETS data
Raphael Isemann [Wed, 23 May 2018 09:02:40 +0000 (09:02 +0000)]
Fix unaligned memory access when reading INPUT_FILE_OFFSETS data

Summary: The blob data is unaligned, so we also should read it as such. Should fix the random failures with the sanitizer builds.

Reviewers: rsmith, v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years agoRevert r333044 "Use zeroinitializer for (trailing zero portion of) large array initia...
Hans Wennborg [Wed, 23 May 2018 08:24:01 +0000 (08:24 +0000)]
Revert r333044 "Use zeroinitializer for (trailing zero portion of) large array initializers"

It caused asserts, see PR37560.

> Use zeroinitializer for (trailing zero portion of) large array initializers
> more reliably.
>
> Clang has two different ways it emits array constants (from InitListExprs and
> from APValues), and both had some ability to emit zeroinitializer, but neither
> was able to catch all cases where we could use zeroinitializer reliably. In
> particular, emitting from an APValue would fail to notice if all the explicit
> array elements happened to be zero. In addition, for large arrays where only an
> initial portion has an explicit initializer, we would emit the complete
> initializer (which could be huge) rather than emitting only the non-zero
> portion. With this change, when the element would have a suffix of more than 8
> zero elements, we emit the array constant as a packed struct of its initial
> portion followed by a zeroinitializer constant for the trailing zero portion.
>
> In passing, I found a bug where SemaInit would sometimes walk the entire array
> when checking an initializer that only covers the first few elements; that's
> fixed here to unblock testing of the rest.
>
> Differential Revision: https://reviews.llvm.org/D47166

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

6 years ago[DOXYGEN] Formatting changes for better intrinsics documentation rendering
Ekaterina Romanova [Wed, 23 May 2018 06:33:22 +0000 (06:33 +0000)]
[DOXYGEN] Formatting changes for better intrinsics documentation rendering

(1) I added some \see cross-references to a few select intrinsics that are related (and have the same or similar semantics).

(2) pmmintrin.h, smmintrin.h, xmmintrin.h have very few minor formatting changes. They make rendering of our intrinsics documentation better.

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

6 years ago[X86] Undef the vector reduction helper macros when we're done with them.
Craig Topper [Wed, 23 May 2018 06:31:36 +0000 (06:31 +0000)]
[X86] Undef the vector reduction helper macros when we're done with them.

These are implementation helper macros we shouldn't expose them to user code if we don't need to.

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

6 years ago[X86] In the floating point max reduction intrinsics, negate infinity before feeding...
Craig Topper [Wed, 23 May 2018 05:51:52 +0000 (05:51 +0000)]
[X86] In the floating point max reduction intrinsics, negate infinity before feeding it to set1.

Previously we negated the whole vector after splatting infinity. But its better to negate the infinity before splatting. This generates IR with the negate already folded with the infinity constant.

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

6 years ago[X86] Remove mask argument from more builtins that are handled completely in CGBuilti...
Craig Topper [Wed, 23 May 2018 04:51:54 +0000 (04:51 +0000)]
[X86] Remove mask argument from more builtins that are handled completely in CGBuiltin.cpp. Just wrap a select builtin around them in the header file instead.

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

6 years ago[analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer
David Carlier [Wed, 23 May 2018 04:38:25 +0000 (04:38 +0000)]
[analyzer] CStringChecker fix for strlcpy when no bytes are copied to the dest buffer

Again, strlc* does not return a pointer so the zero size case doest not fit.

Reviewers: NoQ, george.karpenkov

Reviewed by: NoQ

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

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

6 years agoThis is a test commit.
David Carlier [Wed, 23 May 2018 04:27:39 +0000 (04:27 +0000)]
This is a test commit.

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

6 years ago[AST][ObjC] Print implicit property expression that only has a setter without crashing
Alex Lorenz [Wed, 23 May 2018 00:52:20 +0000 (00:52 +0000)]
[AST][ObjC] Print implicit property expression that only has a setter without crashing

rdar://40447209

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

6 years agoUse zeroinitializer for (trailing zero portion of) large array initializers
Richard Smith [Wed, 23 May 2018 00:09:29 +0000 (00:09 +0000)]
Use zeroinitializer for (trailing zero portion of) large array initializers
more reliably.

Clang has two different ways it emits array constants (from InitListExprs and
from APValues), and both had some ability to emit zeroinitializer, but neither
was able to catch all cases where we could use zeroinitializer reliably. In
particular, emitting from an APValue would fail to notice if all the explicit
array elements happened to be zero. In addition, for large arrays where only an
initial portion has an explicit initializer, we would emit the complete
initializer (which could be huge) rather than emitting only the non-zero
portion. With this change, when the element would have a suffix of more than 8
zero elements, we emit the array constant as a packed struct of its initial
portion followed by a zeroinitializer constant for the trailing zero portion.

In passing, I found a bug where SemaInit would sometimes walk the entire array
when checking an initializer that only covers the first few elements; that's
fixed here to unblock testing of the rest.

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

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

6 years ago[CodeGen] use nsw negation for builtin abs
Sanjay Patel [Tue, 22 May 2018 23:02:13 +0000 (23:02 +0000)]
[CodeGen] use nsw negation for builtin abs

The clang builtins have the same semantics as the stdlib functions.
The stdlib functions are defined in section 7.20.6.1 of the C standard with:
"If the result cannot be represented, the behavior is undefined."

That lets us mark the negation with 'nsw' because "sub i32 0, INT_MIN" would
be UB/poison.

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

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

6 years ago[X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsic...
Craig Topper [Tue, 22 May 2018 22:19:19 +0000 (22:19 +0000)]
[X86] As mentioned in post-commit feedback in D47174, move the 128 bit f16c intrinsics into f16cintrin.h and remove __emmintrin_f16c.h

These were included in emmintrin.h to match Intel Intrinsics Guide documentation. But this is because icc is capable of emulating them on targets that don't support F16C using library calls. Clang/LLVM doesn't have this emulation support. So it makes more sense to include them in immintrin.h instead.

I've left a comment behind to hopefully deter someone from trying to move them again in the future.

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