]> granicus.if.org Git - clang/log
clang
7 years agoWhen we enter a module within a linkage specification, switch the linkage
Richard Smith [Thu, 18 May 2017 19:34:55 +0000 (19:34 +0000)]
When we enter a module within a linkage specification, switch the linkage
specification and the TU to the new module.

This is necessary to get the module ownership correct for entities that we
temporarily hang off the TranslationUnitDecl, such as template parameters and
function parameters.

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

7 years agoFix the location of "missing ';'" suggestions after annotation tokens.
Richard Smith [Thu, 18 May 2017 19:21:48 +0000 (19:21 +0000)]
Fix the location of "missing ';'" suggestions after annotation tokens.

We were incorrectly setting PrevTokLocation to the first token in the
annotation token instead of the last when consuming it. To fix this without
adding a complex switch to the hot path through ConsumeToken, we now have a
ConsumeAnnotationToken function for consuming annotation tokens in addition
to the other Consume*Token special case functions.

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

7 years agoCodeGen: Cast alloca to expected address space
Yaxun Liu [Thu, 18 May 2017 18:51:09 +0000 (18:51 +0000)]
CodeGen: Cast alloca to expected address space

Alloca always returns a pointer in alloca address space, which may
be different from the type defined by the language. For example,
in C++ the auto variables are in the default address space. Therefore
cast alloca to the expected address space when necessary.

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

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

7 years ago[index] Avoid one more crash caused by infinite recursion that happens when
Alex Lorenz [Thu, 18 May 2017 18:06:07 +0000 (18:06 +0000)]
[index] Avoid one more crash caused by infinite recursion that happens when
looking up a dependent name in a record that derives from itself

rdar://32273000

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

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

7 years ago[CodeGen] Propagate LValueBaseInfo instead of AlignmentSource
Krzysztof Parzyszek [Thu, 18 May 2017 17:07:11 +0000 (17:07 +0000)]
[CodeGen] Propagate LValueBaseInfo instead of AlignmentSource

The functions creating LValues propagated information about alignment
source. Extend the propagated data to also include information about
possible unrestricted aliasing. A new class LValueBaseInfo will
contain both AlignmentSource and MayAlias info.

This patch should not introduce any functional changes.

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

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

7 years ago[clang-format] Fix MatchingOpeningBlockLineIndex computation
Krasimir Georgiev [Thu, 18 May 2017 15:16:24 +0000 (15:16 +0000)]
[clang-format] Fix MatchingOpeningBlockLineIndex computation

Summary:
Computed line index must be relative to the current 'parent' node, and
thus use CurrentLines instead of Lines.

Without this, a child line's MatchingOpeningBlockLineIndex is out of
range of the parent's list of line, which can cause crash or unexpected
behavior if this field is used in childs.

Contributed by @Typz!

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: cfe-commits, klimek

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

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

7 years ago[index] Record references to class receivers used in property references
Alex Lorenz [Thu, 18 May 2017 10:43:11 +0000 (10:43 +0000)]
[index] Record references to class receivers used in property references

rdar://32250025

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

7 years ago[clang-format] Make NoLineBreakFormatter respect MustBreakBefore
Krasimir Georgiev [Thu, 18 May 2017 08:07:52 +0000 (08:07 +0000)]
[clang-format] Make NoLineBreakFormatter respect MustBreakBefore

Summary:
This patch makes NoLineBreakFormatter to insert a break before tokens where
MustBreakBefore is true.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: fix prefix for doxygen comments after member
Krasimir Georgiev [Thu, 18 May 2017 07:36:21 +0000 (07:36 +0000)]
clang-format: fix prefix for doxygen comments after member

Summary:
Doxygen supports putting documentation blocks after member, by adding
an additional < marker in the comment block. This patch makes sure
this marker is used in lines which are introduced by breaking the
comment.

  int foo; ///< Some very long comment.

becomes:

  int foo; ///< Some very long
           ///< comment.

Contributed by @Typz!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: djasper, klimek, cfe-commits

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

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

7 years agoFix an assertion failure in FormatASTNodeDiagnosticArgument.
Alexander Kornienko [Thu, 18 May 2017 03:02:15 +0000 (03:02 +0000)]
Fix an assertion failure in FormatASTNodeDiagnosticArgument.

Summary:
The test being added in this patch used to cause an assertion failure:

/build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp
--
Exit Code: 134

Command Output (stderr):
--
clang: /src/tools/clang/lib/AST/ASTDiagnostic.cpp:424: void clang::FormatASTNodeDiagnosticArgument(DiagnosticsEngine::ArgumentKind, intptr_t, llvm::StringRef, llvm::StringRef, ArrayRef<DiagnosticsEngine::ArgumentValue>, SmallVectorImpl<char> &, void *, ArrayRef<intptr_t>): Assertion `isa<NamedDecl>(DC) && "Expected a NamedDecl"' failed.
#0 0x0000000001c7a1b4 PrintStackTraceSignalHandler(void*) (/build/./bin/clang+0x1c7a1b4)
#1 0x0000000001c7a4e6 SignalHandler(int) (/build/./bin/clang+0x1c7a4e6)
#2 0x00007f30880078d0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#3 0x00007f3087054067 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35067)
#4 0x00007f3087055448 abort (/lib/x86_64-linux-gnu/libc.so.6+0x36448)
#5 0x00007f308704d266 (/lib/x86_64-linux-gnu/libc.so.6+0x2e266)
#6 0x00007f308704d312 (/lib/x86_64-linux-gnu/libc.so.6+0x2e312)
#7 0x00000000035b7f22 clang::FormatASTNodeDiagnosticArgument(clang::DiagnosticsEngine::ArgumentKind, long, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<std::pair<clang::DiagnosticsEngine::ArgumentKind, long> >, llvm::SmallVectorImpl<char>&, void*, llvm::ArrayRef<long>) (/build/
./bin/clang+0x35b7f22)
#8 0x0000000001ddbae4 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/build/./bin/clang+0x1ddbae4)
#9 0x0000000001ddb323 clang::Diagnostic::FormatDiagnostic(char const*, char const*, llvm::SmallVectorImpl<char>&) const (/build/./bin/clang+0x1ddb323)
#10 0x00000000022878a4 clang::TextDiagnosticBuffer::HandleDiagnostic(clang::DiagnosticsEngine::Level, clang::Diagnostic const&) (/build/./bin/clang+0x22878a4)
#11 0x0000000001ddf387 clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const (/build/./bin/clang+0x1ddf387)
#12 0x0000000001dd9dea clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool) (/build/./bin/clang+0x1dd9dea)
#13 0x0000000002cad00c clang::Sema::EmitCurrentDiagnostic(unsigned int) (/build/./bin/clang+0x2cad00c)
#14 0x0000000002d91cd2 clang::Sema::CheckShadow(clang::NamedDecl*, clang::NamedDecl*, clang::LookupResult const&) (/build/./bin/clang+0x2d91cd2)

Stack dump:
0.      Program arguments: /build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp
1.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:214:23: current parser token ';'
2.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:213:26: parsing function body 'handleLinkageSpec'
3.      /src/tools/clang/test/SemaCXX/warn-shadow.cpp:213:26: in compound statement ('{}')
/build/tools/clang/test/SemaCXX/Output/warn-shadow.cpp.script: line 1: 15595 Aborted                 (core dumped) /build/./bin/clang -cc1 -internal-isystem /build/lib/clang/5.0.0/include -nostdsysteminc -verify -fsyntax-only -std=c++11 -Wshadow-all /src/tools/clang/test/SemaCXX/warn-shadow.cpp

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: krytarowski, cfe-commits

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

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

7 years ago[modules] Switch from inferring owning modules based on source location to
Richard Smith [Thu, 18 May 2017 02:29:20 +0000 (02:29 +0000)]
[modules] Switch from inferring owning modules based on source location to
inferring based on the current module at the point of creation.

This should result in no functional change except when building a preprocessed
module (or more generally when using #pragma clang module begin/end to switch
module in the middle of a file), in which case it allows us to correctly track
the owning module for declarations. We can't map from FileID to module in the
preprocessed module case, since all modules would have the same FileID.

There are still a couple of remaining places that try to infer a module from a
source location; I'll clean those up in follow-up changes.

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

7 years ago[Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value...
Craig Topper [Thu, 18 May 2017 01:11:52 +0000 (01:11 +0000)]
[Statistics] Use the new Statistic::updateMax to atomically calculate a maximum value statistic.

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

7 years agoThe constant expression evaluator should examine function arguments for non-constexpr...
Nick Lewycky [Wed, 17 May 2017 23:56:54 +0000 (23:56 +0000)]
The constant expression evaluator should examine function arguments for non-constexpr function calls unless the EvalInfo says to stop.

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

7 years agoclang-cl: Fix path-based MSVC version detection
Hans Wennborg [Wed, 17 May 2017 15:27:44 +0000 (15:27 +0000)]
clang-cl: Fix path-based MSVC version detection

The code wasn't taking the architecture-specific subdirectory into
account.

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

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

7 years ago[Frontend] Remove unused TemporaryFiles
Krasimir Georgiev [Wed, 17 May 2017 14:51:44 +0000 (14:51 +0000)]
[Frontend] Remove unused TemporaryFiles

Summary:
OnDiskData.TemporaryFiles is filled only by ASTUnit::addTemporaryFile, which is
dead. Also these files are used nowhere in the frontend nor in libclang.

Reviewers: bkramer, ilya-biryukov

Reviewed By: bkramer, ilya-biryukov

Subscribers: cfe-commits

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

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

7 years agoConstify.
Vassil Vassilev [Wed, 17 May 2017 12:09:11 +0000 (12:09 +0000)]
Constify.

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

7 years ago[Lexer] Ensure that the token is not an annotation token when
Alex Lorenz [Wed, 17 May 2017 11:08:36 +0000 (11:08 +0000)]
[Lexer] Ensure that the token is not an annotation token when
retrieving the identifer info for an Objective-C keyword

This commit fixes an assertion that's triggered in getIdentifier when the token
is an annotation token.

rdar://32225463

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

7 years ago[ODRHash] Support NestedNameSpecifier
Richard Trieu [Wed, 17 May 2017 03:23:35 +0000 (03:23 +0000)]
[ODRHash] Support NestedNameSpecifier

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

7 years ago[ODRHash] Support more types in the ODR checker.
Richard Trieu [Wed, 17 May 2017 02:29:02 +0000 (02:29 +0000)]
[ODRHash] Support more types in the ODR checker.

Added support for TagType, TypeWithKeyword, and all children types.

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

7 years ago(1) Fixed mismatch in intrinsics names in declarations and in doxygen comments.
Ekaterina Romanova [Wed, 17 May 2017 01:46:11 +0000 (01:46 +0000)]
(1) Fixed mismatch in intrinsics names in declarations and in doxygen comments.
(2) Removed uncessary anymore \c commands, since the same effect will be achived by <c> ... </c> sequence.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

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

7 years ago[modules] When creating a declaration, cache its owning module immediately
Richard Smith [Wed, 17 May 2017 00:24:14 +0000 (00:24 +0000)]
[modules] When creating a declaration, cache its owning module immediately
rather than waiting until it's queried.

Currently this is only applied to local submodule visibility mode, as we don't
yet allocate storage for the owning module in non-local-visibility modules
compilations.

This reinstates r302965, reverted in r303037, with a fix for the reported
crash, which occurred when reparenting a local declaration to be a child of
a hidden imported declaration (specifically during template instantiation).

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

7 years agoFix scope of namespaced DISubprograms when the function definition is out-of-line.
Adrian Prantl [Tue, 16 May 2017 23:46:10 +0000 (23:46 +0000)]
Fix scope of namespaced DISubprograms when the function definition is out-of-line.
This fixes a regression introduced in r302915.

Using the lexical decl context is not necessary here for what r302915
wast trying to achieve. Not canonicalizing the NamespaceDecl in
getOrCreateNamespace is suficient.

rdar://problem/29339538

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

7 years ago[index] Avoid another crash that happens when looking up a dependent name
Alex Lorenz [Tue, 16 May 2017 17:33:17 +0000 (17:33 +0000)]
[index] Avoid another crash that happens when looking up a dependent name
in a record that has a base without a definition

rdar://32224197

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

7 years ago[Sema] Avoid duplicate -Wunguarded-availability warnings in nested functions
Alex Lorenz [Tue, 16 May 2017 13:58:53 +0000 (13:58 +0000)]
[Sema] Avoid duplicate -Wunguarded-availability warnings in nested functions

rdar://31862310

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

7 years ago[StaticAnalyzer] Move inline counter increaser to inlineCall function
Peter Szecsi [Tue, 16 May 2017 11:54:00 +0000 (11:54 +0000)]
[StaticAnalyzer] Move inline counter increaser to inlineCall function

Even though the shouldInlineCall function returns true, it can happen that the
function is not going to be inlined (as it can be seen at line 913 and below).
Moved the bumpNumTimesInlined(D) (the counter increaser) call to the inlineCall
function where it logically belongs.

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

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

7 years agoFix PR 10758: Infinite recursion when dealing with copy-initialization
Alex Lorenz [Tue, 16 May 2017 10:23:58 +0000 (10:23 +0000)]
Fix PR 10758: Infinite recursion when dealing with copy-initialization

This commit fixes a bug that's tracked by PR 10758 and duplicates like PR 30343.
The bug causes clang to crash with a stack overflow while recursing infinitely
trying to perform copy-initialization on a type without a copy constructor but
with a constructor that accepts another type that can be constructed using the
original type.

The commit fixes this bug by detecting the recursive behavior and failing
correctly with an appropriate error message. It also tries to provide a
meaningful diagnostic note about the constructor which leads to this behavior.

rdar://28483944

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

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

7 years ago[Sema] Use CK_NoOp instead CK_Invalid in tryGCCVectorConvertAndSplat
Vitaly Buka [Mon, 15 May 2017 22:04:03 +0000 (22:04 +0000)]
[Sema] Use CK_NoOp instead CK_Invalid in tryGCCVectorConvertAndSplat

This fix UBSAN bots after r302935. Storing non-defined values in enum is
undefined behavior.

Other places, where "if (ScalarCast != CK_Invalid)" is used, never get to the
"if" with CK_Invalid. tryGCCVectorConvertAndSplat can get to the "if" with
CK_Invalid and it looks like expected case. So we have to use something other
than CK_Invalid, e.g. CK_NoOp.

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

7 years ago[asan] One more test for -fsanitize-address-globals-dead-stripping.
Evgeniy Stepanov [Mon, 15 May 2017 20:43:48 +0000 (20:43 +0000)]
[asan] One more test for -fsanitize-address-globals-dead-stripping.

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

7 years agoclang-format: [JS] for async loops.
Martin Probst [Mon, 15 May 2017 19:33:20 +0000 (19:33 +0000)]
clang-format: [JS] for async loops.

Summary:
JavaScript supports asynchronous loop iteration in async functions:

    for async (const x of y) ...

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[OPENMP] Check DSA for variables captured by value.
Alexey Bataev [Mon, 15 May 2017 16:26:15 +0000 (16:26 +0000)]
[OPENMP] Check DSA for variables captured by value.

Currently clang checks for default data sharing attributes only for
variables captured in OpenMP regions by reference. Patch adds checks for
variables captured by value.

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

7 years ago[OpenCL] Emit function-scope variable in constant address space as static variable
Yaxun Liu [Mon, 15 May 2017 14:47:47 +0000 (14:47 +0000)]
[OpenCL] Emit function-scope variable in constant address space as static variable

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

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

7 years ago[index] References to fields from template instantiations should refer to
Alex Lorenz [Mon, 15 May 2017 14:26:22 +0000 (14:26 +0000)]
[index] References to fields from template instantiations should refer to
fields in base templates

rdar://32197158

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

7 years agoJavaScript allows parameter lists to include trailing commas:
Martin Probst [Mon, 15 May 2017 11:15:29 +0000 (11:15 +0000)]
JavaScript allows parameter lists to include trailing commas:

    myFunction(param1, param2,);

For symmetry with other parenthesized lists ([...], {...}), clang-format should
wrap parenthesized lists one-per-line if they contain a trailing comma:

    myFunction(
        param1,
        param2,
    );

This is particularly useful in function declarations or calls with many
arguments, e.g. commonly in constructors.

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

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

7 years ago[index] Visit and store information about namespace alias declarations
Alex Lorenz [Mon, 15 May 2017 10:56:31 +0000 (10:56 +0000)]
[index] Visit and store information about namespace alias declarations

rdar://32195226

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

7 years ago[index] Store correct location for namespace nested name qualifiers
Alex Lorenz [Mon, 15 May 2017 10:41:04 +0000 (10:41 +0000)]
[index] Store correct location for namespace nested name qualifiers

rdar://32195200

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

7 years ago[index] Avoid a crash that happens when looking up a dependent name
Alex Lorenz [Mon, 15 May 2017 10:20:39 +0000 (10:20 +0000)]
[index] Avoid a crash that happens when looking up a dependent name
in a record that has no definition

rdar://32194921

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

7 years agoclang-format: [JS] fix non-null assertion operator recognition.
Martin Probst [Mon, 15 May 2017 08:15:53 +0000 (08:15 +0000)]
clang-format: [JS] fix non-null assertion operator recognition.

Summary:
`getIdentifierInfo()` includes all keywords, whereas non-null assertion
operators should only be recognized after non-keywords or pseudo keywords.
Ideally this should list all tokens that clang-format recognizes as a keyword,
but that are pseudo or no keywords in JS. For the time being, just recognize
the specific bits users ran into (`namespace` in this case).

Reviewers: djasper

Subscribers: klimek

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

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

7 years agoRevert r302965 - [modules] When creating a declaration, cache its owning
Daniel Jasper [Mon, 15 May 2017 07:51:10 +0000 (07:51 +0000)]
Revert r302965 - [modules] When creating a declaration, cache its owning
module immediately

Also revert dependent r302969. This is leading to crashes.
Will provide more details reproduction instructions to Richard.

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

7 years ago[DOXYGEN] Minor improvements in doxygen comments.
Ekaterina Romanova [Mon, 15 May 2017 03:25:04 +0000 (03:25 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.

Separated very long brief sections into two sections.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

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

7 years agoSilence buildbots by tweaking an IR codegen test to be less specific w register names.
Faisal Vali [Mon, 15 May 2017 02:56:02 +0000 (02:56 +0000)]
Silence buildbots by tweaking an IR codegen test to be less specific w register names.

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

7 years ago[NFC] Remove some comments (IR aid) from a test file erroneous committed in r303026
Faisal Vali [Mon, 15 May 2017 01:54:02 +0000 (01:54 +0000)]
[NFC] Remove some comments (IR aid) from a test file erroneous committed in r303026

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

7 years agoFix PR32933: crash on lambda capture of VLA
Faisal Vali [Mon, 15 May 2017 01:49:19 +0000 (01:49 +0000)]
Fix PR32933: crash on lambda capture of VLA

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

Turns out clang wasn't really handling vla's (*) in C++11's for-range entirely correctly.

For e.g. This would lead to generation of buggy IR:

  void foo(int b) {
    int vla[b];
    b = -1;  // This store would affect the '__end = vla + b'
    for (int &c : vla)
      c = 0;
  }

Additionally, code-gen would get confused when VLA's were reference-captured by lambdas, and then used in a for-range, which would result in an attempt to generate IR for '__end = vla + b' within the lambda's body - without any capture of 'b' - hence the assertion.

This patch modifies clang, so that for VLA's it translates the end pointer approximately into:
  __end = __begin + sizeof(vla)/sizeof(vla->getElementType())

As opposed to the __end = __begin + b;

I considered passing a magic value into codegen - or having codegen special case the '__end' variable when it referred to a variably-modified type, but I decided against that approach, because it smelled like I would be increasing a complicated form of coupling, that I think would be even harder to maintain than the above approach (which can easily be optimized (-O1) to refer to the run-time bound that was calculated upon array's creation or copied into the lambda's closure object).

(*) why oh why gcc would you enable this by default?! ;)

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

7 years ago[ASTImporter] Improve handling of incomplete types
Sean Callanan [Sat, 13 May 2017 00:46:33 +0000 (00:46 +0000)]
[ASTImporter] Improve handling of incomplete types

ASTImporter has some bugs when it's importing types
that themselves come from an ExternalASTSource. This
is exposed particularly in the behavior when
comparing complete TagDecls with forward
declarations. This patch does several things:

- Adds a test case making sure that conflicting
  forward-declarations are resolved correctly;
- Extends the clang-import-test harness to test
  two-level importing, so that we make sure we
  complete types when necessary; and
- Fixes a few bugs I found this way. Failure to
  complete types was one; however, I also discovered
  that complete RecordDecls aren't properly added to
  the redecls chain for existing forward
  declarations.

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

7 years agoAdd LangOptions method to query whether we are tracking the owning module for a local...
Richard Smith [Sat, 13 May 2017 00:00:16 +0000 (00:00 +0000)]
Add LangOptions method to query whether we are tracking the owning module for a local declaration.

In preparation for expanding this behavior to cover additional cases.

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

7 years agoRemove unused tracking of owning module for MacroInfo objects.
Richard Smith [Fri, 12 May 2017 23:40:52 +0000 (23:40 +0000)]
Remove unused tracking of owning module for MacroInfo objects.

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

7 years ago[modules] When creating a declaration, cache its owning module immediately
Richard Smith [Fri, 12 May 2017 23:27:00 +0000 (23:27 +0000)]
[modules] When creating a declaration, cache its owning module immediately
rather than waiting until it's queried.

Currently this is only applied to local submodule visibility mode, as we don't
yet allocate storage for the owning module in non-local-visibility modules
compilations.

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

7 years agoRevert r302932, as it appears to be breaking stage2 for some of our modules-enabled...
Richard Smith [Fri, 12 May 2017 20:42:54 +0000 (20:42 +0000)]
Revert r302932, as it appears to be breaking stage2 for some of our modules-enabled buildbots.

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

7 years ago[Sema] Silence buildbot failures introduced by r302935
Simon Dardis [Fri, 12 May 2017 19:55:32 +0000 (19:55 +0000)]
[Sema] Silence buildbot failures introduced by r302935

Attempt to silence buildbot failures by pinning the test to a given
triple rather than the host's triple.

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

7 years agoRemove ignore-empty-index-file option
Teresa Johnson [Fri, 12 May 2017 19:32:17 +0000 (19:32 +0000)]
Remove ignore-empty-index-file option

Summary:
Clang changes to remove this option and replace with a parameter
always set in the context of a ThinLTO distributed backend.

Depends on D33133.

Reviewers: pcc

Subscribers: mehdi_amini, eraman, cfe-commits

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

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

7 years ago[Sema] Support implicit scalar to vector conversions
Simon Dardis [Fri, 12 May 2017 19:11:06 +0000 (19:11 +0000)]
[Sema] Support implicit scalar to vector conversions

This patch teaches clang to perform implicit scalar to vector conversions
when one of the operands of a binary vector expression is a scalar which
can be converted to the element type of the vector without truncation
following GCC's implementation.

If the (constant) scalar is can be casted safely, it is implicitly casted to the
vector elements type and splatted to produce a vector of the same type.

Contributions from: Petar Jovanovic

Reviewers: bruno, vkalintiris

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

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

7 years ago[modules] Simplify module macro handling in non-local-submodule-visibility mode.
Richard Smith [Fri, 12 May 2017 18:56:03 +0000 (18:56 +0000)]
[modules] Simplify module macro handling in non-local-submodule-visibility mode.

When reaching the end of a module, we used to convert its macros to
ModuleMacros but also leave them in the MacroDirective chain for the
identifier. This meant that every lookup of such a macro would find two
(identical) definitions. It also made it difficult to determine the correct
owner for a macro when reaching the end of a module: the most recent
MacroDirective in the chain could be from an #included submodule rather than
the current module.

Simplify this: whenever we convert a MacroDirective to a ModuleMacro when
leaving a module, clear out the MacroDirective chain for that identifier, and
just rely on the ModuleMacro to provide the macro definition information.

(We don't want to do this for local submodule visibility mode, because in that
mode we maintain a distinct MacroDirective chain for each submodule, and we
need to keep around the prior MacroDirective in case we re-enter the submodule
-- for instance, if its header is #included more than once in a module build,
we need the include guard directive to stick around. But the problem doesn't
arise in this case for the same reason: each submodule has its own
MacroDirective chain, so the macros don't leak out of submodules in the first
place.)

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

7 years ago[index] Index template specialization arguments for function templats
Alex Lorenz [Fri, 12 May 2017 16:32:26 +0000 (16:32 +0000)]
[index] Index template specialization arguments for function templats

Also ensure that class template specialization arguments are covered

rdar://31812032

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

7 years agoSimplify DINamespace caching in CGDebugInfo
Adrian Prantl [Fri, 12 May 2017 16:23:53 +0000 (16:23 +0000)]
Simplify DINamespace caching in CGDebugInfo

This addresses review feedback from r302840.

By not canonicalizing namespace decls and using lexical decl context
instead of lookuing up the semantic decl context we can take advantage
of the fact that DINamespaces a reuniqued. This way non-module debug
info is unchanged and module debug info still gets distinct namespace
declarations when they ocur in different modules.

Thanks to Richard Smith for pointing this out!

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

7 years ago[SPARC] Support 'f' and 'e' inline asm constraints.
James Y Knight [Fri, 12 May 2017 16:01:23 +0000 (16:01 +0000)]
[SPARC] Support 'f' and 'e' inline asm constraints.

Patch by Patrick Boettcher.

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

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

7 years agoEnabling the /bigobj flag for SemaDeclAttr.cpp.
Aaron Ballman [Fri, 12 May 2017 14:30:49 +0000 (14:30 +0000)]
Enabling the /bigobj flag for SemaDeclAttr.cpp.

This resolves compile errors with MSVC 2015 x64 debug builds where SemaDeclAttr.cpp is hitting the section symbol limit.

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

7 years ago[Hexagon] Make sure to pass empty struct arguments with nontrivial ctors
Krzysztof Parzyszek [Fri, 12 May 2017 13:18:07 +0000 (13:18 +0000)]
[Hexagon] Make sure to pass empty struct arguments with nontrivial ctors

Thanks to Richard Smith for the suggested fix.

This fixes llvm.org/PR33009

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

7 years agoclang-format: [JS] support non-null assertions after all identifiers.
Martin Probst [Fri, 12 May 2017 13:00:33 +0000 (13:00 +0000)]
clang-format: [JS] support non-null assertions after all identifiers.

Summary:
Previously:
    x = namespace !;

Now:
    x = namespace!;

Reviewers: djasper

Subscribers: klimek

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

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

7 years agoFix an assertion failure (PR33020).
Alexander Kornienko [Fri, 12 May 2017 11:24:25 +0000 (11:24 +0000)]
Fix an assertion failure (PR33020).

Adding a test separately (tools/extra/test/clang-tidy/misc-use-after-move.cpp).

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

7 years ago[analyzer] Add modelling of __builtin_assume
Gabor Horvath [Fri, 12 May 2017 07:02:54 +0000 (07:02 +0000)]
[analyzer] Add modelling of __builtin_assume

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

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

7 years ago[analyzer] Avoid an allocation in Std C function modelling
Gabor Horvath [Fri, 12 May 2017 06:53:55 +0000 (06:53 +0000)]
[analyzer] Avoid an allocation in Std C function modelling

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

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

7 years ago[tooling] RefactoringCallbacks code cleanup
Alexander Shaposhnikov [Fri, 12 May 2017 00:16:56 +0000 (00:16 +0000)]
[tooling] RefactoringCallbacks code cleanup

This diff
 1. adds missing "explicit" for single argument constructors
 2. adds missing std::move in ReplaceNodeWithTemplate constructor

Test plan: make check-all

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

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

7 years agoFix uninitialized bool read causing x86_64-mno-sse.c test failure
Reid Kleckner [Fri, 12 May 2017 00:10:49 +0000 (00:10 +0000)]
Fix uninitialized bool read causing x86_64-mno-sse.c test failure

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

7 years agoRemove unnecessary mapping from SourceLocation to Module.
Richard Smith [Thu, 11 May 2017 23:11:16 +0000 (23:11 +0000)]
Remove unnecessary mapping from SourceLocation to Module.

When we parse a redefinition of an entity for which we have a hidden existing
declaration, make it visible in the current module instead of mapping the
current source location to its containing module.

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

7 years agoModule Debug Info: Emit namespaced C++ forward decls in the correct module.
Adrian Prantl [Thu, 11 May 2017 22:59:19 +0000 (22:59 +0000)]
Module Debug Info: Emit namespaced C++ forward decls in the correct module.

The AST merges NamespaceDecls, but for module debug info it is
important to put a namespace decl (or rather its children) into the
correct (sub-)module, so we need to use the parent module of the decl
that triggered this namespace to be serialized as a second key when
looking up DINamespace nodes.

rdar://problem/29339538

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

7 years agoIssue diagnostics when returning FP values on x86_64 without SSE1/2
Reid Kleckner [Thu, 11 May 2017 22:43:02 +0000 (22:43 +0000)]
Issue diagnostics when returning FP values on x86_64 without SSE1/2

Avoid using report_fatal_error, because it will ask the user to file a
bug. If the user attempts to disable SSE on x86_64 and them use floating
point, that's a bug in their code, not a bug in the compiler.

This is just a start. There are other ways to crash the backend in this
configuration, but they should be updated to follow this pattern.

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

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

7 years agoXFAIL this test for Hexagon.
Richard Smith [Thu, 11 May 2017 21:18:27 +0000 (21:18 +0000)]
XFAIL this test for Hexagon.

It's failing due to Hexagon calling convention lowering being broken (empty
structs are not passed even if they have nontrivial destructors / copy ctors).

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

7 years agoWork around different -std= default for PS4 target.
Richard Smith [Thu, 11 May 2017 19:17:54 +0000 (19:17 +0000)]
Work around different -std= default for PS4 target.

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

7 years agoPR22877: When constructing an array via a constructor with a default argument
Richard Smith [Thu, 11 May 2017 18:58:24 +0000 (18:58 +0000)]
PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

Re-commit of r302750, reverted in r302776.

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

7 years agoAdd a test that local submodule visibility has no effect on debug info
Adrian Prantl [Thu, 11 May 2017 16:40:48 +0000 (16:40 +0000)]
Add a test that local submodule visibility has no effect on debug info

rdar://problem/27876262

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

7 years ago[CodeCompletion] Provide member completions for dependent expressions whose
Alex Lorenz [Thu, 11 May 2017 13:48:57 +0000 (13:48 +0000)]
[CodeCompletion] Provide member completions for dependent expressions whose
type is a TemplateSpecializationType or InjectedClassNameType

Fixes PR30847. Partially fixes PR20973 (first position only).

PR17614 is still not working, its expression has the dependent
builtin type. We'll have to teach the completion engine how to "resolve"
dependent expressions to fix it.

rdar://29818301

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

7 years ago[CodeCompletion] NFC, extract a function that generates member
Alex Lorenz [Thu, 11 May 2017 13:41:00 +0000 (13:41 +0000)]
[CodeCompletion] NFC, extract a function that generates member
completion results for records

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

7 years agoFix two-stage build on windows using DistributionExample cmake cache
NAKAMURA Takumi [Thu, 11 May 2017 13:19:24 +0000 (13:19 +0000)]
Fix two-stage build on windows using DistributionExample cmake cache

Thanks to Matthew Larionov <matthewtff@gmail.com>

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

7 years agoReverted r302775
Serge Pavlov [Thu, 11 May 2017 08:25:22 +0000 (08:25 +0000)]
Reverted r302775

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

7 years agoRevert "PR22877: When constructing an array via a constructor with a default argument...
Diana Picus [Thu, 11 May 2017 08:10:41 +0000 (08:10 +0000)]
Revert "PR22877: When constructing an array via a constructor with a default argument in list-initialization, run cleanups for the default argument after each iteration of the initialization loop."

Revert "clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc."

This reverts commit r302750 and its fixup r302757 because the test is
still breaking on some of the ARM bots.

array-default-argument.cpp:20:12: error: expected string not found in input
 // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void @_ZN1AC1Ev([[TEMPORARY:.*]])
           ^
<stdin>:18:1: note: scanning from here
arrayctor.loop: ; preds = %arrayctor.loop, %entry
^
<stdin>:28:2: note: possible intended match here
 call void @_Z1fv()
 ^

--

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

7 years agoDriver must return non-zero code on errors in command line
Serge Pavlov [Thu, 11 May 2017 08:00:33 +0000 (08:00 +0000)]
Driver must return non-zero code on errors in command line

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

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

7 years agoMake tests from r302765 windows friendly
Bruno Cardoso Lopes [Thu, 11 May 2017 07:06:52 +0000 (07:06 +0000)]
Make tests from r302765 windows friendly

and appease:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2030

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

7 years ago[Sema] Improve redefinition errors pointing to the same header
Bruno Cardoso Lopes [Thu, 11 May 2017 06:20:07 +0000 (06:20 +0000)]
[Sema] Improve redefinition errors pointing to the same header

Diagnostics related to redefinition errors that point to the same header
file do not provide much information that helps users fixing the issue.

- In the modules context, it usually happens because of non modular
includes.
- When modules aren't involved it might happen because of the lack of
header guards.

Enhance diagnostics in these scenarios.

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

rdar://problem/31669175

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

7 years agoPrune unused \param(s) of clang::Parser::ParseTemplateIdAfterTemplateName() in r30273...
NAKAMURA Takumi [Thu, 11 May 2017 02:43:47 +0000 (02:43 +0000)]
Prune unused \param(s) of clang::Parser::ParseTemplateIdAfterTemplateName() in r302737. [-Wdocumentation]

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

7 years agoclang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thisc...
NAKAMURA Takumi [Thu, 11 May 2017 02:39:30 +0000 (02:39 +0000)]
clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc.

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

7 years agoPR22877: When constructing an array via a constructor with a default argument
Richard Smith [Thu, 11 May 2017 00:17:17 +0000 (00:17 +0000)]
PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

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

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