]> granicus.if.org Git - clang/log
clang
8 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:53:31 +0000 (18:53 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

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

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

8 years agoRevert r280516 since it contained accidental changes.
Eric Fiselier [Fri, 2 Sep 2016 18:43:25 +0000 (18:43 +0000)]
Revert r280516 since it contained accidental changes.

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

8 years agoBased on post-commit feedback over IRC with dblaikie, ideally, we should have a Small...
Aaron Ballman [Fri, 2 Sep 2016 18:31:31 +0000 (18:31 +0000)]
Based on post-commit feedback over IRC with dblaikie, ideally, we should have a SmallVector constructor that accepts anything which can supply a range via ADL begin()/end() calls so that we can construct the SmallVector directly from anything range-like.

Since that doesn't exist right now, use a local variable instead of calling getAssocExprs() twice; NFC.

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

8 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:25:29 +0000 (18:25 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

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

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

8 years agoclang-format: [JS] merge requoting replacements.
Martin Probst [Fri, 2 Sep 2016 14:29:48 +0000 (14:29 +0000)]
clang-format: [JS] merge requoting replacements.

Summary:
When formatting source code that needs both requoting and reindentation,
merge the replacements to avoid erroring out for conflicting replacements.

Also removes the misleading Replacements parameter from the
TokenAnalyzer API.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoclang-format: [JS] handle default bindings in imports.
Martin Probst [Fri, 2 Sep 2016 14:06:32 +0000 (14:06 +0000)]
clang-format: [JS] handle default bindings in imports.

Summary:
Default imports appear outside of named bindings in curly braces:

  import A from 'a';
  import A, {symbol} from 'a';

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoclang-format: [JS] Sort all JavaScript imports if any changed.
Martin Probst [Fri, 2 Sep 2016 14:01:17 +0000 (14:01 +0000)]
clang-format: [JS] Sort all JavaScript imports if any changed.

Summary:
User feedback is that they expect *all* imports to be sorted if any import was
affected by a change, not just imports up to the first non-affected line, as
clang-format currently does.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoAllow a C11 generic selection expression to select a function with the overloadable...
Aaron Ballman [Fri, 2 Sep 2016 13:45:40 +0000 (13:45 +0000)]
Allow a C11 generic selection expression to select a function with the overloadable attribute as the result expression without crashing. This fixes PR30201.

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

8 years agoClean up handling of reading module files from stdin. Don't bother trying to
Richard Smith [Fri, 2 Sep 2016 00:18:05 +0000 (00:18 +0000)]
Clean up handling of reading module files from stdin. Don't bother trying to
look for a corresponding file, since we're not going to read it anyway.

No observable behavior change (though we now avoid pointlessly trying to stat
or open a file named "-").

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

8 years agoRefactor to avoid holding a reference to a container element that could go away
Richard Smith [Fri, 2 Sep 2016 00:10:28 +0000 (00:10 +0000)]
Refactor to avoid holding a reference to a container element that could go away
during this function, and to avoid rolling back changes to the module manager's
data structures. Instead, we defer registering the module file until after we
have successfully finished loading it.

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

8 years agoRemove excessive padding from MismatchingNewDeleteDetector
Alexander Shaposhnikov [Thu, 1 Sep 2016 23:18:00 +0000 (23:18 +0000)]
Remove excessive padding from MismatchingNewDeleteDetector

The class MismatchingNewDeleteDetector is in
lib/Sema/SemaExprCXX.cpp inside the anonymous namespace.
This diff reorders the fields and removes the excessive padding.
Test plan: make -j8 check-clang

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

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

8 years ago[WebAssembly] Change wasm SizeType to match asmjs
Derek Schuff [Thu, 1 Sep 2016 22:38:37 +0000 (22:38 +0000)]
[WebAssembly] Change wasm SizeType to match asmjs

Summary:
We want wasm and asmjs to have matching ABIs, and right now asmjs uses
unsigned int for its size_t. This causes exported symbols in libcxx to
not match and can cause weird breakage where libcxx doesn't get linked
as a result.  Long-term we probably want wasm32, wasm64, and asmjs to
all use unsigned long, but that would cause unnecessary ABI churn for
asmjs so defer that until we can make all the ABI changes at once.

Patch by Jacob Gravelle

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

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

8 years agoWhen we reach the end of a #include of a header of a local submodule that we
Richard Smith [Thu, 1 Sep 2016 20:15:25 +0000 (20:15 +0000)]
When we reach the end of a #include of a header of a local submodule that we
textually included, create an ImportDecl just as we would if we reached a
#include of any other modular header. This is necessary in order to correctly
determine the set of variables to initialize for an imported module.

This should hopefully make the modules selfhost buildbot green again.

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

8 years ago[CMake] Properly connecting Compiler-RT check and test-depends
Chris Bieneman [Thu, 1 Sep 2016 18:28:49 +0000 (18:28 +0000)]
[CMake] Properly connecting Compiler-RT check and test-depends

This correctly connects compiler-rt-test-depends to test-depends and
check-compiler-rt to check-all.

Based on LLVM r280392, and Compiler-RT r280393.

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

8 years ago[analyzer] ExprEngine: remove second call to PreStmt<CastExpr>
Aleksei Sidorin [Thu, 1 Sep 2016 13:55:38 +0000 (13:55 +0000)]
[analyzer] ExprEngine: remove second call to PreStmt<CastExpr>

This patch also introduces AnalysisOrderChecker which is intended for testing
of callback call correctness.

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

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

8 years ago[analyzer] Add more FileIDs to PlistDiagnostic map to avoid assertion
Aleksei Sidorin [Thu, 1 Sep 2016 12:25:16 +0000 (12:25 +0000)]
[analyzer] Add more FileIDs to PlistDiagnostic map to avoid assertion

Some FileIDs that may be used by PlistDiagnostics were not added while building
a list of pieces. This caused assertion violation in GetFID() function.
This patch adds some missing FileIDs to avoid the assertion. It also contains
small refactoring of PlistDiagnostics::FlushDiagnosticsImpl().

Patch by Aleksei Sidorin, Ilya Palachev.

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

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

8 years ago[Frontend] Fix mcount inlining bug
Honggyu Kim [Thu, 1 Sep 2016 11:29:21 +0000 (11:29 +0000)]
[Frontend] Fix mcount inlining bug

Since some profiling tools, such as gprof, ftrace, and uftrace, use
-pg option to generate a mcount function call at the entry of each
function. Function invocation can be detected by this hook function.

But mcount insertion is done before function inlining phase in clang,
sometime a function that already has a mcount call can be inlined in the
middle of another function.

This patch adds an attribute "counting-function" to each function
rather than emitting the mcount call directly in frontend so that this
attribute can be processed in backend. Then the mcount calls can be
properly inserted in backend after all the other optimizations are
completed.

Link: https://llvm.org/bugs/show_bug.cgi?id=28660
Reviewers: hans, rjmccall, hfinkel, rengolin, compnerd

Subscribers: shenhan, cfe-commits

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

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

8 years ago[analyzer][test commit] ExprEngine.cpp: Remove training whitespace; NFC
Aleksei Sidorin [Thu, 1 Sep 2016 11:11:46 +0000 (11:11 +0000)]
[analyzer][test commit] ExprEngine.cpp: Remove training whitespace; NFC

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

8 years agoRemove whitespace to test commit access
Honggyu Kim [Thu, 1 Sep 2016 06:14:45 +0000 (06:14 +0000)]
Remove whitespace to test commit access

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

8 years agoFix typos in comments.
George Burgess IV [Thu, 1 Sep 2016 01:26:58 +0000 (01:26 +0000)]
Fix typos in comments.

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

8 years ago[Sema] Don't diagnose an array type mismatch when the new or previous
Akira Hatanaka [Thu, 1 Sep 2016 01:03:21 +0000 (01:03 +0000)]
[Sema] Don't diagnose an array type mismatch when the new or previous
declaration has a dependent type.

This fixes a bug where clang errors out on a valid code.

rdar://problem/28051467

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

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

8 years agoFix all tests under test/CXX (and test/Analysis) to pass if clang's default
Richard Smith [Wed, 31 Aug 2016 23:24:08 +0000 (23:24 +0000)]
Fix all tests under test/CXX (and test/Analysis) to pass if clang's default
C++ language standard is not C++98.

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

8 years agoDR259: Demote the pedantic error for an explicit instantiation after an
Richard Smith [Wed, 31 Aug 2016 23:23:25 +0000 (23:23 +0000)]
DR259: Demote the pedantic error for an explicit instantiation after an
explicit specialization to a warning for C++98 mode (this is a defect report
resolution, so per our informal policy it should apply in C++98), and turn
the warning on by default for C++11 and later. In all cases where it fires, the
right thing to do is to remove the pointless explicit instantiation.

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

8 years agoAdd -fprofile-dir= to clang.
Nick Lewycky [Wed, 31 Aug 2016 23:04:32 +0000 (23:04 +0000)]
Add -fprofile-dir= to clang.

-fprofile-dir=path allows the user to specify where .gcda files should be
emitted when the program is run. In particular, this is the first flag that
causes the .gcno and .o files to have different paths, LLVM is extended to
support this. -fprofile-dir= does not change the file name in the .gcno (and
thus where lcov looks for the source) but it does change the name in the .gcda
(and thus where the runtime library writes the .gcda file). It's different from
a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip
paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and
-coverage-notes-file to specify the two different names. The !llvm.gcov
metadata node grows from a 2-element form {string coverage-file, node dbg.cu}
to 3-elements, {string coverage-notes-file, string coverage-data-file, node
dbg.cu}. In the 3-element form, the file name is already "mangled" with
.gcno/.gcda suffixes, while the 2-element form left that to the middle end
pass.

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

8 years agoDebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining
David Blaikie [Wed, 31 Aug 2016 20:54:35 +0000 (20:54 +0000)]
DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining

I tested the cases involving split-dwarf + gmlt +
no-split-dwarf-inlining, but didn't verify the simpler case without
gmlt.

The logic is, admittedly, a little hairy, but seems about as simple as I
could wrangle it.

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

8 years agoDon't diagnoes a mismatch between implicit and explicit exception
Richard Smith [Wed, 31 Aug 2016 20:38:32 +0000 (20:38 +0000)]
Don't diagnoes a mismatch between implicit and explicit exception
specifications under -fno-exceptions, just as we don't diagnose other exception
specification mismatch errors.

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

8 years agoFix mishandling of deletedness for assignment operators of classes with
Richard Smith [Wed, 31 Aug 2016 20:37:39 +0000 (20:37 +0000)]
Fix mishandling of deletedness for assignment operators of classes with
indirect virtual bases. We don't need to be able to invoke such an assignment
operator from the derived class, and we shouldn't delete the derived assignment
op if we can't do so.

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

8 years ago[codeview] Don't emit vshape info for classes without vfptrs
Reid Kleckner [Wed, 31 Aug 2016 20:35:01 +0000 (20:35 +0000)]
[codeview] Don't emit vshape info for classes without vfptrs

Classes with no virtual methods or whose virtual methods were all
inherited from virtual bases don't have a vfptr at offset zero. We were
crashing attempting to get the layout of that non-existent vftable.

We don't need any vshape info in this case because the debugger can
infer it from the base class information. The current class may not
introduce any virtual methods if we are in this situation.

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

8 years agoRevert "Driver: use the canonical static library naming"
Saleem Abdulrasool [Wed, 31 Aug 2016 19:27:07 +0000 (19:27 +0000)]
Revert "Driver: use the canonical static library naming"

This breaks chromium and its unclear if this is actually a modern convention.

This reverts SVN r280169.

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

8 years agoFix a typo in a comment.
George Burgess IV [Wed, 31 Aug 2016 18:14:15 +0000 (18:14 +0000)]
Fix a typo in a comment.

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

8 years agos/static inline/static/ for headers I have changed in r279475. NFC.
Tim Shen [Wed, 31 Aug 2016 16:48:13 +0000 (16:48 +0000)]
s/static inline/static/ for headers I have changed in r279475. NFC.

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

8 years ago[codeview] Pass through vftable shape information
Reid Kleckner [Wed, 31 Aug 2016 16:11:43 +0000 (16:11 +0000)]
[codeview] Pass through vftable shape information

The shape is really just the number of methods in the vftable, since we
don't support 16 bit far calls. All calls are near. Encode this number
in the size of the artificial __vtbl_ptr_type DIDerivedType that we
generate. For DWARF, this will be a normal pointer, but for codeview
this will be a wide pointer that gets pattern matched into a
VFTableShape record. Insert this type into the element list of all
dynamic classes when emitting CodeView, so that the backend can emit the
shape even if the vptr lives in a primary base class.

Fixes PR28150

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

8 years agoclang-format: Set default WebKit style to use C++11.
Daniel Jasper [Wed, 31 Aug 2016 14:05:56 +0000 (14:05 +0000)]
clang-format: Set default WebKit style to use C++11.

The WebKit style page says to use nullptr, so this should be fine:
https://webkit.org/code-style-guidelines/

This fixes: llvm.org/PR30220

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

8 years ago[clang-format-vim] Support vim linked against py3
Luke Drummond [Wed, 31 Aug 2016 13:36:36 +0000 (13:36 +0000)]
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 and Arch.

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

Subscribers: cfe-commits

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

8 years agoRevision r280064 adds new options -fdenormal-fp-math and passes through option
Sjoerd Meijer [Wed, 31 Aug 2016 12:31:03 +0000 (12:31 +0000)]
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

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

8 years agoAttempt to pacify buildbots after r280217
James Molloy [Wed, 31 Aug 2016 11:01:41 +0000 (11:01 +0000)]
Attempt to pacify buildbots after r280217

These clang tests check diagnostics from the backend by giving it an unvectorizable loop. This loop is now vectorized :/

Make it really unvectorizable by making it unprofitable to ifconvert.

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

8 years ago[Coverage] Suppress creating a code region if the same area is covered by an expansio...
Igor Kudrin [Wed, 31 Aug 2016 07:04:16 +0000 (07:04 +0000)]
[Coverage] Suppress creating a code region if the same area is covered by an expansion region.

In most cases these code regions are just redundant, but sometimes they
could be assigned to the counter of the parent code region instead of
the counter of the nested block.

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

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

8 years ago[AVX-512] Implement masked floating point logical operations with native IR and remov...
Craig Topper [Wed, 31 Aug 2016 05:38:58 +0000 (05:38 +0000)]
[AVX-512] Implement masked floating point logical operations with native IR and remove the builtins.

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

8 years ago[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.
Craig Topper [Wed, 31 Aug 2016 05:38:55 +0000 (05:38 +0000)]
[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.

These will be reused when removing some builtins from avx512vldqintrin.h and this will make the tests for that change show a better number of vector elements.

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

8 years agoPR12298 et al: don't recursively instantiate a template specialization from
Richard Smith [Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)]
PR12298 et al: don't recursively instantiate a template specialization from
within the instantiation of that same specialization. This could previously
happen for eagerly-instantiated function templates, variable templates,
exception specifications, default arguments, and a handful of other cases.

We still have an issue here for default template arguments that recursively
make use of themselves and likewise for substitution into the type of a
non-type template parameter, but in those cases we're producing a different
entity each time, so they should instead be caught by the instantiation depth
limit. However, currently we will typically run out of stack before we reach
it. :(

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

8 years agoConcatenate two FileCheck lines in a test.
Richard Trieu [Wed, 31 Aug 2016 01:57:12 +0000 (01:57 +0000)]
Concatenate two FileCheck lines in a test.

'cc1' is a valid sequence of hexadecimal and sometimes can occur in the path
when testing.  This can lead to FileCheck matching the incorrect occurance
of the 'cc1' string and causing a test failure.  Join two adjacent flags
together into one check to prevent this.

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

8 years agoclangTooling: Update libdeps: LLVMOptions, since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:32 +0000 (00:46 +0000)]
clangTooling: Update libdeps: LLVMOptions, since r280118.

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

8 years agoclangTooling depends on ClangDriverOptions since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:25 +0000 (00:46 +0000)]
clangTooling depends on ClangDriverOptions since r280118.

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

8 years agoDon't try to run a test that generates code for x86 if it's not a registered target.
Richard Smith [Tue, 30 Aug 2016 23:53:34 +0000 (23:53 +0000)]
Don't try to run a test that generates code for x86 if it's not a registered target.

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

8 years ago[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker
Devin Coughlin [Tue, 30 Aug 2016 23:07:14 +0000 (23:07 +0000)]
[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker

Fix a crash when relexing the underlying memory buffer to find incorrect
arguments to NSLocalizedString(). With precompiled headers, the raw
buffer may be NULL. Instead, use the source manager to get the buffer,
which will lazily create the buffer for precompiled headers.

rdar://problem/27429091

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

8 years agoDriver: use the canonical static library naming
Saleem Abdulrasool [Tue, 30 Aug 2016 22:10:27 +0000 (22:10 +0000)]
Driver: use the canonical static library naming

On Windows, static libraries are named lib<name>.lib while import libraries are
named <name>.lib.  Use the appropriate naming on itanium and msvc environments.
This is setup properly so that if a dynamic builtins is used on Windows, it
would do the right thing, although this is not currently wired through the
driver (i.e. there is no equivalent to -{shared,static}-gcc).

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

8 years agoclang-format: Correctly calculate affected ranges when sorting #includes.
Daniel Jasper [Tue, 30 Aug 2016 21:33:41 +0000 (21:33 +0000)]
clang-format: Correctly calculate affected ranges when sorting #includes.

affectedRanges takes a start and an end offset, not offset and length.

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

8 years ago[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
Bruno Cardoso Lopes [Tue, 30 Aug 2016 21:25:42 +0000 (21:25 +0000)]
[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.

This adds support for modules that require (no-)gnu-inline-asm
environment, such as the compiler builtin cpuid submodule.

This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871

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

rdar://problem/26931199

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

8 years agoFix memory leak by storing returned pointer in std::unique_ptr
Richard Trieu [Tue, 30 Aug 2016 21:12:48 +0000 (21:12 +0000)]
Fix memory leak by storing returned pointer in std::unique_ptr

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

8 years ago[test] Pass a fake libLTO.dylib to a driver test which depends on it
Vedant Kumar [Tue, 30 Aug 2016 20:36:50 +0000 (20:36 +0000)]
[test] Pass a fake libLTO.dylib to a driver test which depends on it

This makes it possible to run 'check-clang' on Darwin without building
libLTO.dylib. See r280142 for more context.

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

8 years agoRevert "[test] Add libLTO as a clang test dependency on Darwin"
Vedant Kumar [Tue, 30 Aug 2016 20:36:48 +0000 (20:36 +0000)]
Revert "[test] Add libLTO as a clang test dependency on Darwin"

This reverts commit r280142. Mehdi suggested a better way to fix up the
test: just create a fake libLTO.dylib and tell the driver where to find
it. Patch incoming...

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

8 years ago[test] Add libLTO as a clang test dependency on Darwin
Vedant Kumar [Tue, 30 Aug 2016 19:57:40 +0000 (19:57 +0000)]
[test] Add libLTO as a clang test dependency on Darwin

Running 'check-clang' on a stock checkout of llvm+clang doesn't work on
Darwin, because test/Driver/darwin-ld-lto.c can't find libLTO.dylib. Add
libLTO as a clang test dependency on Darwin to fix the problem.

Note: We don't have this issue with check-all because libLTO is in the
test-depends target.

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

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

8 years agoPR29166: when merging declarations with typedef names for linkage purposes,
Richard Smith [Tue, 30 Aug 2016 19:13:18 +0000 (19:13 +0000)]
PR29166: when merging declarations with typedef names for linkage purposes,
don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

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

8 years agoUnrevert r280035 now that the clang-cl bug it exposed has been fixed by
Richard Smith [Tue, 30 Aug 2016 19:06:26 +0000 (19:06 +0000)]
Unrevert r280035 now that the clang-cl bug it exposed has been fixed by
r280133. Original commit message:

C++ Modules TS: driver support for building modules.

This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

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

8 years agoPR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.
Richard Smith [Tue, 30 Aug 2016 18:55:16 +0000 (18:55 +0000)]
PR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.

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

8 years agotypo + indentation [NFC]
Etienne Bergeron [Tue, 30 Aug 2016 18:38:25 +0000 (18:38 +0000)]
typo + indentation [NFC]

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

8 years agoBasic/Targets.cpp: Add polaris10 and polaris11 gpus
Niels Ole Salscheider [Tue, 30 Aug 2016 18:00:22 +0000 (18:00 +0000)]
Basic/Targets.cpp: Add polaris10 and polaris11 gpus

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

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

8 years agoFix colored diagnostics from tools
Olivier Goffart [Tue, 30 Aug 2016 17:42:29 +0000 (17:42 +0000)]
Fix colored diagnostics from tools

r271042 changed the way the diagnostic arguments are parsed. It assumes that
the diagnostics options were already parsed by the "Driver".
For tools using clang::Tooling, the diagnostics argument were not parsed.

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

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

8 years agoDisable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targe...
NAKAMURA Takumi [Tue, 30 Aug 2016 15:38:18 +0000 (15:38 +0000)]
Disable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targeting mingw32. It crashes. Investigating.

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

8 years ago[OpenCL] Make is_valid_event, create_user_event overloadable.
Alexey Bader [Tue, 30 Aug 2016 14:42:54 +0000 (14:42 +0000)]
[OpenCL] Make is_valid_event, create_user_event overloadable.

Summary: Make is_valid_event and create_user_event overloadable like other built-ins.

Patch by Evgeniy Tyurin.

Reviewers: bader, yaxunl

Subscribers: Anastasia, cfe-commits

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

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

8 years agoFix typo in comment
Nico Weber [Tue, 30 Aug 2016 14:24:28 +0000 (14:24 +0000)]
Fix typo in comment

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

8 years ago[Hexagon] Use handleTargetFeaturesGroup to process target-specific features
Krzysztof Parzyszek [Tue, 30 Aug 2016 14:17:10 +0000 (14:17 +0000)]
[Hexagon] Use handleTargetFeaturesGroup to process target-specific features

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

8 years agoRevert r280035 (and followups r280057, r280085), it caused PR30195
Nico Weber [Tue, 30 Aug 2016 14:12:06 +0000 (14:12 +0000)]
Revert r280035 (and followups r280057, r280085), it caused PR30195

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

8 years agoHandle -mlong-calls on Hexagon
Krzysztof Parzyszek [Tue, 30 Aug 2016 13:57:50 +0000 (13:57 +0000)]
Handle -mlong-calls on Hexagon

Differential Revision:://reviews.llvm.org/D22766

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

8 years agoclang/test/Driver/modules-ts.cpp: Satisfy quoted filename.
NAKAMURA Takumi [Tue, 30 Aug 2016 13:07:53 +0000 (13:07 +0000)]
clang/test/Driver/modules-ts.cpp: Satisfy quoted filename.

On win32, backslashed filename is emitted like;

  -o "C:\\bb-win\\ninja-clang-i686-msc19-R\\build\\tools\\clang\\test\\Driver\\Output\\modules-ts.cpp.tmp.o"

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

8 years agoFix for commit 280064 that break the build.
Sjoerd Meijer [Tue, 30 Aug 2016 08:56:00 +0000 (08:56 +0000)]
Fix for commit 280064 that break the build.

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

8 years agoThis adds new options -fdenormal-fp-math and passes through option -ffast-math
Sjoerd Meijer [Tue, 30 Aug 2016 08:09:45 +0000 (08:09 +0000)]
This adds new options -fdenormal-fp-math and passes through option -ffast-math
to CC1, which are translated to function attributes and can e.g. be mapped on
build attributes FP_exceptions and FP_denormal. Setting these build attributes
allows better selection of floating point libraries.

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

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

8 years agoCombine two FileCheck patterns to prevent overzealous matching of .*
Richard Smith [Tue, 30 Aug 2016 05:14:38 +0000 (05:14 +0000)]
Combine two FileCheck patterns to prevent overzealous matching of .*

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

8 years ago[PowerPC] Update the DWARF register-size table
Hal Finkel [Tue, 30 Aug 2016 02:38:34 +0000 (02:38 +0000)]
[PowerPC] Update the DWARF register-size table

The PPC64 DWARF register-size table did not match the ABI specification (or
GCC, for that matter). Fix that, and add a regression test.

Fixes PR27931.

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

8 years ago[sanitizer-coverage] add two more modes of instrumentation: trace-div and trace-gep...
Kostya Serebryany [Tue, 30 Aug 2016 01:27:03 +0000 (01:27 +0000)]
[sanitizer-coverage] add two more modes of instrumentation: trace-div and trace-gep, mostly usaful for value-profile-based fuzzing; clang part

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

8 years ago[PowerPC] Add support for -mlongcall
Hal Finkel [Tue, 30 Aug 2016 01:07:03 +0000 (01:07 +0000)]
[PowerPC] Add support for -mlongcall

Add support for GCC's PowerPC -mlongcall option; the backend supports the
corresponding target feature as of r280040.

Fixes PR19098.

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

8 years agoC++ Modules TS: driver support for building modules.
Richard Smith [Tue, 30 Aug 2016 00:44:54 +0000 (00:44 +0000)]
C++ Modules TS: driver support for building modules.

This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

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

8 years ago[cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.
Evgeniy Stepanov [Mon, 29 Aug 2016 23:42:34 +0000 (23:42 +0000)]
[cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.

Multi-DSO CFI model requires every DSO to export a __cfi_check function.

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

8 years agoFix typo in test.
Evgeniy Stepanov [Mon, 29 Aug 2016 23:15:46 +0000 (23:15 +0000)]
Fix typo in test.

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

8 years agoFix a bug preventing the cause for a module file-not-found from being displayed
Adrian Prantl [Mon, 29 Aug 2016 20:46:59 +0000 (20:46 +0000)]
Fix a bug preventing the cause for a module file-not-found from being displayed

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

8 years agoFix a bug preventing the cause of a module-out-of-date error from being printed
Adrian Prantl [Mon, 29 Aug 2016 20:46:56 +0000 (20:46 +0000)]
Fix a bug preventing the cause of a module-out-of-date error from being printed

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

8 years agoTry to fix clang-offload-bunder.c test once more
Reid Kleckner [Mon, 29 Aug 2016 16:24:57 +0000 (16:24 +0000)]
Try to fix clang-offload-bunder.c test once more

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

8 years ago[Coverage] Prevent creating a redundant counter if a nested body ends with a macro.
Igor Kudrin [Mon, 29 Aug 2016 11:48:50 +0000 (11:48 +0000)]
[Coverage] Prevent creating a redundant counter if a nested body ends with a macro.

If there were several nested statements arranged in a way that all of them
end up with the same macro, then the expansion of this macro was assigned
with all the corresponding counters of these statements.
As a result, the wrong counter value was shown for the macro in llvm-cov.

This patch fixes the issue by preventing adding a counter for an expanded
source range if it already has an assigned counter, which is expected
to come from the most specific statement.

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

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

8 years agoAST: improve layout of SimpleTypoCorrector
Saleem Abdulrasool [Sun, 28 Aug 2016 21:33:30 +0000 (21:33 +0000)]
AST: improve layout of SimpleTypoCorrector

Add the "explicit" specifier to the single-argument constructor of
SimpleTypoCorrector.  Reorder the fields to remove excessive padding (8 bytes).

Patch by Alexander Shaposhnikov!

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

8 years agoFix a typo in the doc: overriden -> overridden
Sylvestre Ledru [Sun, 28 Aug 2016 20:22:34 +0000 (20:22 +0000)]
Fix a typo in the doc: overriden -> overridden

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

8 years agoclang-cl: Support MSVC2015's /validate-charset flag.
Nico Weber [Fri, 26 Aug 2016 21:51:14 +0000 (21:51 +0000)]
clang-cl: Support MSVC2015's /validate-charset flag.

Clang always assumes that files are utf-8. If an invalidly encoded character is
used in an identifier, clang always errors. If it's used in a character
literal, clang warns Winvalid-source-encoding (on by default). Clang never
checks the encoding of things in comments (adding this seems like a nice
feature if it doesn't impact performance).

For cl.exe /utf-8 (which enables /validate-charset), if a bad character is used
in an identifier, it emits both an error and a warning. If it's used in a
literal or a comment, it emits a warning.

So mapping /validate-charset to -Winvalid-source-encoding seems like a fairly
decent fit.

https://reviews.llvm.org/D23945

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

8 years agoclang-cl: Accept MSVC2015's '/utf-8' flag.
Nico Weber [Fri, 26 Aug 2016 21:26:29 +0000 (21:26 +0000)]
clang-cl: Accept MSVC2015's '/utf-8' flag.

Clang always behaves as if that's passed, so just ignore the flag.

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

8 years agoclang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.
Nico Weber [Fri, 26 Aug 2016 21:11:43 +0000 (21:11 +0000)]
clang-cl: Accept MSVC 2015's `/execution-charset:utf-8` flag.

Also makes -fexec-charset accept utf-8 case-insensitively.
Like https://reviews.llvm.org/D23807, but for execution-charset.
Also replace a few .lower() comparisons with equals_lower().

https://reviews.llvm.org/D23938

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

8 years agoDon't diagnose non-modular includes when we are not compiling a module.
Manman Ren [Fri, 26 Aug 2016 17:16:46 +0000 (17:16 +0000)]
Don't diagnose non-modular includes when we are not compiling a module.

This is triggered when we are compiling an implementation of a module,
it has relative includes to a VFS-mapped module with umbrella headers.
Currently we will find the real path to headers under the umbrella directory,
but the umbrella directories are using virtual path.

rdar://27951255

Thanks Ben and Richard for reviewing the patch!
Differential Revision: http://reviews.llvm.org/D23858

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

8 years agoAdd support for -fdiagnostics-absolute-paths: printing absolute paths in diagnostics
Hans Wennborg [Fri, 26 Aug 2016 15:45:36 +0000 (15:45 +0000)]
Add support for -fdiagnostics-absolute-paths: printing absolute paths in diagnostics

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

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

8 years agoSort list of driver-known file extensions. It was previously approximately
Richard Smith [Fri, 26 Aug 2016 00:41:59 +0000 (00:41 +0000)]
Sort list of driver-known file extensions. It was previously approximately
ordered by length then alphabetically; apply that order consistently.

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

8 years agoC++ Modules TS: add frontend support for building pcm files from module
Richard Smith [Fri, 26 Aug 2016 00:14:38 +0000 (00:14 +0000)]
C++ Modules TS: add frontend support for building pcm files from module
interface files. At the moment, all declarations (and no macros) are exported,
and 'export' declarations are not supported yet.

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

8 years agoWiden type of __offset_flags in RTTI on Mingw64
Reid Kleckner [Thu, 25 Aug 2016 22:16:30 +0000 (22:16 +0000)]
Widen type of __offset_flags in RTTI on Mingw64

Otherwise we can't handle secondary base classes at offsets greater than
2**24. This agrees with libstdc++abi.

We could extend this change to other LLP64 platforms, but then we would
want to update libc++abi and it would require additional review.

Fixes PR29116

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

8 years ago[MS] Win64 va_arg should expect large arguments to be passed indirectly
Reid Kleckner [Thu, 25 Aug 2016 20:42:26 +0000 (20:42 +0000)]
[MS] Win64 va_arg should expect large arguments to be passed indirectly

Fixes PR20569

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

8 years agoFix clang-offload-bundler.c test on Windows
Reid Kleckner [Thu, 25 Aug 2016 20:40:23 +0000 (20:40 +0000)]
Fix clang-offload-bundler.c test on Windows

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

8 years agoRefactor to remove the assumption that we know the name of the module we're emitting...
Richard Smith [Thu, 25 Aug 2016 18:26:30 +0000 (18:26 +0000)]
Refactor to remove the assumption that we know the name of the module we're emitting at the point when we create a PCHGenerator (with the C++ modules TS, we find that out part way through parsing the input).

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

8 years agoOmit column info for CodeView by default
Adrian McCarthy [Thu, 25 Aug 2016 18:24:35 +0000 (18:24 +0000)]
Omit column info for CodeView by default

Clang tracks only start columns, not start-end ranges. CodeView allows for that, but the VS debugger doesn't handle anything less than a complete range well--it either highlights the wrong part of a statement or truncates source lines in the assembly view. It's better to have no column information at all.

So by default, we'll omit the column information for CodeView targeting Windows.

Since the column info is still useful for sanitizers, I've promoted -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests to make sure that works for clang-cl.

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

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

8 years ago[MS] Pass non-trivially-copyable objects indirectly on Windows ARM
Reid Kleckner [Thu, 25 Aug 2016 18:23:28 +0000 (18:23 +0000)]
[MS] Pass non-trivially-copyable objects indirectly on Windows ARM

This isn't exactly what MSVC does, unfortunately. MSVC does not pass
objects with destructors but no copy constructors by address. More ARM
expertise is required to really understand what should be done here.

Fixes PR29136.

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

8 years ago[Sema][Comments] Add support for TypeAliasTemplate
Bruno Cardoso Lopes [Thu, 25 Aug 2016 17:09:33 +0000 (17:09 +0000)]
[Sema][Comments] Add support for TypeAliasTemplate

Emit proper diagnostics when -Wdocumentation is used with constructs such as:

  template<typename T>
  using fn = int(T aaa, int ccc);

Previously clang wouldn't recognize the function and complain with
'comment that is not attached to a function declaration'.

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

rdar://problem/27300695

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

8 years agoFix offload bundler test to support Windows new lines.
Samuel Antao [Thu, 25 Aug 2016 14:35:20 +0000 (14:35 +0000)]
Fix offload bundler test to support Windows new lines.

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

8 years agoclang-format: [JS] nested and tagged template strings.
Martin Probst [Thu, 25 Aug 2016 10:13:21 +0000 (10:13 +0000)]
clang-format: [JS] nested and tagged template strings.

JavaScript template strings can be nested arbitrarily:

    foo = `text ${es.map(e => { return `<${e}>`; })} text`;

This change lexes nested template strings using a stack of lexer states to
correctly switch back to template string lexing on closing braces.

Also, reuse the same stack for the token-stashed logic.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

8 years agoFix memory leaks in clang-offload-bundler
Vitaly Buka [Thu, 25 Aug 2016 07:21:34 +0000 (07:21 +0000)]
Fix memory leaks in clang-offload-bundler

Summary:
1. Pair removed from StringMap was not destroyed
2. ObjectFile had no owner

Reviewers: sfantao

Subscribers: llvm-commits

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

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

8 years agoRemove a pointless LLVM_CONSTEXPR. NFC.
George Burgess IV [Thu, 25 Aug 2016 01:54:37 +0000 (01:54 +0000)]
Remove a pointless LLVM_CONSTEXPR. NFC.

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

8 years agoLazily load the ContextDecl for a lambda's DefinitionData, to fix a
Richard Smith [Thu, 25 Aug 2016 00:34:00 +0000 (00:34 +0000)]
Lazily load the ContextDecl for a lambda's DefinitionData, to fix a
deserialization cycle caused by the ContextDecl recursively importing members
of the lambda's closure type.

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

8 years ago[Sema][Comments] Factor out function type loc logic. NFCI
Bruno Cardoso Lopes [Thu, 25 Aug 2016 00:22:08 +0000 (00:22 +0000)]
[Sema][Comments] Factor out function type loc logic. NFCI

This is in prepatation for @param TypeAliasTemplate support.

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