]> granicus.if.org Git - clang/log
clang
7 years agoclang/lib/Tooling/RefactoringCallbacks.cpp: Avoid std::errc::bad_message.
NAKAMURA Takumi [Wed, 10 May 2017 22:30:44 +0000 (22:30 +0000)]
clang/lib/Tooling/RefactoringCallbacks.cpp: Avoid std::errc::bad_message.

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

7 years agoPartially revert r302685 and swith Apple-style full LTO builds to
Adrian Prantl [Wed, 10 May 2017 22:14:23 +0000 (22:14 +0000)]
Partially revert r302685 and swith Apple-style full LTO builds to
-gline-tables-only. The memory consumption is apparently still too
much for some of the green dragon builders.

<rdar://problem/28672159>

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

7 years ago[Myriad] Pass -Xclang and -mllvm flags to moviCompile
James Y Knight [Wed, 10 May 2017 21:48:13 +0000 (21:48 +0000)]
[Myriad] Pass -Xclang and -mllvm flags to moviCompile

Patch by Walter Lee.

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

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

7 years agoChanges missed from r302732.
Richard Smith [Wed, 10 May 2017 21:47:30 +0000 (21:47 +0000)]
Changes missed from r302732.

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

7 years agoImprove diagnosis of unknown template name.
Richard Smith [Wed, 10 May 2017 21:32:16 +0000 (21:32 +0000)]
Improve diagnosis of unknown template name.

When an undeclared identifier in a context that requires a type is followed by
'<', only look for type templates when typo-correcting, tweak the diagnostic
text to say that a template name (not a type name) was undeclared, and parse
the template arguments when recovering from the error.

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

7 years agoFix errored return value in CheckFunctionReturnType and add a fixit hint
Erich Keane [Wed, 10 May 2017 20:03:16 +0000 (20:03 +0000)]
Fix errored return value in CheckFunctionReturnType and add a fixit hint

As discovered by ChenWJ and listed on cfe-dev, the error for Objective C
return type ended up being wrong. This fixes that. Additionally, as a
"while we're there", the other usages of this error and the usage of the
FP above both use a FixItHint, so I'll add it here.

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

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

7 years ago[Sema] Objective-C++ support for type trait __is_base_of
Erik Pilkington [Wed, 10 May 2017 17:18:56 +0000 (17:18 +0000)]
[Sema] Objective-C++ support for type trait __is_base_of

rdar://24308607

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

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

7 years ago[AST] RecursiveASTVisitor should not crash on lambdas with type attributes
Alex Lorenz [Wed, 10 May 2017 16:21:00 +0000 (16:21 +0000)]
[AST] RecursiveASTVisitor should not crash on lambdas with type attributes

rdar://31960860

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

7 years agoBuild the Apple-style stage2 with full debug info
Adrian Prantl [Wed, 10 May 2017 15:58:22 +0000 (15:58 +0000)]
Build the Apple-style stage2 with full debug info

Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch switches the debug info generation from -gline-tables-only
to -g since full debug info does no longer cause any memory issues
even for full LTO builds [2].

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
[2] http://llvm.org/devmtg/2015-10/#talk19
rdar://problem/28672159

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

7 years ago[libclang] Fix typo in doc-comment, NFC
Argyrios Kyrtzidis [Wed, 10 May 2017 15:48:16 +0000 (15:48 +0000)]
[libclang] Fix typo in doc-comment, NFC

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

7 years ago[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls...
Argyrios Kyrtzidis [Wed, 10 May 2017 15:10:36 +0000 (15:10 +0000)]
[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls marked with external_source_symbol attribute

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

7 years agoReland: [mips] Impose a threshold for coercion of aggregates
Petar Jovanovic [Wed, 10 May 2017 14:28:18 +0000 (14:28 +0000)]
Reland: [mips] Impose a threshold for coercion of aggregates

    Modified MipsABIInfo::classifyArgumentType so that it now coerces
    aggregate structures only if the size of said aggregate is less than
    16/64 bytes, depending on the ABI.

    Patch by Stefan Maksimovic.

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

with minor changes (use regexp instead of the hardcoded values) to the test.

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

7 years agoclang-format: refine calculating brace types.
Martin Probst [Wed, 10 May 2017 13:53:29 +0000 (13:53 +0000)]
clang-format: refine calculating brace types.

Summary:
For C++ code, opening parenthesis following a } indicate a braced init. For JavaScript and other languages, this is an invalid syntactical construct, unless the closing parenthesis belongs to a function - in which situation its a BK_Block.

This fixes indenting IIFEs following top level functions:

    function foo() {}
    (function() { codeHere(); }());

clang-format used to collapse these lines together.

Subscribers: klimek

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

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

7 years agoUse clang++-3.5 compatible initializer_list constructor
Serge Guelton [Wed, 10 May 2017 13:22:11 +0000 (13:22 +0000)]
Use clang++-3.5 compatible initializer_list constructor

Otherwise, a warning is issued.

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

7 years ago[OpenCL] Handle OpenCL specific subelement types
Egor Churaev [Wed, 10 May 2017 10:28:34 +0000 (10:28 +0000)]
[OpenCL] Handle OpenCL specific subelement types

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

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

7 years ago[index] Index simple dependent declaration references
Alex Lorenz [Wed, 10 May 2017 09:47:41 +0000 (09:47 +0000)]
[index] Index simple dependent declaration references

This commit implements basic support for indexing of dependent declaration
references. Now the indexer tries to find a suitable match in the base template
for a dependent member ref/decl ref/dependent type.

rdar://29158210

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

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

7 years ago[OpenCL] Added checking OpenCL version for cl_khr_mipmap_image built-ins
Egor Churaev [Wed, 10 May 2017 08:23:01 +0000 (08:23 +0000)]
[OpenCL] Added checking OpenCL version for cl_khr_mipmap_image built-ins

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

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

7 years agoAdd ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks
Eric Liu [Wed, 10 May 2017 07:48:45 +0000 (07:48 +0000)]
Add ASTMatchRefactorer and ReplaceNodeWithTemplate to RefactoringCallbacks

Summary: This is the first change as part of developing a clang-query based search and replace tool.

Reviewers: klimek, bkramer, ioeric, sbenza, jbangert

Reviewed By: ioeric, jbangert

Subscribers: sbenza, ioeric, cfe-commits

Patch by Julian Bangert!

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

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

7 years agoWhen we see a '<' operator, check whether it's a probable typo for a template-id.
Richard Smith [Wed, 10 May 2017 02:30:28 +0000 (02:30 +0000)]
When we see a '<' operator, check whether it's a probable typo for a template-id.

The heuristic that we use here is:
 * the left-hand side must be a simple identifier or a class member access
 * the right-hand side must be '<' followed by either a '>' or by a type-id that
   cannot be an expression (in particular, not followed by '(' or '{')
 * there is a '>' token matching the '<' token

The second condition guarantees the expression would otherwise be ill-formed.

If we're confident that the user intended the name before the '<' to be
interpreted as a template, diagnose the fact that we didn't interpret it
that way, rather than diagnosing that the template arguments are not valid
expressions.

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

7 years agoWhen instantiating a friend function template, don't forget to inherit default templa...
Richard Smith [Wed, 10 May 2017 00:01:13 +0000 (00:01 +0000)]
When instantiating a friend function template, don't forget to inherit default template arguments from other declarations.

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

7 years ago[ubsan] Mark overflow checks with !nosanitize
Vedant Kumar [Tue, 9 May 2017 23:34:49 +0000 (23:34 +0000)]
[ubsan] Mark overflow checks with !nosanitize

Sanitizer instrumentation generally needs to be marked with !nosanitize,
but we're not doing this properly for ubsan's overflow checks.

r213291 has more information about why this is needed.

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

7 years agoDon't mark a member as a member specialization until we know we're keeping the specia...
Richard Smith [Tue, 9 May 2017 23:02:10 +0000 (23:02 +0000)]
Don't mark a member as a member specialization until we know we're keeping the specialization.

This improves our behavior in a few ways:

 * We now guarantee that if a member is marked as being a member
   specialization, there will actually be a member specialization declaration
   somewhere on its redeclaration chain. This fixes a crash in modules builds
   where we would try to check that there was a visible declaration of the
   member specialization and be surprised to not find any declaration of it at
   all.

 * We don't set the source location of the in-class declaration of the member
   specialization to the out-of-line declaration's location until we have
   actually finished merging them. This fixes some very silly looking
   diagnostics, where we'd point a "previous declaration is here" note at the
   same declaration we're complaining about. Ideally we wouldn't mess with the
   prior declaration's location at all, but too much code assumes that the
   first declaration of an entity is a reasonable thing to use as an indication
   of where it was declared, and that's not really true for a member
   specialization unless we fake it like this.

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

7 years agoFix clang_cl argument in fsanitize.c driver test.
Evgeniy Stepanov [Tue, 9 May 2017 22:28:57 +0000 (22:28 +0000)]
Fix clang_cl argument in fsanitize.c driver test.

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

7 years ago[Sema] Implement Core 2094: Trivial copy/move constructor for class with volatile...
Eric Fiselier [Tue, 9 May 2017 22:21:24 +0000 (22:21 +0000)]
[Sema] Implement Core 2094: Trivial copy/move constructor for class with volatile member

Summary: This patch implements http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094 which reverts Core 496.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

7 years agoUpdate Clang C++ DR documentation for new issue list
Eric Fiselier [Tue, 9 May 2017 22:17:23 +0000 (22:17 +0000)]
Update Clang C++ DR documentation for new issue list

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

7 years ago[asan] A clang flag to enable ELF globals-gc.
Evgeniy Stepanov [Tue, 9 May 2017 21:57:43 +0000 (21:57 +0000)]
[asan] A clang flag to enable ELF globals-gc.

This feature is subtly broken when the linker is gold 2.26 or
earlier. See the following bug for details:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

Since the decision needs to be made at compilation time, we can not
test the linker version. The flag is off by default on ELF targets,
and on otherwise.

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

7 years agoRemove unnecessary calls to MakeArgString.
Evgeniy Stepanov [Tue, 9 May 2017 21:57:39 +0000 (21:57 +0000)]
Remove unnecessary calls to MakeArgString.

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

7 years agoFix CGObjCGNU::init bug introduced by r302572
Serge Guelton [Tue, 9 May 2017 21:19:44 +0000 (21:19 +0000)]
Fix CGObjCGNU::init bug introduced by r302572

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

7 years agoclang-format: [JS] Don't indent JavaScript IIFEs.
Martin Probst [Tue, 9 May 2017 20:04:09 +0000 (20:04 +0000)]
clang-format: [JS] Don't indent JavaScript IIFEs.

Because IIFEs[1] are often used like an anonymous namespace around large
sections of JavaScript code, it's useful not to indent to them (which
effectively reduces the column limit by the indent amount needlessly).

It's also common for developers to wrap these around entire files or
libraries. When adopting clang-format, changing the indent entire file
can reduce the usefulness of the blame annotations.

Patch by danbeam, thanks!

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

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

7 years agoUpdate testcase for upstream LLVM changes (r302469).
Adrian Prantl [Tue, 9 May 2017 19:47:41 +0000 (19:47 +0000)]
Update testcase for upstream LLVM changes (r302469).

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

7 years agoSuppress all uses of LLVM_END_WITH_NULL. NFC.
Serge Guelton [Tue, 9 May 2017 19:31:30 +0000 (19:31 +0000)]
Suppress all uses of LLVM_END_WITH_NULL. NFC.

Use variadic templates instead of relying on <cstdarg> + sentinel.

This enforces better type checking and makes code more readable.

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

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

7 years ago[WebAssembly] Fix failing wasm-toolchain test
Sam Clegg [Tue, 9 May 2017 18:44:23 +0000 (18:44 +0000)]
[WebAssembly] Fix failing wasm-toolchain test

This test was broken in r302558.

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

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

7 years ago[X86][LWP] Remove MSVC LWP intrinsics stubs.
Simon Pilgrim [Tue, 9 May 2017 17:50:16 +0000 (17:50 +0000)]
[X86][LWP] Remove MSVC LWP intrinsics stubs.

Now provided in lwpintrin.h

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

7 years ago[WebAssembly] Fix location and -flavor when running lld
Sam Clegg [Tue, 9 May 2017 17:47:50 +0000 (17:47 +0000)]
[WebAssembly] Fix location and -flavor when running lld

Add the toolchain installation directory to the program
path so that lld can be found.

Change -flavor to wasm.  Although this new flavor hasn't
yet landed in upstream lld yet there are no point in
passing wasm objects the gnu flavor.

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

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

7 years ago[X86][LWP] Removing LWP todo comment. NFCI.
Simon Pilgrim [Tue, 9 May 2017 17:43:16 +0000 (17:43 +0000)]
[X86][LWP] Removing LWP todo comment. NFCI.

LWP / lwpintrin.h is now supported

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

7 years agoBuild the Apple-style stage2 with modules
Adrian Prantl [Tue, 9 May 2017 17:27:03 +0000 (17:27 +0000)]
Build the Apple-style stage2 with modules

Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch turns on LLVM_ENABLE_MODULES.

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
rdar://problem/28672159

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

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

7 years agoRevert r302547 ([mips] Impose a threshold for coercion of aggregates)
Petar Jovanovic [Tue, 9 May 2017 17:20:06 +0000 (17:20 +0000)]
Revert r302547 ([mips] Impose a threshold for coercion of aggregates)

Reverting
  Modified MipsABIInfo::classifyArgumentType so that it now coerces
  aggregate structures only if the size of said aggregate is less than 16/64
  bytes, depending on the ABI.
as it broke clang-with-lto-ubuntu builder.

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

7 years ago[mips] Impose a threshold for coercion of aggregates
Petar Jovanovic [Tue, 9 May 2017 16:24:03 +0000 (16:24 +0000)]
[mips] Impose a threshold for coercion of aggregates

Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate
structures only if the size of said aggregate is less than 16/64 bytes,
depending on the ABI.

Patch by Stefan Maksimovic.

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

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

7 years ago[CodeCompletion] Complete platform names in @available expressions
Alex Lorenz [Tue, 9 May 2017 16:05:04 +0000 (16:05 +0000)]
[CodeCompletion] Complete platform names in @available expressions

rdar://32074504

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

7 years agoRevert r302476 "Update testcase for upstream LLVM changes."
Hans Wennborg [Tue, 9 May 2017 15:55:39 +0000 (15:55 +0000)]
Revert r302476 "Update testcase for upstream LLVM changes."

That test update was for r302469, which was reverted in r302533 due to PR32977.

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

7 years agoAdd support for pretty platform names to `@available`/
Alex Lorenz [Tue, 9 May 2017 15:34:46 +0000 (15:34 +0000)]
Add support for pretty platform names to `@available`/
`__builtin_available`

This commit allows us to use the macOS/iOS/tvOS/watchOS platform names in
`@available`/`__builtin_available`.

rdar://32067795

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

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

7 years agoclang-format: [JS] keep triple slash directives intact.
Martin Probst [Tue, 9 May 2017 12:45:48 +0000 (12:45 +0000)]
clang-format: [JS] keep triple slash directives intact.

Summary:
TypeScript uses triple slash directives of the form:
    /// <reference path="..."/>

For various non-source instructions that should not be wrapped.

Reference:
https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoPR5935: Adjust documentation.
Vassil Vassilev [Tue, 9 May 2017 12:37:15 +0000 (12:37 +0000)]
PR5935: Adjust documentation.

https://reviews.llvm.org/D31867

Patch by Johannes Altmanninger!

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

7 years agoReland "Warn about unused static file scope function template declarations."
Vassil Vassilev [Tue, 9 May 2017 11:25:41 +0000 (11:25 +0000)]
Reland "Warn about unused static file scope function template declarations."

This patch reinstates r299930, reverted in r299956, as a separate diagnostic
option (-Wunused-template).

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

7 years agoFix PR32638 : Make sure we switch Sema's CurContext to the substituted FunctionDecl...
Faisal Vali [Tue, 9 May 2017 04:17:15 +0000 (04:17 +0000)]
Fix PR32638 : Make sure we switch Sema's CurContext to the substituted FunctionDecl when instantiating the exception specification.

This fixes the bug: https://bugs.llvm.org/show_bug.cgi?id=32638

  int main()
  {
    [](auto x) noexcept(noexcept(x)) { } (0);
  }

In the above code, prior to this patch, when substituting into the noexcept expression, i.e. transforming the DeclRefExpr that represents 'x' - clang attempts to capture 'x' because Sema's CurContext is still pointing to the pattern FunctionDecl (i.e. the templated-decl set in FinishTemplateArgumentDeduction) which does not match the substituted 'x's DeclContext, which leads to an attempt to capture and an assertion failure.

We fix this by adjusting Sema's CurContext to point to the substituted FunctionDecl under which the noexcept specifier's argument should be transformed, and so the ParmVarDecl that 'x' refers to has the same declcontext and no capture is attempted.

I briefly investigated whether the SwitchContext should occur right after VisitMethodDecl creates the new substituted FunctionDecl, instead of only during instantiating the exception specification - but seeing no other code that seemed to rely on that, I decided to leave it just for the duration of the exception specification instantiation.

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

7 years ago[Sema] Make typeof(OverloadedFunctionName) not a pointer.
George Burgess IV [Tue, 9 May 2017 04:06:24 +0000 (04:06 +0000)]
[Sema] Make typeof(OverloadedFunctionName) not a pointer.

We were sometimes doing a function->pointer conversion in
Sema::CheckPlaceholderExpr, which isn't the job of CheckPlaceholderExpr.

So, when we saw typeof(OverloadedFunctionName), where
OverloadedFunctionName referenced a name with only one function that
could have its address taken, we'd give back a function pointer type
instead of a function type. This is incorrect.

I kept the logic for doing the function pointer conversion in
resolveAndFixAddressOfOnlyViableOverloadCandidate because it was more
consistent with existing ResolveAndFix* methods.

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

7 years ago[ODRHash] Loosen checks on typedefs.
Richard Trieu [Tue, 9 May 2017 03:24:34 +0000 (03:24 +0000)]
[ODRHash] Loosen checks on typedefs.

When a type in a class is from a typedef, only check the canonical type.  Skip
checking the intermediate underlying types.  This is in response to PR 32965

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

7 years ago[Sema][ObjC] Clean up possible null dereference.
Akira Hatanaka [Tue, 9 May 2017 01:54:51 +0000 (01:54 +0000)]
[Sema][ObjC] Clean up possible null dereference.

It appears that the code is actually dead since unbridged-cast
placeholder types are created by calling CastOperation::complete and
ImplicitCastExprs are never passed to it.

Spotted by Vedant Kumar.

rdar://problem/31542226

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

7 years agodocs: Fix Sphinx detection with out-of-tree builds
Tom Stellard [Tue, 9 May 2017 01:42:33 +0000 (01:42 +0000)]
docs: Fix Sphinx detection with out-of-tree builds

Adapt to changes made in r302499.

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

7 years ago[CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured by
Akira Hatanaka [Tue, 9 May 2017 01:20:05 +0000 (01:20 +0000)]
[CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured by
blocks.

r302270 made changes to avoid emitting clang.arc.use at -O0 and instead
emit @objc_release. We also have to emit @objc_retain for the captured
variable at -O0 to match the @objc_release instead of just storing the
pointer to the capture field.

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

7 years ago[XRay] Add __xray_customeevent(...) as a clang-supported builtin
Dean Michael Berris [Tue, 9 May 2017 00:45:40 +0000 (00:45 +0000)]
[XRay] Add __xray_customeevent(...) as a clang-supported builtin

Summary:
We define the `__xray_customeevent` builtin that gets translated to
IR calls to the correct intrinsic. The default implementation of this is
a no-op function. The codegen side of this follows the following logic:

- When `-fxray-instrument` is not provided in the driver, we elide all
calls to `__xray_customevent`.
- When `-fxray-instrument` is enabled and a function is marked as "never
instrumented", we elide all calls to `__xray_customevent` in that
function; if either marked as "always instrumented" or subject to
threshold-based instrumentation, we emit a call to the
`llvm.xray.customevent` intrinsic from LLVM for each
`__xray_customevent` occurrence in the function.

This change depends on D27503 (to land in LLVM first).

Reviewers: echristo, rsmith

Subscribers: mehdi_amini, pelikan, lrl, cfe-commits

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

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

7 years ago[Modules] Allow umbrella frameworks to define private submodules for subframeworks
Bruno Cardoso Lopes [Tue, 9 May 2017 00:41:38 +0000 (00:41 +0000)]
[Modules] Allow umbrella frameworks to define private submodules for subframeworks

In r298391 we fixed the umbrella framework model to work when submodules
named "Private" are used. This complements the work by allowing the
umbrella framework model to work in general.

rdar://problem/31790067

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

7 years agoRename a method. NFC.
Vedant Kumar [Tue, 9 May 2017 00:12:33 +0000 (00:12 +0000)]
Rename a method. NFC.

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

7 years agoUpdate testcase for upstream LLVM changes.
Adrian Prantl [Mon, 8 May 2017 22:44:00 +0000 (22:44 +0000)]
Update testcase for upstream LLVM changes.

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

7 years ago[Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled
Vedant Kumar [Mon, 8 May 2017 21:11:55 +0000 (21:11 +0000)]
[Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled

When enabling any sanitizer, -fsanitize-use-after-scope is enabled by
default. This doesn't actually turn ASan on, because we've been getting
lucky and there are extra checks in BackendUtil that stop this from
happening.

However, this has been causing a behavior change: extra lifetime markers
are emitted in some cases where they aren't needed or expected.

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

7 years agoIf we are building a module, and we read a second description of the same
Richard Smith [Mon, 8 May 2017 20:30:47 +0000 (20:30 +0000)]
If we are building a module, and we read a second description of the same
module from a different module map, ignore it.

This happens during builds of preprocessed modules (where it is harmless).

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

7 years ago[X86][LWP] Add __LWP__ macro tests
Simon Pilgrim [Mon, 8 May 2017 17:25:48 +0000 (17:25 +0000)]
[X86][LWP] Add __LWP__ macro tests

Missed in rL302418

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

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

7 years agoFix grammar in comment. NFC
Jonathan Roelofs [Mon, 8 May 2017 17:06:17 +0000 (17:06 +0000)]
Fix grammar in comment. NFC

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

7 years ago[AST] Fix copy&paste error in comment. NFC.
Malcolm Parsons [Mon, 8 May 2017 16:43:29 +0000 (16:43 +0000)]
[AST] Fix copy&paste error in comment. NFC.

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

7 years ago[Sema] Fix typos handling in an overloadable call.
Anastasia Stulova [Mon, 8 May 2017 16:05:54 +0000 (16:05 +0000)]
[Sema] Fix typos handling in an overloadable call.

In C typos in arguments in a call of an overloadable function lead
to a failure of construction of CallExpr and following recovery does
not handle created delayed typos. This causes an assertion fail in
Sema::~Sema since Sema::DelayedTypos remains not empty.

The patch fixes that behavior by handling a call with arguments
having dependant types in the way that C++ does.

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

Patch by Dmitry Borisenkov!

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

7 years ago[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
Daniel Jasper [Mon, 8 May 2017 15:08:00 +0000 (15:08 +0000)]
[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
DontAlign

This converts the clang-format option AlignEscapedNewlinesLeft from a
boolean to an enum, named AlignEscapedNewlines, with options Left (prev.
true), Right (prev. false), and a new option DontAlign.

When set to DontAlign, the backslashes are placed just after the last token in each line:
  #define EXAMPLE \
    do { \
        int x = aaaaa; \
        int b; \
        int dddddddddd; \
    } while (0)

Patch by jtbandes. Thank you!

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

7 years ago[clang-format] Don’t propagate AvoidBinPacking into argument
Daniel Jasper [Mon, 8 May 2017 15:07:52 +0000 (15:07 +0000)]
[clang-format] Don’t propagate AvoidBinPacking into argument
subexpressions

This is an attempt to fix the issue described in a recent email:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053632.html

Patch by jtbandes. Thank you!
Review: https://reviews.llvm.org/D32475

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

7 years agoCorrect the attribute spelling for guarded_var and pt_guarded_var.
Aaron Ballman [Mon, 8 May 2017 12:39:17 +0000 (12:39 +0000)]
Correct the attribute spelling for guarded_var and pt_guarded_var.

Patch by Roman Lebedev.

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

7 years ago[X86][LWP] Add clang support for LWP instructions.
Simon Pilgrim [Mon, 8 May 2017 12:09:45 +0000 (12:09 +0000)]
[X86][LWP] Add clang support for LWP instructions.

This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

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

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

7 years ago[OpenCL] Check that global samplers are const
Sven van Haastregt [Mon, 8 May 2017 09:29:06 +0000 (09:29 +0000)]
[OpenCL] Check that global samplers are const

Patch by Simon Perretta.

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

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

7 years agoUpdate LanguageExtensions doc to refer to C++14 instead of C++1y
Eric Fiselier [Sat, 6 May 2017 23:26:04 +0000 (23:26 +0000)]
Update LanguageExtensions doc to refer to C++14 instead of C++1y

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

7 years ago[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden...
Kostya Serebryany [Fri, 5 May 2017 23:28:18 +0000 (23:28 +0000)]
[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. clang part.

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

7 years agoAArch64: fix weird edge case in ABI.
Tim Northover [Fri, 5 May 2017 22:36:06 +0000 (22:36 +0000)]
AArch64: fix weird edge case in ABI.

It turns out there are some sort-of-but-not-quite empty structs that break all
the rules. For example:

struct SuperEmpty { int arr[0]; };
struct SortOfEmpty { struct SuperEmpty e; };

Both of these have sizeof == 0, even in C++ mode, for GCC compatibility. The
first one also doesn't occupy a register when passed by value in GNU C++ mode,
unlike everything else.

On Darwin, we want to ignore the lot (and especially don't want to try to use
an i0 as we were).

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

7 years agoPermit keywords in module names in #pragma clang module *.
Richard Smith [Fri, 5 May 2017 22:34:07 +0000 (22:34 +0000)]
Permit keywords in module names in #pragma clang module *.

This is necessary to be able to build a libc++ module from preprocessed source
(due to the submodule std.new).

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

7 years agoAdd support for building modules from preprocessed source.
Richard Smith [Fri, 5 May 2017 22:18:51 +0000 (22:18 +0000)]
Add support for building modules from preprocessed source.

To support this, an optional marker "#pragma clang module contents" is
recognized in module map files, and the rest of the module map file from that
point onwards is treated as the source of the module. Preprocessing a module
map produces the input module followed by the marker and then the preprocessed
contents of the module.

Ignoring line markers, a preprocessed module might look like this:

  module A {
    header "a.h"
  }
  #pragma clang module contents
  #pragma clang module begin A
  // ... a.h ...
  #pragma clang module end

The preprocessed output generates line markers, which are not accepted by the
module map parser, so -x c++-module-map-cpp-output should be used to compile
such outputs.

A couple of major parts do not work yet:

1) The files that are listed in the module map must exist on disk, in order to
   build the on-disk header -> module lookup table in the PCM file. To fix
   this, we need the preprocessed output to track the file size and other stat
   information we might use to build the lookup table.

2) Declaration ownership semantics don't work properly yet, since mapping from
   a source location to a module relies on mapping from FileIDs to modules,
   which we can't do if module transitions can occur in the middle of a file.

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

7 years agoMultilib: add dump methods
Jonathan Roelofs [Fri, 5 May 2017 21:30:13 +0000 (21:30 +0000)]
Multilib: add dump methods

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

7 years agoAdd cxxStdInitializerListExpr AST matcher
Jakub Kuderski [Fri, 5 May 2017 21:01:12 +0000 (21:01 +0000)]
Add cxxStdInitializerListExpr AST matcher

Summary:
This adds a new ASTMatcher for CXXStdInitializerListExprs that matches C++ initializer list expressions.

The primary motivation is to use it to fix [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]] (review here [[ https://reviews.llvm.org/D32767 | D32767 ]]).

Reviewers: alexfh, Prazek, aaron.ballman

Reviewed By: alexfh, aaron.ballman

Subscribers: malcolm.parsons, cfe-commits, klimek

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

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

7 years ago[ODRHash] Fix typo, NFC
Richard Trieu [Fri, 5 May 2017 20:47:50 +0000 (20:47 +0000)]
[ODRHash] Fix typo, NFC

NestedNameSpecifer to NestedNameSpecifier.  This was not a problem before since
one of the included headers transitively brought in the definition of the class
and only manifested as a problem when using the typoed NestedNameSpecifer and
getting an incomplete type error instead of a typo correction.

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

7 years agoDo not redefine the THREAD_ANNOTATION_ATTRIBUTE__ macro in the documentation.
Aaron Ballman [Fri, 5 May 2017 19:56:09 +0000 (19:56 +0000)]
Do not redefine the THREAD_ANNOTATION_ATTRIBUTE__ macro in the documentation.

Patch by Roman Lebedev.

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

7 years ago[ARM] Limit the diagnose when an ISR calls a regular function
Weiming Zhao [Fri, 5 May 2017 19:25:29 +0000 (19:25 +0000)]
[ARM] Limit the diagnose when an ISR calls a regular function

Summary:
When the function is compiled with soft-float or on CPU with no FPU, we
don't need to diagnose for a call from an ISR to a regular function.

Reviewers: jroelofs, eli.friedman

Reviewed By: jroelofs

Subscribers: aemerson, rengolin, javed.absar, cfe-commits

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

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

7 years agoCodeGen: avoid use of @clang.arc.use intrinsic at O0
Saleem Abdulrasool [Fri, 5 May 2017 18:39:06 +0000 (18:39 +0000)]
CodeGen: avoid use of @clang.arc.use intrinsic at O0

The clang.arc.use intrinsic is removed via the ARC Contract Pass.  This
pass is only executed in optimized builds (>= opt level 1).  Prevent the
optimization implemented in SVN r301667 from triggering at optimization
level 0 like every other ARC use intrinsic usage.

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

7 years agoANSIfy more. Still no behavior change.
Nico Weber [Fri, 5 May 2017 17:16:58 +0000 (17:16 +0000)]
ANSIfy more. Still no behavior change.

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

7 years agoANSIfy. No behavior change.
Nico Weber [Fri, 5 May 2017 17:15:08 +0000 (17:15 +0000)]
ANSIfy. No behavior change.

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

7 years agoWarn that the [] spelling of uuid(...) is deprecated.
Nico Weber [Fri, 5 May 2017 17:05:56 +0000 (17:05 +0000)]
Warn that the [] spelling of uuid(...) is deprecated.

https://reviews.llvm.org/D32879

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

7 years agoAdd a fix-it for -Wunguarded-availability
Alex Lorenz [Fri, 5 May 2017 16:42:44 +0000 (16:42 +0000)]
Add a fix-it for -Wunguarded-availability

This patch adds a fix-it for the -Wunguarded-availability warning. This fix-it
is similar to the Swift one: it suggests that you wrap the statement in an
`if (@available)` check. The produced fixits are indented (just like the Swift
ones) to make them look nice in Xcode's fix-it preview.

rdar://31680358

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

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

7 years ago[ObjC] Don't disallow vector parameters/return values in methods
Alex Lorenz [Fri, 5 May 2017 16:15:17 +0000 (16:15 +0000)]
[ObjC] Don't disallow vector parameters/return values in methods
whose introduced version is lower than the allowed version.

We should just rely on the target version as this introduced version can lead
to false positives (e.g. deprecated declarations).

rdar://31964333

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

7 years agoIntroduce Wzero-as-null-pointer-constant.
Nico Weber [Fri, 5 May 2017 16:11:08 +0000 (16:11 +0000)]
Introduce Wzero-as-null-pointer-constant.

Add an opt-in warning that fires when 0 is used as a null pointer.
gcc has this warning, and there's some demand for it.

https://reviews.llvm.org/D32914

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

7 years ago[Driver] Add a "-mmacos_version_min" option that's an alias for
Alex Lorenz [Fri, 5 May 2017 14:52:48 +0000 (14:52 +0000)]
[Driver] Add a "-mmacos_version_min" option that's an alias for
"-mmacosx_version_min"

The option -mmacosx_version_min will still be the canonical option for now, but
in the future we will switch over to -mmacos_version_min and make
-mmacosx_version_min an alias instead.

rdar://27043820

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

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

7 years ago[Tooling] Remove redundant check, NFCi
Krasimir Georgiev [Fri, 5 May 2017 14:07:23 +0000 (14:07 +0000)]
[Tooling] Remove redundant check, NFCi

Summary: The Database check looks redundant.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

7 years agoDocument that Multilib flags must be actual flags
Jonathan Roelofs [Fri, 5 May 2017 00:18:27 +0000 (00:18 +0000)]
Document that Multilib flags must be actual flags

This is because -print-multi-lib depends on them being flags for correctness.

Fixes a case of this in the arm-android multilib selection logic.

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

7 years agoFix whitespace before token-paste of an argument.
James Y Knight [Thu, 4 May 2017 21:31:17 +0000 (21:31 +0000)]
Fix whitespace before token-paste of an argument.

The whitespace should come from the argument name in the macro
expansion, rather than from the token passed to the macro (same as it
does when not pasting).

Added a new test case for the change in behavior to stringize_space.c.

FileCheck'ized macro_paste_commaext.c, tweaked the test case, and
added a comment; no behavioral change to this test.

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

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

7 years agoTurn on -Wmicrosoft-enum-forward-reference by default.
Nico Weber [Thu, 4 May 2017 19:54:50 +0000 (19:54 +0000)]
Turn on -Wmicrosoft-enum-forward-reference by default.

clang-cl already errs or warns on everything that cl
warns on in /permissive- mode, except for enum foward
declarations (and ATL attributes).
So warn on enum forward declarations by default.

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

7 years agoFix bugs checking va_start in lambdas and erroneous contexts
Reid Kleckner [Thu, 4 May 2017 19:51:05 +0000 (19:51 +0000)]
Fix bugs checking va_start in lambdas and erroneous contexts

Summary:
First, getCurFunction looks through blocks and lambdas, which is wrong.
Inside a lambda, va_start should refer to the lambda call operator
prototype. This fixes PR32737.

Second, we shouldn't use any of the getCur* methods, because they look
through contexts that we don't want to look through (EnumDecl,
CapturedStmtDecl). We can use CurContext directly as the calling
context.

Finally, this code assumed that CallExprs would never appear outside of
code contexts (block, function, obj-c method), which is wrong. Struct
member initializers are an easy way to create and parse exprs in a
non-code context.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoTurn -Wmicrosoft-enum-value off by default.
Nico Weber [Thu, 4 May 2017 19:36:26 +0000 (19:36 +0000)]
Turn -Wmicrosoft-enum-value off by default.

The warning is currently way too noisy to be useful. The plan is
to make it warn when an MS enum that's negative is compared to
something, but until that's done the warning shouldn't default
to on.

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

7 years agoDriver: only inject libstdc++ paths when needed on CrossWindows
Saleem Abdulrasool [Thu, 4 May 2017 19:18:21 +0000 (19:18 +0000)]
Driver: only inject libstdc++ paths when needed on CrossWindows

When building with libc++ don't bother with injecting the libstdc++
search paths into the linker search path.  This will make it easier to
switch between ld and lld.

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

7 years ago[ms-inline-asm] Use the frontend size only for ambiguous instructions
Reid Kleckner [Thu, 4 May 2017 18:19:52 +0000 (18:19 +0000)]
[ms-inline-asm] Use the frontend size only for ambiguous instructions

This avoids problems on code like this:
  char buf[16];
  __asm {
    movups xmm0, [buf]
    mov [buf], eax
  }

The frontend size in this case (1) is wrong, and the register makes the
instruction matching unambiguous. There are also enough bytes available
that we shouldn't complain to the user that they are potentially using
an incorrectly sized instruction to access the variable.

Supersedes D32636 and D26586 and fixes PR28266

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

7 years agoRe-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module...
Peter Collingbourne [Thu, 4 May 2017 18:03:25 +0000 (18:03 +0000)]
Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
with a fix for the clang backend.

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

7 years ago[Tooling] add a createReplacement overload for StringRef
Alexander Kornienko [Thu, 4 May 2017 15:34:06 +0000 (15:34 +0000)]
[Tooling] add a createReplacement overload for StringRef

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

7 years agoclang-format: [JS] exponentiation operator
Martin Probst [Thu, 4 May 2017 15:04:04 +0000 (15:04 +0000)]
clang-format: [JS] exponentiation operator

Summary: While its precedence should be higher than multiplicative, LLVM does not have a level for that, so for the time being just treat it as multiplicative.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Thu, 4 May 2017 13:56:51 +0000 (13:56 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This fix avoids an infinite recursion that was uncovered in one of our internal
tests by r301992. The testcase is the most reduced version of that
auto-generated test.

This is an improved version of the reverted commit r302037. The previous fix
actually managed to expose another subtle bug whereby `fatal_too_many_errors`
error was reported twice, with the second report setting the
`FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic
the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes
that follow `fatal_too_many_errors` but that belong to the diagnostic that
caused `fatal_too_many_errors` won't be emitted by setting the
`FatalErrorOccurred` when emitting `fatal_too_many_errors`.

rdar://31962618

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

7 years agoAdd support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)
Sylvestre Ledru [Thu, 4 May 2017 12:46:38 +0000 (12:46 +0000)]
Add support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)

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

7 years agoRevert "IR: Use pointers instead of GUIDs to represent edges in the module summary...
Eric Liu [Thu, 4 May 2017 12:05:40 +0000 (12:05 +0000)]
Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."

This reverts commit r302108.

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

7 years ago[Index] The relation between the declarations in template
Alex Lorenz [Thu, 4 May 2017 10:42:06 +0000 (10:42 +0000)]
[Index] The relation between the declarations in template
specializations that 'override' declarations in the base template should use
the 'specializationOf' relation instead of 'specializationOf | overrideOf'.

The indexer relations are meant to be orthogonal, so 'specializationOf' is
better than the combined relation.

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

7 years ago[ARM] ACLE Chapter 9 intrinsics
Sam Parker [Thu, 4 May 2017 08:37:59 +0000 (08:37 +0000)]
[ARM] ACLE Chapter 9 intrinsics

Implemented the remaining integer data processing intrinsics from
the ARM ACLE v2.1 spec, such as parallel arithemtic and DSP style
multiplications.

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

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

7 years ago[OpenCL] Add intel_reqd_sub_group_size attribute support
Xiuli Pan [Thu, 4 May 2017 07:31:20 +0000 (07:31 +0000)]
[OpenCL] Add intel_reqd_sub_group_size attribute support

Summary:
Add intel_reqd_sub_group_size attribute support as intel extension  cl_intel_required_subgroup_size from
https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt

Reviewers: Anastasia, bader, hfinkel, pxli168

Reviewed By: Anastasia, bader, pxli168

Subscribers: cfe-commits, yaxunl

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

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