]> granicus.if.org Git - clang/log
clang
7 years ago[OpenMP] Remove fixme comment in regression test and related unnecessary statement
Carlo Bertolli [Mon, 6 Feb 2017 16:03:41 +0000 (16:03 +0000)]
[OpenMP] Remove fixme comment in regression test and related unnecessary statement

https://reviews.llvm.org/D29501

It looks like I forgot to remove a FIXME comment with the associated statement. The test does not need it and it gives the wrong impression of being an incomplete test.

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

7 years agoRevert "[AVR] Allow specifying the CPU on the command line"
Diana Picus [Mon, 6 Feb 2017 11:35:42 +0000 (11:35 +0000)]
Revert "[AVR] Allow specifying the CPU on the command line"

This reverts commit r294177. It seems to have broken some buildbots.

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

7 years agoclang-format: Fix bug with conflicting BreakBeforeBinaryOperations and AlignAfterOpen...
Daniel Jasper [Mon, 6 Feb 2017 10:55:49 +0000 (10:55 +0000)]
clang-format: Fix bug with conflicting BreakBeforeBinaryOperations and AlignAfterOpenBracket

Fix for the formatting options combination of
BreakBeforeBinaryOperators: All, AlignAfterOpenBracket: AlwaysBreak not
handling long templates correctly. This patch allows a break after an
opening left parenthesis, TemplateOpener, or bracket when both options
are enabled.

Patch by Daphne Pfister, thank you!

Fixes llvm.org/PR30304.

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

7 years ago[AVR] Allow specifying the CPU on the command line
Dylan McKay [Mon, 6 Feb 2017 09:07:56 +0000 (09:07 +0000)]
[AVR] Allow specifying the CPU on the command line

Summary:
This tells clang about all of the different AVR microcontrollers.

It also adds code to define the correct preprocessor macros for each
device.

Reviewers: jroelofs, asl

Reviewed By: asl

Subscribers: asl, cfe-commits

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

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

7 years ago[AVR] Add support for the full set of inline asm constraints
Dylan McKay [Mon, 6 Feb 2017 09:01:59 +0000 (09:01 +0000)]
[AVR] Add support for the full set of inline asm constraints

Summary:
Previously the method would simply return false, causing every single
inline assembly constraint to trigger a compile error.

This adds inline assembly constraint support for the AVR target.

This patch is derived from the code in
AVRISelLowering::getConstraintType.

More details can be found on the AVR-GCC reference wiki
http://www.nongnu.org/avr-libc/user-manual/inline_asm.html

Reviewers: jroelofs, asl

Reviewed By: asl

Subscribers: asl, ahatanak, saaadhu, cfe-commits

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

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

7 years agoBasic: match GCC behaviour for SuS macro
Saleem Abdulrasool [Sun, 5 Feb 2017 22:18:15 +0000 (22:18 +0000)]
Basic: match GCC behaviour for SuS macro

GCC does not generate `__unix` nor `unix` macros.  The latter already
intrudes into the user's namespace and should be avoided.  Use the
canonical spelling of `__unix__` across all the targets.

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

7 years ago[X86][MS]Adjacent comments within multi-line inline assembly statement
Coby Tayree [Sun, 5 Feb 2017 10:23:06 +0000 (10:23 +0000)]
[X86][MS]Adjacent comments within multi-line inline assembly statement

Allowing adjacent comments within MS inline assembly multi-line statement

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

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

7 years agoPR31846: Don't replace 'auto' type with a template parameter type in a generic lambda
Richard Smith [Sat, 4 Feb 2017 01:28:01 +0000 (01:28 +0000)]
PR31846: Don't replace 'auto' type with a template parameter type in a generic lambda
until after we've checked whether 'auto' is valid in the current language mode.

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

7 years agoDriver: Do not warn about unused -pthread when linking on darwin
Matthias Braun [Fri, 3 Feb 2017 23:09:31 +0000 (23:09 +0000)]
Driver: Do not warn about unused -pthread when linking on darwin

While there is nothing to do at link time to get pthreads support on
darwin, specifying the argument is fine and we should not warn about
unused arguments.

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

7 years ago[x86] fix tests with wrong dependency to pass because they broke with r294049
Sanjay Patel [Fri, 3 Feb 2017 22:03:47 +0000 (22:03 +0000)]
[x86] fix tests with wrong dependency to pass because they broke with r294049

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

7 years ago[OpenMP] Add missing regression test for pragma distribute, clause firstprivate
Carlo Bertolli [Fri, 3 Feb 2017 19:09:16 +0000 (19:09 +0000)]
[OpenMP] Add missing regression test for pragma distribute, clause firstprivate

https://reviews.llvm.org/D28243

The regression test was missing from the previous already accepted patch.

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

7 years ago[Lit Test] Make tests C++11 compatible - OpenMP constant expressions
Charles Li [Fri, 3 Feb 2017 18:58:34 +0000 (18:58 +0000)]
[Lit Test] Make tests C++11 compatible - OpenMP constant expressions

C++11 introduced constexpr, hence the change in diagnostics.

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

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

7 years agoclang-format: [JS] Fix bugs in parsing and aligning template strings.
Daniel Jasper [Fri, 3 Feb 2017 14:32:38 +0000 (14:32 +0000)]
clang-format: [JS] Fix bugs in parsing and aligning template strings.

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

7 years ago[Sema][ObjC++] Typo correction should handle ivars and properties
Alex Lorenz [Fri, 3 Feb 2017 14:22:33 +0000 (14:22 +0000)]
[Sema][ObjC++] Typo correction should handle ivars and properties

After r260016 and r260017 disabled typo correction for ivars and properties
clang didn't report errors about unresolved identifier in the base of ivar and
property ref expressions. This meant that clang invoked CodeGen on invalid AST
which then caused a crash.

This commit re-enables typo correction for ivars and properites, and fixes the
PR25113 & PR26486 (that were originally fixed in r260017 and r260016) in a
different manner by transforming the Objective-C ivar reference expression with
'IsFreeIvar' preserved.

rdar://30310772

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

7 years ago[clang-format] Re-align broken comment lines where appropriate.
Krasimir Georgiev [Fri, 3 Feb 2017 10:18:25 +0000 (10:18 +0000)]
[clang-format] Re-align broken comment lines where appropriate.

Summary:
The comment aligner was skipping over newly broken comment lines. This patch fixes that.

source:
```
int ab; // line
int a; // long long
```

format with column limit 15 before:
```
int ab; // line
int a;  // long
       // long
```

format with column limit 15 after:
```
int ab; // line
int a;  // long
        // long
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: [Proto] Also supports implicit string literal concatenation
Daniel Jasper [Fri, 3 Feb 2017 08:29:02 +0000 (08:29 +0000)]
clang-format: [Proto] Also supports implicit string literal concatenation

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

7 years agoRevert "[Driver] Updated for Visual Studio 2017"
Reid Kleckner [Thu, 2 Feb 2017 19:36:22 +0000 (19:36 +0000)]
Revert "[Driver] Updated for Visual Studio 2017"

This reverts commit r293923. It causes test failures on Linux that need
time to debug.

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

7 years ago[Driver] Updated for Visual Studio 2017
Reid Kleckner [Thu, 2 Feb 2017 19:29:46 +0000 (19:29 +0000)]
[Driver] Updated for Visual Studio 2017

Summary:
The patch updates the MSVC ToolChain for the changes made in Visual
Studio 2017[1].

Other notable changes:
  - Path handling code has been centralised to make potential future
    changes less painful.
  - A compiler error is emitted if the driver is unable to locate a
    usable MSVC toolchain. (Previously it'd fail with a cryptic error
    such as "link.exe is not executable")
  - Support for the new Setup Config Server API[2] has been added,
    albeit block commented out with a preprocessor conditional. This can
    probably be re-evaluated when the API is officially released (it's
    currently at the RC stage), but it's left in to make it easy for
    anyone familiar with the API to give it a go with Clang.

Patch by Hamza Sood.

[1] https://blogs.msdn.microsoft.com/vcblog/2016/10/07/compiler-tools-layout-in-visual-studio-15/
[2] https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/

Reviewers: ruiu, hans, rnk

Reviewed By: rnk

Subscribers: awson, RKSimon, amccarth, cfe-commits

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

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

7 years agoPrevent ICE in dllexport class with _Atomic data member
Warren Ristow [Thu, 2 Feb 2017 17:53:34 +0000 (17:53 +0000)]
Prevent ICE in dllexport class with _Atomic data member

Guard against a null pointer dereference that caused Clang to crash
when processing a class containing an _Atomic qualified data member,
and that is tagged with 'dllexport'.

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

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

7 years ago[index] Provide a more general index::generateUSRForMacro() that doesn't depend on...
Argyrios Kyrtzidis [Thu, 2 Feb 2017 16:13:10 +0000 (16:13 +0000)]
[index] Provide a more general index::generateUSRForMacro() that doesn't depend on having a PreprocessingRecord.

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

7 years ago[clang-format] Don't reflow across comment pragmas.
Krasimir Georgiev [Thu, 2 Feb 2017 15:32:19 +0000 (15:32 +0000)]
[clang-format] Don't reflow across comment pragmas.

Summary:
The comment reflower wasn't taking comment pragmas as reflow stoppers. This patch fixes that.

source:
```
// long long long long
// IWYU pragma:
```
format with column limit  = 20 before:
```
// long long long
// long IWYU pragma:
```
format with column limit  = 20 after:
```
// long long long
// long
// IWYU pragma:
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Fix breaking of comment sections in unwrapped lines containing newlines.
Krasimir Georgiev [Thu, 2 Feb 2017 14:36:50 +0000 (14:36 +0000)]
[clang-format] Fix breaking of comment sections in unwrapped lines containing newlines.

Summary:
The breaking of line comment sections was misaligning the case where the first comment line is on an unwrapped line containing newlines. In this case, the breaking column must be based on the source column of the last token that is preceded by a newline, not on the first token of the unwrapped line.

source:
```
enum A {
  a, // line 1
  // line 2
};
```
format before:
```
enum A {
  a, // line 1
     // line 2
};
```
format after:
```
enum A {
  a, // line 1
  // line 2
};
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Don't reflow lines starting with TODO, FIXME or XXX.
Krasimir Georgiev [Thu, 2 Feb 2017 10:52:08 +0000 (10:52 +0000)]
[clang-format] Don't reflow lines starting with TODO, FIXME or XXX.

Summary: These lines commonly carry a special meaning.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoImprove docs: Add missing #pragma push directive.
Asiri Rathnayake [Thu, 2 Feb 2017 10:35:18 +0000 (10:35 +0000)]
Improve docs: Add missing #pragma push directive.

NFC.

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

7 years agoclang-format: Do not use two-argument/operand special case with no alignment
Daniel Jasper [Thu, 2 Feb 2017 08:30:21 +0000 (08:30 +0000)]
clang-format: Do not use two-argument/operand special case with no alignment

Without alignment, there is no clean separation between the arguments, even if
there are only two.

Before:
  aaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaaaaaaaaaaaa(aaaaaaaaaaaa,
                 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +
                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

7 years ago[analyzer] Fix an assertion fail in CStringSyntaxChecker.
Gabor Horvath [Thu, 2 Feb 2017 08:20:54 +0000 (08:20 +0000)]
[analyzer] Fix an assertion fail in CStringSyntaxChecker.

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

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

7 years agoFix typo. NFC
George Burgess IV [Thu, 2 Feb 2017 07:53:55 +0000 (07:53 +0000)]
Fix typo. NFC

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

7 years agoCodeGen: add a LLVM_FALLTHROUGH to a fallthrough (NFC)
Saleem Abdulrasool [Thu, 2 Feb 2017 05:45:43 +0000 (05:45 +0000)]
CodeGen: add a LLVM_FALLTHROUGH to a fallthrough (NFC)

Drive by cleanup noticed while investigating an IR verifier assertion.

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

7 years agoModules: Simplify CompilerInstance constructor, NFC
Duncan P. N. Exon Smith [Thu, 2 Feb 2017 05:09:51 +0000 (05:09 +0000)]
Modules: Simplify CompilerInstance constructor, NFC

Initialize fields directly in header.  Note that the ModuleManager field is an
IntrusiveRefCntPtr, so there's no need for explicit initialization.

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

7 years agoFix attribute name in diagnostic message to match actual attribute name.
Richard Smith [Thu, 2 Feb 2017 01:50:47 +0000 (01:50 +0000)]
Fix attribute name in diagnostic message to match actual attribute name.

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

7 years ago[CodeGen] Update test after recent changes in llvm (r293846).
Davide Italiano [Thu, 2 Feb 2017 00:47:53 +0000 (00:47 +0000)]
[CodeGen] Update test after recent changes in llvm (r293846).

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

7 years agoclang-format: Fix incorrect line breaks after forced operator wraps.
Daniel Jasper [Wed, 1 Feb 2017 23:27:37 +0000 (23:27 +0000)]
clang-format: Fix incorrect line breaks after forced operator wraps.

Before:
  bool x = aaaaa //
           ||
           bbbbb
           //
           || cccc;

After:
  bool x = aaaaa //
           || bbbbb
           //
           || cccc;

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

7 years agoChange debug-info-for-profiling from a TargetOption to a function attribute.
Dehao Chen [Wed, 1 Feb 2017 22:45:21 +0000 (22:45 +0000)]
Change debug-info-for-profiling from a TargetOption to a function attribute.

Summary: cfe change for https://reviews.llvm.org/D29203

Reviewers: echristo, dblaikie

Reviewed By: dblaikie

Subscribers: mehdi_amini, cfe-commits

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

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

7 years agoRepoint 'missing typename' diagnostic to the location where 'typename' should be...
Richard Smith [Wed, 1 Feb 2017 21:41:18 +0000 (21:41 +0000)]
Repoint 'missing typename' diagnostic to the location where 'typename' should be added.

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

7 years agoFix hole in our enforcement of rule requiring 'typename' prior to a dependent
Richard Smith [Wed, 1 Feb 2017 21:36:38 +0000 (21:36 +0000)]
Fix hole in our enforcement of rule requiring 'typename' prior to a dependent
name. If the dependent name happened to end in a template-id (X<T>::Y<U>), we
would fail to notice that the 'typename' keyword is missing when resolving it
to a type.

It turns out that GCC has a similar bug. If this shows up in much real code, we
can easily downgrade this to an ExtWarn.

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

7 years ago[CodeGen] Update test after recent changes in llvm (r293799).
Davide Italiano [Wed, 1 Feb 2017 20:43:28 +0000 (20:43 +0000)]
[CodeGen] Update test after recent changes in llvm (r293799).

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

7 years ago[Sema][ObjC] Don't pass a DeclRefExpr that doesn't reference a VarDecl
Akira Hatanaka [Wed, 1 Feb 2017 20:22:26 +0000 (20:22 +0000)]
[Sema][ObjC] Don't pass a DeclRefExpr that doesn't reference a VarDecl
to WeakObjectProfileTy's constructor.

This fixes an assertion failure in WeakObjectProfileTy's constructor.

rdar://problem/30112633

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

7 years agoDrop 'dllimport' when redeclaring inline function template without the attribute...
Hans Wennborg [Wed, 1 Feb 2017 18:52:53 +0000 (18:52 +0000)]
Drop 'dllimport' when redeclaring inline function template without the attribute (PR31695)

For non-template dllimport functions, MSVC allows providing an inline
definition without spelling out the attribute again. In the example below, f
remains a dllimport function.

  __declspec(dllimport) int f();
  inline int f() { return 42; }

  int useit() {
    return f();
  }

However, for a function template, not putting dllimport on the redeclaration
causes it to be dropped. In the example below, f is not dllimport.

  template <typename> __declspec(dllimport) int f();
  template <typename> inline int f() { return 42; }

  int useit() {
    return f<int>();
  }

This patch makes Clang match MSVC for the second example.

MSVC does not warn about the attribute being dropped in the example above, but
I think we should. (MSVC does warn if the inline keyword isn't used.)

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

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

7 years ago[CodeGen][ObjC] Avoid asserting on block pointer types in
Alex Lorenz [Wed, 1 Feb 2017 17:37:28 +0000 (17:37 +0000)]
[CodeGen][ObjC] Avoid asserting on block pointer types in
isPointerZeroInitializable

rdar://30111891

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

7 years agoRevert r293518 as it caused module linking error in clang-reorder-fields
Alex Lorenz [Wed, 1 Feb 2017 10:52:02 +0000 (10:52 +0000)]
Revert r293518 as it caused module linking error in clang-reorder-fields

This commit reverts "r293518 - [ASTMatchers] Sprinkle some constexpr on the
global matcher constructors" because after it a buildbot that builds clang
stage 2 with modules failed to link clang-reorder-fields.

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

7 years ago[clang-format] Fix regression about not aligning trailing comments in case they were...
Krasimir Georgiev [Wed, 1 Feb 2017 10:10:04 +0000 (10:10 +0000)]
[clang-format] Fix regression about not aligning trailing comments in case they were previously aligned, but at different indent.

Summary:
Comment reflower was adding untouchable tokens in case two consecutive comment lines are aligned in the source code. This disallows the whitespace manager to re-indent them later.

source:
```
int i = f(abc, // line 1
          d, // line 2
     // line 3
  b);
```
Since line 2 and line 3 are aligned, the reflower was marking line 3 as untouchable; however the three comment lines need to be re-aligned.
output before:
```
int i = f(abc, // line 1
          d,   // line 2
     // line 3
  b);
```
output after:
```
int i = f(abc, // line 1
          d,   // line 2
       // line 3
  b);
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: sammccall, cfe-commits, klimek

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

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

7 years agoFix Index test after recent clang-format change.
Daniel Jasper [Wed, 1 Feb 2017 10:00:10 +0000 (10:00 +0000)]
Fix Index test after recent clang-format change.

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

7 years agoclang-format: Don't force-wrap multiline RHSs for 2-operand experssions.
Daniel Jasper [Wed, 1 Feb 2017 09:23:39 +0000 (09:23 +0000)]
clang-format: Don't force-wrap multiline RHSs for 2-operand experssions.

This rows back on r288120, r291801 and r292110. I apologize in advance
for the churn. All of those revisions where meant to make the wrapping
of RHS expressions more consistent. However, now that they are
consistent, we seem to be a bit too eager.

The reasoning here is that I think it is generally correct that we want
to line-wrap before multiline RHS expressions (or multiline arguments to
a function call). However, if there are only two of such operands or
arguments, there is always a clear vertical separation between them and
the additional line break seems much less desirable.

Somewhat good examples are expressions like:

  EXPECT_EQ(2, someLongExpression(
                   orCall));

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

7 years agoDoxygen comments for prfchwintrin.h
Ekaterina Romanova [Wed, 1 Feb 2017 07:37:40 +0000 (07:37 +0000)]
Doxygen comments for prfchwintrin.h

Added doxygen comments to prfchwintrin.h's intrinsics.

Note: The doxygen comments are automatically generated based on Sony's intrinsic
s document.

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@293745 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove apparently-unnecessary copy of constructor lookup result.
Richard Smith [Wed, 1 Feb 2017 03:28:59 +0000 (03:28 +0000)]
Remove apparently-unnecessary copy of constructor lookup result.

Contrary to the comment, DeclContext intends to guarantee that the lookup
results for a particular name will be stable across non-AST-mutating
operations, so a copy here should not be necessary. Further, if a copy *is*
necessary, the other four instances of this pattern within this file would also
be wrong, and we have no evidence of any problems with them; if this change
unearths problems, we should fix all the instances of this pattern.

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

7 years agoFollow-up to r293732: add a proper triple to the test
Hans Wennborg [Wed, 1 Feb 2017 02:48:02 +0000 (02:48 +0000)]
Follow-up to r293732: add a proper triple to the test

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

7 years agoclang-cl: Evaluate arguments left-to-right in constructor call with initializer list...
Hans Wennborg [Wed, 1 Feb 2017 02:21:07 +0000 (02:21 +0000)]
clang-cl: Evaluate arguments left-to-right in constructor call with initializer list (PR31831)

clang-cl would evaluate the arguments right-to-left (see PR), and for
non-Windows targets I suppose we only got it because we were already
emitting left-to-right in CodeGenFunction::EmitCallArgs.

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

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

7 years agoFix modules codegen to be compatible with modules-ts
David Blaikie [Tue, 31 Jan 2017 21:28:19 +0000 (21:28 +0000)]
Fix modules codegen to be compatible with modules-ts

The Module::WithCodegen flag was only being set when the module was
parsed from a ModuleMap. Instead set it late, in the ASTWriter to match
the layer where the MODULAR_CODEGEN_DECLs list is determined (the
WithCodegen flag essentially means "are this module's decls in
MODULAR_CODEGEN_DECLs").

When simultaneous emission of AST file and modular object is implemented
this may need to change - the Module::WithCodegen flag will need to be
set earlier, and ideally the MODULAR_CODEGEN_DECLs gathering will
consult this flag (that's not possible right now since Decls destined
for an AST File don't have a Module - only if they're /read/ from a
Module is that true - I expect that would need to change as well).

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

7 years ago[Sema] Transform a templated name before looking it up in
Akira Hatanaka [Tue, 31 Jan 2017 19:53:32 +0000 (19:53 +0000)]
[Sema] Transform a templated name before looking it up in
FindInstantiatedDecl or passing it to RebuildMemberExpr.

This fixes PR30361.

rdar://problem/17341274

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

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

7 years agoExtend -Wcast-calling-convention to warn on declarations as well as definitions
Reid Kleckner [Tue, 31 Jan 2017 19:37:45 +0000 (19:37 +0000)]
Extend -Wcast-calling-convention to warn on declarations as well as definitions

My original warning was very conservative and I never revisited the
heuristics that were used.

This would have caught http://crbug.com/687251 at compile time.

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

7 years ago[windows] [asan] Fix tests failing after 293668.
Marcos Pividori [Tue, 31 Jan 2017 19:05:05 +0000 (19:05 +0000)]
[windows] [asan] Fix tests failing after 293668.

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

7 years agoKeep Chromium ObjC column limit at 80 for consistency with C++
Nico Weber [Tue, 31 Jan 2017 18:42:05 +0000 (18:42 +0000)]
Keep Chromium ObjC column limit at 80 for consistency with C++

https://reviews.llvm.org/D29337
Patch from Dan Beam <dbeam@chromium.org>!

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

7 years ago[windows] [asan] Add wholearchive flag when including static lib asan.
Marcos Pividori [Tue, 31 Jan 2017 18:31:38 +0000 (18:31 +0000)]
[windows] [asan] Add wholearchive flag when including static lib asan.

In Windows, when the sanitizer is implemented as a static library, we use
auxiliary static library dll_thunk that will be linked to the dlls that have
instrumentation, so they can refer to the runtime in the main executable.
It uses interception to get a pointer the function in the main executable and
override its function with that pointer.
Because of that, we need to ensure that the main executable exports all the
sanitizers' interface, otherwise the initialization in dll_thunk will fail.

In this commit we add the flag -wholearchive to clang driver to ensure that
the linker does not omit any object files from asan library.

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

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

7 years ago[X86] Teach Clang about -mfentry flag
Nirav Dave [Tue, 31 Jan 2017 17:00:35 +0000 (17:00 +0000)]
[X86] Teach Clang about -mfentry flag

Replace mcount calls with calls to fentry.

Reviewers: hfinkel, craig.topper

Subscribers: llvm-commits

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

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

7 years ago[clang-format] Fix regression about adding leading whitespace to the content of line...
Krasimir Georgiev [Tue, 31 Jan 2017 15:40:15 +0000 (15:40 +0000)]
[clang-format] Fix regression about adding leading whitespace to the content of line comments

Summary:
The reflower didn't measure precisely the line column of a line in the middle of
a line comment section that has a prefix that needs to be adapted.

source:
```
/// a
//b
```

format before:
```
/// a
 //b
```

format after:
```
/// a
// b
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: sammccall, cfe-commits, klimek

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

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

7 years agoclang-format: [JS] Indent expressions in ${} relative to their surrounding
Daniel Jasper [Tue, 31 Jan 2017 14:39:33 +0000 (14:39 +0000)]
clang-format: [JS] Indent expressions in ${} relative to their surrounding

This only affects expressions inside ${} scopes of template strings.
Here, we want to indent relative to the surrounding template string and
not the surrounding expression. Otherwise, this can create quite a mess.

Before:
  var f = `
    aaaaaaaaaaaaaaaaaa: ${someFunction(
      aaaaa +  //
      bbbb)}`;

After:
  var f = `
    aaaaaaaaaaaaaaaaaa: ${someFunction(
                              aaaaa +  //
                              bbbb)}`;

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

7 years ago[clang-format] Fix reflow in block comment lines with leading whitespace.
Krasimir Georgiev [Tue, 31 Jan 2017 14:31:44 +0000 (14:31 +0000)]
[clang-format] Fix reflow in block comment lines with leading whitespace.

Summary:
The reflower was not taking into account the additional  leading whitespace in block comment lines.

source:
```
{
/*
 * long long long long
 *   long
 * long long long long
 */
}
```

format (with column limit 20) before:
```
{
  /*
   * long long long
   * long long long long
   * long long
   */
}
```
format after:
```
{
  /*
   * long long long
   * long long long
   * long long long
   */
}
```

Reviewers: djasper, klimek

Reviewed By: djasper

Subscribers: cfe-commits, sammccall, klimek

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

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

7 years ago[cmake] Hint find_package() to prefer LLVM installed alongside clang
Michal Gorny [Tue, 31 Jan 2017 14:15:40 +0000 (14:15 +0000)]
[cmake] Hint find_package() to prefer LLVM installed alongside clang

Include a path hint for find_package() in ClangConfig.cmake to ensure
that CMake prefers LLVM installed alongside clang over the default
search path.

If two versions of LLVM are installed in the system, and one of them is
in PATH, CMake's find_package() magic prefers the CMake directory
alongside that install by default. Adding a relative hint makes it
possible to prioritize to the install from which find_package() is
called.

If you want to build e.g. LLDB against another install of LLVM, you can
pass LLVM_CONFIG override. In this case, LLDB queries the prefix from
llvm-config and uses the CMake files located there. However, when
including ClangConfig, the implicit find_package() nevertheless prefers
PATH-found LLVM over the one used previously by LLDB, and two versions
of LLVMConfig end up being loaded.

This could be fixed on LLDB end up by explicitly forcing custom package
search location. However, it seems simpler and safer to add a hint to
ClangConfig than to track every usage of ClangConfig.

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

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

7 years ago[clang-format] Fix regression merging comments across newlines.
Krasimir Georgiev [Tue, 31 Jan 2017 13:32:38 +0000 (13:32 +0000)]
[clang-format] Fix regression merging comments across newlines.

Summary:
This fixes a regression that causes example:
```
enum A {
  a, // line a

  // line b
  b
};
```
to be formatted as follows:
```
enum A {
  a, // line a
     // line b
  b
};
```

Reviewers: djasper, klimek

Reviewed By: klimek

Subscribers: cfe-commits, sammccall, djasper, klimek

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

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

7 years agoclang-format: [JS] Properly set scopes inside template strings.
Daniel Jasper [Tue, 31 Jan 2017 13:03:07 +0000 (13:03 +0000)]
clang-format: [JS] Properly set scopes inside template strings.

Before:
  var f = `aaaaaaaaaaaaa:${aaaaaaa
              .aaaaa} aaaaaaaa
           aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;

After:
  var f = `aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa
           aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa`;

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

7 years agoclang-format: [JS] Fix incorrect line break in template strings.
Daniel Jasper [Tue, 31 Jan 2017 12:07:35 +0000 (12:07 +0000)]
clang-format: [JS] Fix incorrect line break in template strings.

Before:
  var f = `aaaa ${a ? 'a' : 'b'
                            }`;

After:
  var f = `aaaa ${a ? 'a' : 'b'}`;

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

7 years ago[clang-format] Don't reflow comment lines starting with '@'.
Krasimir Georgiev [Tue, 31 Jan 2017 11:38:02 +0000 (11:38 +0000)]
[clang-format] Don't reflow comment lines starting with '@'.

Summary:
This patch stops reflowing comment lines starting with '@', since they commonly
have a special meaning.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Refactor WhitespaceManager and friends
Daniel Jasper [Tue, 31 Jan 2017 11:25:01 +0000 (11:25 +0000)]
[clang-format] Refactor WhitespaceManager and friends

The main motivation behind this is to cleanup the WhitespaceManager and
make it more extensible for future alignment etc. features.
Specifically, WhitespaceManager has started to copy more and more code
that is already present in FormatToken. Instead, I think it makes more
sense to actually store a reference to each FormatToken for each change.

This has as a consequence led to a change in the calculation of indent
levels. Now, we actually compute them for each Token ahead of time,
which should be more efficient as it removes an unsigned value for the
ParenState, which is used during the combinatorial exploration of the
solution space.

No functional changes intended.

Review: https://reviews.llvm.org/D29300

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

7 years agoRevert r293585 "Add better ODR checking for modules."
Sam McCall [Tue, 31 Jan 2017 08:24:40 +0000 (08:24 +0000)]
Revert r293585 "Add better ODR checking for modules."

We're seeing what we believe are false positives. (It's hard to tell with the
available diagnostics, and I'm not sure how to reduce them yet).
I'll send Richard reproduction details offline.

djasper/chandlerc suggested this should be a warning for now, to make rolling it
out feasible.

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

7 years ago[lsan] Enable LSan for x86 Linux
Maxim Ostapenko [Tue, 31 Jan 2017 07:00:23 +0000 (07:00 +0000)]
[lsan] Enable LSan for x86 Linux

This is a missed part of https://reviews.llvm.org/D28609.
Enable LSan for x86 Linux in clang driver.

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

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

7 years agoIn VirtualCallChecker, handle indirect calls
Sam McCall [Tue, 31 Jan 2017 05:23:20 +0000 (05:23 +0000)]
In VirtualCallChecker, handle indirect calls

Summary:
In VirtualCallChecker, handle indirect calls.

getDirectCallee() can be nullptr, and dyn_cast(nullptr) is UB

Reviewers: bkramer

Subscribers: cfe-commits

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

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

7 years agoAMDGPU: Add builtin for fmed3 intrinsic
Matt Arsenault [Tue, 31 Jan 2017 03:42:07 +0000 (03:42 +0000)]
AMDGPU: Add builtin for fmed3 intrinsic

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

7 years agoHandle ObjCEncodeExpr in extractStringLiteralCharacter.
Akira Hatanaka [Tue, 31 Jan 2017 02:31:39 +0000 (02:31 +0000)]
Handle ObjCEncodeExpr in extractStringLiteralCharacter.

This fixes an assertion failure that occurs later in the function when
an ObjCEncodeExpr is cast to StringLiteral.

rdar://problem/30111207

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

7 years agoImprove fix for PR28739
Richard Smith [Tue, 31 Jan 2017 02:23:02 +0000 (02:23 +0000)]
Improve fix for PR28739

Don't try to map an APSInt addend to an int64_t in pointer arithmetic before
bounds-checking it. This gives more consistent behavior (outside C++11, we
consistently use 2s complement semantics for both pointer and integer overflow
in constant expressions) and fixes some cases where in C++11 we would fail to
properly check for out-of-bounds pointer arithmetic (if the 2s complement
64-bit overflow landed us back in-bounds).

In passing, also fix some cases where we'd perform possibly-overflowing
arithmetic on CharUnits (which have a signed underlying type) during constant
expression evaluation.

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

7 years agoAdd better ODR checking for modules.
Richard Trieu [Tue, 31 Jan 2017 01:44:15 +0000 (01:44 +0000)]
Add better ODR checking for modules.

When objects are imported for modules, there is a chance that a name collision
will cause an ODR violation.  Previously, only a small number of such
violations were detected.  This patch provides a stronger check based on
AST nodes.

The information needed to uniquely identify an object is taked from the AST and
put into a one-dimensional byte stream.  This stream is then hashed to give
a value to represent the object, which is stored with the other object data
in the module.

When modules are loaded, and Decl's are merged, the hash values of the two
Decl's are compared.  Only Decl's with matched hash values will be merged.
Mismatch hashes will generate a module error, and if possible, point to the
first difference between the two objects.

The transform from AST to byte stream is a modified depth first algorithm.
Due to references between some AST nodes, a pure depth first algorithm could
generate loops.  For Stmt nodes, a straight depth first processing occurs.
For Type and Decl nodes, they are replaced with an index number and only on
first visit will these nodes be processed.  As an optimization, boolean
values are saved and stored together in reverse order at the end of the
byte stream to lower the ammount of data that needs to be hashed.

Compile time impact was measured at 1.5-2.0% during module building, and
negligible during builds without module building.

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

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

7 years agoRe-apply "[ubsan] Sanity-check shift amounts before truncation"
Vedant Kumar [Mon, 30 Jan 2017 23:38:54 +0000 (23:38 +0000)]
Re-apply "[ubsan] Sanity-check shift amounts before truncation"

This re-applies r293343 (reverts commit r293475) with a fix for an
assertion failure caused by a missing integer cast. I tested this patch
by using the built compiler to compile X86FastISel.cpp.o with ubsan.

Original commit message:

Ubsan does not report UB shifts in some cases where the shift exponent
needs to be truncated to match the type of the shift base. We perform a
range check on the truncated shift amount, leading to false negatives.

Fix the issue (PR27271) by performing the range check on the original
shift amount.

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

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

7 years agoPR28739: Check that integer values fit into 64 bits before extracting them as 64...
Richard Smith [Mon, 30 Jan 2017 23:30:26 +0000 (23:30 +0000)]
PR28739: Check that integer values fit into 64 bits before extracting them as 64 bit values for pointer arithmetic.

This fixes various ways to tickle an assertion in constant expression
evaluation when using __int128. Longer term, we need to figure out what should
happen here: either any kind of overflow in offset calculation should result in
a non-constant value or we should truncate to 64 bits. In C++11 onwards, we're
effectively already checking for overflow because we strictly enforce array
bounds checks, but even there some forms of overflow can slip past undetected.

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

7 years agoSerialization: use range based for loop (NFC)
Saleem Abdulrasool [Mon, 30 Jan 2017 22:25:28 +0000 (22:25 +0000)]
Serialization: use range based for loop (NFC)

Just a small clean up noticed when doing post-commit review of Duncan's
previous change for ModuleFile memory ownership semantics.  NFC.

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

7 years ago[clang-format] Fix regression that breaks comments without a comment prefix
Krasimir Georgiev [Mon, 30 Jan 2017 21:00:01 +0000 (21:00 +0000)]
[clang-format] Fix regression that breaks comments without a comment prefix

Summary:
Consider formatting the following code fragment with column limit 20:
```
{
  // line 1
  // line 2\
  // long long long line
}
```
Before this fix the output is:
```
{
  // line 1
  // line 2\
  // long long
  long line
}
```
This patch fixes a regression that breaks the last comment line without
adding the '//' prefix.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoTowards P0091R3: parsing support for class template argument deduction in typename...
Richard Smith [Mon, 30 Jan 2017 20:39:26 +0000 (20:39 +0000)]
Towards P0091R3: parsing support for class template argument deduction in typename-specifiers.

This reinstates r293455, reverted in r293455, with a fix for cv-qualifier
handling on dependent typename-specifiers.

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

7 years ago[clang-format] Separate line comment sections after a right brace from comment sectio...
Krasimir Georgiev [Mon, 30 Jan 2017 19:18:55 +0000 (19:18 +0000)]
[clang-format] Separate line comment sections after a right brace from comment sections in the scope.

Summary:
The following two comment lines form a single comment section:
```
if (1) { // line 1
   // line 2
}
```
This is because the break of a comment section was based on the original column
of the first token of the previous line (in this case, the 'if').
This patch splits these two comment lines into different sections by taking into
account the original column of the right brace preceding the first line comment
where applicable.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[AST] Give TemplateArgumentLoc a constexpr ctor.
Benjamin Kramer [Mon, 30 Jan 2017 18:32:46 +0000 (18:32 +0000)]
[AST] Give TemplateArgumentLoc a constexpr ctor.

This removes the thread-safe static from
clang::TemplateTemplateParmDecl::getDefaultArgument() const::None

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

7 years ago[ASTMatchers] Sprinkle some constexpr on the global matcher constructors.
Benjamin Kramer [Mon, 30 Jan 2017 18:20:00 +0000 (18:20 +0000)]
[ASTMatchers] Sprinkle some constexpr on the global matcher constructors.

This dramatically reduces the size of the global constructors we emit
for those variables in debug mode.

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

7 years agoAdjust tests after folding inlining analysis into missed remarks
Adam Nemet [Mon, 30 Jan 2017 16:22:50 +0000 (16:22 +0000)]
Adjust tests after folding inlining analysis into missed remarks

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

7 years ago[AST] Make header standalone.
Benjamin Kramer [Mon, 30 Jan 2017 16:00:57 +0000 (16:00 +0000)]
[AST] Make header standalone.

Most implementations get ptrdiff_t transitively, some don't. Explicitly
include cstddef.

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

7 years ago[IRGen] Make header standalone.
Benjamin Kramer [Mon, 30 Jan 2017 15:39:18 +0000 (15:39 +0000)]
[IRGen] Make header standalone.

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

7 years agoRevert "r293343 - [ubsan] Sanity-check shift amounts before truncation
Alex Lorenz [Mon, 30 Jan 2017 11:37:18 +0000 (11:37 +0000)]
Revert "r293343 - [ubsan] Sanity-check shift amounts before truncation
(fixes PR27271)"

After r293343 clang fails to compile itself with -fsanitize=undefined (
http://lab.llvm.org:8080/green/job/clang-stage2-cmake-RgSan_build/).

rdar://30259929

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

7 years agoRevert r293455, which breaks v8 with a spurious error. Testcase added.
Sam McCall [Mon, 30 Jan 2017 10:44:11 +0000 (10:44 +0000)]
Revert r293455, which breaks v8 with a spurious error. Testcase added.

Summary: Revert r293455, which breaks v8 with a spurious error. Testcase added.

Reviewers: klimek

Subscribers: cfe-commits, rsmith

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

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

7 years ago[c-index-test] CMake: add missing reference to clangSerialization library.
Argyrios Kyrtzidis [Mon, 30 Jan 2017 07:11:27 +0000 (07:11 +0000)]
[c-index-test] CMake: add missing reference to clangSerialization library.

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

7 years agoclang-format: [JavaScript] Undo r291974 for JavaScript.
Daniel Jasper [Mon, 30 Jan 2017 07:08:40 +0000 (07:08 +0000)]
clang-format: [JavaScript] Undo r291974 for JavaScript.

This had significant negative consequences and I don't have a good
solution for it yet.

Before:
  var string =
      [
        'aaaaaa',
        'bbbbbb',
      ]
          .join('+');

After:
  var string = [
    'aaaaaa',
    'bbbbbb',
  ].join('+');

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

7 years ago[index] CMake: add missing reference to clangSerialization library.
Argyrios Kyrtzidis [Mon, 30 Jan 2017 06:48:27 +0000 (06:48 +0000)]
[index] CMake: add missing reference to clangSerialization library.

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

7 years agoReapply "DebugInfo: Omit class definitions even in the presence of available_external...
David Blaikie [Mon, 30 Jan 2017 06:36:08 +0000 (06:36 +0000)]
Reapply "DebugInfo: Omit class definitions even in the presence of available_externally vtables"

Accounts for a case that caused an assertion failure by attempting to
query for the vtable linkage of a non-dynamic type.t

This reverts commit r292801.

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

7 years ago[c-index-test] Provide capability to index module file imports and dump their input...
Argyrios Kyrtzidis [Mon, 30 Jan 2017 06:05:58 +0000 (06:05 +0000)]
[c-index-test] Provide capability to index module file imports and dump their input files.

This ensures the capability to index a module file using an existing ASTReader from a compiler instance or ASTUnit.

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

7 years agoTidy up codegen modules test & make it x86 specific since it relies on Itanium name...
David Blaikie [Mon, 30 Jan 2017 05:33:51 +0000 (05:33 +0000)]
Tidy up codegen modules test & make it x86 specific since it relies on Itanium name manglings

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

7 years agoPrototype of modules codegen
David Blaikie [Mon, 30 Jan 2017 05:00:26 +0000 (05:00 +0000)]
Prototype of modules codegen

First pass at generating weak definitions of inline functions from module files
(& skipping (-O0) or emitting available_externally (optimizations)
definitions where those modules are used).

External functions defined in modules are emitted into the modular
object file as well (this may turn an existing ODR violation (if that
module were imported into multiple translations) into valid/linkable
code).

Internal symbols (static functions, for example) are not correctly
supported yet. The symbol will be produced, internal, in the modular
object - unreferenceable from the users.

Reviewers: rsmith

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

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

7 years agoTowards P0091R3: parsing support for class template argument deduction in typename...
Richard Smith [Mon, 30 Jan 2017 04:38:28 +0000 (04:38 +0000)]
Towards P0091R3: parsing support for class template argument deduction in typename-specifiers.

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

7 years ago[OpenMP][NVPTX][CUDA] Adding support for printf for an NVPTX OpenMP device.
Arpith Chacko Jacob [Sun, 29 Jan 2017 20:49:31 +0000 (20:49 +0000)]
[OpenMP][NVPTX][CUDA] Adding support for printf for an NVPTX OpenMP device.

Support for CUDA printf is exploited to support printf for
an NVPTX OpenMP device.

To reflect the support of both programming models, the file
CGCUDABuiltin.cpp has been renamed to CGGPUBuiltin.cpp, and
the call EmitCUDADevicePrintfCallExpr has been renamed to
EmitGPUDevicePrintfCallExpr.

Reviewers: jlebar
Differential Revision: https://reviews.llvm.org/D17890

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

7 years ago[windows] [asan] Add linker flag when including "asan_dynamic_runtime_thunk".
Marcos Pividori [Sun, 29 Jan 2017 06:03:05 +0000 (06:03 +0000)]
[windows] [asan] Add linker flag when including "asan_dynamic_runtime_thunk".

I modify clang driver for windows to include:
"-wholearchive:asan_dynamic_runtime_thunk", so all object files in the
static library: asan_dynamic_runtime_thunk are considered by the linker.
This is necessary, because some object files only include linker pragmas,
and doesn't resolve any symbol. If we don't include that flag, the
linker will ignore them, and won't read the linker pragmas.

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

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

7 years ago[scan-build-py] remove not used flag
Laszlo Nagy [Sun, 29 Jan 2017 04:59:32 +0000 (04:59 +0000)]
[scan-build-py] remove not used flag

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

7 years ago[c-index-test] Provide capability for 'c-index-test core' to dump symbol information...
Argyrios Kyrtzidis [Sun, 29 Jan 2017 04:50:35 +0000 (04:50 +0000)]
[c-index-test] Provide capability for 'c-index-test core' to dump symbol information from a PCH/module file.

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

7 years agoModules: Fix a minor performance bug from r293393
Duncan P. N. Exon Smith [Sun, 29 Jan 2017 04:42:21 +0000 (04:42 +0000)]
Modules: Fix a minor performance bug from r293393

Oops... r293393 started calling ReadSignature in
ModuleManager::addModule even when there was no ExpectedSignature.

Whether or not this would have a measurable performance impact (I
spotted this by inspection, and ReadSignature should be fairly fast), we
might as well get what we can.  Add an extra check against
ExpectedSignature to avoid the hit.

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

7 years agoModules: Simplify the ModuleFile constructor; likely NFC
Duncan P. N. Exon Smith [Sun, 29 Jan 2017 00:39:09 +0000 (00:39 +0000)]
Modules: Simplify the ModuleFile constructor; likely NFC

Zero-initialize ModuleFile members directly in the class definition, and
move the (now uninteresting) constructor into the class definition.

There were a few members that weren't being initialized at all.  I
zero-initialized them for consistency, but it's likely that they were
somehow initialized before their first use; i.e., there's likely no
functionality change here.

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

7 years agoModules: Return early in ModuleManager::addModule; NFC
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 23:22:40 +0000 (23:22 +0000)]
Modules: Return early in ModuleManager::addModule; NFC

Invert the main branch in ModuleManager::addModule to return early and
reduce indentation, and clean up a bunch of logic as a result.  I split
out a function called updateModuleImports to avoid triggering code
duplication.

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

7 years agoModules: Clean up ModuleFile::Imports in ModuleManager::removeModules
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 23:12:13 +0000 (23:12 +0000)]
Modules: Clean up ModuleFile::Imports in ModuleManager::removeModules

I don't have a testcase for this (and I'm not sure if it's an observable
bug), but it seems obviously wrong that ModuleManager::removeModules is
failing to clean up deleted modules from ModuleFile::Imports.  See the
code in ModuleManager::addModule that inserts into ModuleFile::Imports;
we need the inverse operation.

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

7 years agoModules: Enforce that ModuleManager::removeModules deletes the tail
Duncan P. N. Exon Smith [Sat, 28 Jan 2017 23:02:12 +0000 (23:02 +0000)]
Modules: Enforce that ModuleManager::removeModules deletes the tail

ModuleManager::removeModules always deletes a tail of the
ModuleManager::Chain.  Change the API to enforce that so that we can
simplify the code inside.

There's no real functionality change, although there's a slight
performance hack to loop to the First deleted module instead of the
final module in the chain (skipping the about-to-be-deleted tail).

Also document something suspicious: we fail to clean deleted modules out
of ModuleFile::Imports.

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