]> granicus.if.org Git - clang/log
clang
7 years agoFix recording preamble's conditional stack in skipped PP branches.
Ilya Biryukov [Tue, 12 Sep 2017 08:35:57 +0000 (08:35 +0000)]
Fix recording preamble's conditional stack in skipped PP branches.

Summary:
This fixes PR34547.
`Lexer::LexEndOfFile` handles recording of ConditionalStack for
preamble and reporting errors about unmatched conditionalal PP
directives.
However, SkipExcludedConditionalBlock contianed duplicated logic for
reporting errors and clearing ConditionalStack, but not for preamble
recording.

This fix removes error reporting logic from
`SkipExcludedConditionalBlock`, unmatched PP conditionals are now
reported inside `Lexer::LexEndOfFile`.

Reviewers: erikjv, klimek, bkramer

Reviewed By: erikjv

Subscribers: nik, cfe-commits

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

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

7 years ago[X86] Lower _mm[256|512]_[mask[z]]_avg_epu[8|16] intrinsics to native llvm IR
Yael Tsafrir [Tue, 12 Sep 2017 07:46:32 +0000 (07:46 +0000)]
[X86] Lower _mm[256|512]_[mask[z]]_avg_epu[8|16] intrinsics to native llvm IR

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

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

7 years ago[Driver] Fuchsia targets default to -fasynchronous-unwind-tables
Petr Hosek [Tue, 12 Sep 2017 01:28:37 +0000 (01:28 +0000)]
[Driver] Fuchsia targets default to -fasynchronous-unwind-tables

This regressed for x86-64 in r307856 because it's no longer inherited
from Generic_GCC. We'd never noticed that it was missing other
targets (i.e. aarch64), but Fuchsia is uniform across all machines.

Patch by Roland McGrath

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

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

7 years agoFix broken links to the Itanium CXX ABI
Vlad Tsyrklevich [Tue, 12 Sep 2017 00:21:17 +0000 (00:21 +0000)]
Fix broken links to the Itanium CXX ABI

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

7 years ago[codeview] omit debug locations for nested exprs unless column info enabled
Bob Haarman [Mon, 11 Sep 2017 22:11:57 +0000 (22:11 +0000)]
[codeview] omit debug locations for nested exprs unless column info enabled

Summary:
Microsoft Visual Studio expects debug locations to correspond to
statements. We used to emit locations for expressions nested inside statements.
This would confuse the debugger, causing it to stop multiple times on the
same line and breaking the "step into specific" feature. This change inhibits
the emission of debug locations for nested expressions when emitting CodeView
debug information, unless column information is enabled.

Fixes PR34312.

Reviewers: rnk, zturner

Reviewed By: rnk

Subscribers: majnemer, echristo, aprantl, cfe-commits

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

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

7 years ago[Driver] Support ubsan-minimal on Darwin
Vedant Kumar [Mon, 11 Sep 2017 21:37:06 +0000 (21:37 +0000)]
[Driver] Support ubsan-minimal on Darwin

Make it possible to use the minimal ubsan runtime on Darwin.

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

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

7 years ago[ubsan-minimal] Document the new runtime
Vedant Kumar [Mon, 11 Sep 2017 21:37:05 +0000 (21:37 +0000)]
[ubsan-minimal] Document the new runtime

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

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

7 years ago[Lexer] Report more precise skipped regions (PR34166)
Vedant Kumar [Mon, 11 Sep 2017 20:47:42 +0000 (20:47 +0000)]
[Lexer] Report more precise skipped regions (PR34166)

This patch teaches the preprocessor to report more precise source ranges for
code that is skipped due to conditional directives.

The new behavior includes the '#' from the opening directive and the full text
of the line containing the closing directive in the skipped area. This matches
up clang's behavior (we don't IRGen the code between the closing "endif" and
the end of a line).

This also affects the code coverage implementation. See llvm.org/PR34166 (this
also happens to be rdar://problem/23224058).

The old behavior (report the end of the skipped range as the end
location of the 'endif' token) is preserved for indexing clients.

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

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

7 years agoclang-rename: let -force handle multiple renames
Miklos Vajna [Mon, 11 Sep 2017 20:18:38 +0000 (20:18 +0000)]
clang-rename: let -force handle multiple renames

Summary:
The use case is that renaming multiple symbols in a large enough codebase is
much faster if all of these can be done with a single invocation, but
there will be multiple translation units where one or more symbols are
not found.

Old behavior was to exit with an error (default) or exit without
reporting an error (-force). New behavior is that -force results in a
best-effort rename: rename symbols which are found and just ignore the
rest.

The existing help for -force sort of already implies this behavior.

Reviewers: cfe-commits, klimek, arphaman

Reviewed By: klimek

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

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

7 years agoDriver: default to `-fno-use-cxatexit` on Windows
Saleem Abdulrasool [Mon, 11 Sep 2017 20:18:09 +0000 (20:18 +0000)]
Driver: default to `-fno-use-cxatexit` on Windows

This primarily impacts the Windows MSVC and Windows itanium
environments.  Windows MSVC does not use `__cxa_atexit` and Itanium
follows suit.  Simplify the logic for the default value calculation and
blanket the Windows environments to default to off for use of
`__cxa_atexit`.

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

7 years agoclang-format: [JS] wrap and indent `goog.setTestOnly` calls.
Martin Probst [Mon, 11 Sep 2017 15:22:52 +0000 (15:22 +0000)]
clang-format: [JS] wrap and indent `goog.setTestOnly` calls.

Summary:
While `goog.setTestOnly` usually appears in the imports section of a file, it is
not actually an import, and also usually doesn't take long parameters (nor
namespaces as a parameter, it's a description/message that should be wrapped).

This fixes a regression where a `goog.setTestOnly` call nested in a function was
not wrapped.

Reviewers: djasper

Subscribers: klimek

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

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

7 years ago[PCH] Allow VFS to be used for tests that generate PCH files
Cameron Desrochers [Mon, 11 Sep 2017 15:03:23 +0000 (15:03 +0000)]
[PCH] Allow VFS to be used for tests that generate PCH files

When using a virtual file-system (VFS) and a preamble file (PCH) is generated,
it is generated on-disk in the real file-system instead of in the VFS (which
makes sense, since the VFS is read-only). However, when subsequently reading
the generated PCH, the frontend passes through the VFS it has been given --
resulting in an error and a failed parse (since the VFS doesn't contain the
PCH; the real filesystem does).

This patch fixes that by detecting when a VFS is being used for a parse that
needs to work with a PCH file, and creating an overlay VFS that includes the
PCH file from the real file-system.

This allows tests to be written which make use of both PCH files and a VFS.

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

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

7 years ago[AST] Make RecursiveASTVisitor visit TemplateDecls in source order
Johannes Altmanninger [Mon, 11 Sep 2017 13:12:30 +0000 (13:12 +0000)]
[AST] Make RecursiveASTVisitor visit TemplateDecls in source order

Summary:
This causes template arguments to be traversed before the templated
declaration, which is useful for clients that expect the nodes in
the same order as they are in the source code. Additionally, there
seems to be no good reason not to do so.

This was moved here from LexicallyOrderedRecursiveASTVisitor. The tests
still reside in LexicallyOrderedRecursiveASTVisitorTest.cpp under
VisitTemplateDecls.

Reviewers: arphaman, rsmith, klimek

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Fixed one-line if statement
Krasimir Georgiev [Mon, 11 Sep 2017 10:12:16 +0000 (10:12 +0000)]
[clang-format] Fixed one-line if statement

Summary:
**Short overview:**

Fixed bug: https://bugs.llvm.org/show_bug.cgi?id=34001
Clang-format bug resulting in a strange behavior of control statements short blocks. Different flags combinations do not guarantee expected result. Turned on option AllowShortBlocksOnASingleLine does not work as intended.

**Description of the problem:**

Cpp source file UnwrappedLineFormatter does not handle AllowShortBlocksOnASingleLine flag as it should. Putting a single-line control statement without any braces, clang-format works as expected (depending on AllowShortIfStatementOnASingleLine or AllowShortLoopsOnASingleLine value). Putting a single-line control statement in braces, we can observe strange and incorrect behavior.
Our short block is intercepted by tryFitMultipleLinesInOne function. The function returns a number of lines to be merged. Unfortunately, our control statement block is not covered properly. There are several if-return statements, but none of them handles our block. A block is identified by the line first token and by left and right braces. A function block works as expected, there is such an if-return statement doing proper job. A control statement block, from the other hand, falls into strange conditional construct, which depends on BraceWrapping.AfterFunction flag (with condition that the line’s last token is left brace, what is possible in our case) or goes even further. That should definitely not happen.

**Description of the patch:**

By adding three different if statements, we guarantee that our short control statement block, however it looks like (different brace wrapping flags may be turned on), is handled properly and does not fall into wrong conditional construct. Depending on appropriate options we return either 0 (when something disturbs our merging attempt) or let another function (tryMergeSimpleBlock) take the responsibility of returned result (number of merged lines). Nevertheless, one more correction is required in mentioned tryMergeSimpleBlock function. The function, previously, returned either 0 or 2. The problem was that this did not handle the case when our block had the left brace in a separate line, not the header one. After change, after adding condition, we return the result compatible with block’s structure. In case of left brace in the header’s line we do everything as before the patch. In case of left brace in a separate line we do the job similar to the one we do in case of a “non-header left brace” function short block. To be precise, we try to merge the block ignoring the header line. Then, if success, we increment our returned result.

**After fix:**

**CONFIG:**
```
AllowShortBlocksOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
BreakBeforeBraces: Custom
BraceWrapping: {
AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true
}
```
**BEFORE:**
```
if (statement) doSomething();
if (statement) { doSomething(); }
if (statement) {
    doSomething();
}
if (statement)
{
    doSomething();
}
if (statement)
    doSomething();
if (statement) {
    doSomething1();
    doSomething2();
}
```
**AFTER:**
```
if (statement) doSomething();
if (statement) { doSomething(); }
if (statement) { doSomething(); }
if (statement) { doSomething(); }
if (statement) doSomething();
if (statement)
{
  doSomething1();
  doSomething2();
}
```

Contributed by @PriMee!

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get alignment...
Daniel Jasper [Mon, 11 Sep 2017 07:35:01 +0000 (07:35 +0000)]
Revert r312830: "Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr"."

This triggers llvm.org/PR31620 in several of our internal builds. I'll
forward reproduction instructions to the original author.

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

7 years agoAdd objcImplementationDecl matcher
Dave Lee [Sun, 10 Sep 2017 21:00:15 +0000 (21:00 +0000)]
Add objcImplementationDecl matcher

Summary:
Add the `objcImplementationDecl` matcher. See related: D30854

Tested with:

```
./tools/clang/unittests/ASTMatchers/ASTMatchersTests
```

Reviewers: aaron.ballman, compnerd, alexshap

Reviewed By: aaron.ballman

Subscribers: klimek, cfe-commits

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

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

7 years ago[clang][SemaStmtAsm] small refactoring, NFC.
Coby Tayree [Sun, 10 Sep 2017 12:39:21 +0000 (12:39 +0000)]
[clang][SemaStmtAsm] small refactoring, NFC.

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

7 years agoset the svn:executable property, seems that it is necessary for apache (discussed...
Sylvestre Ledru [Sun, 10 Sep 2017 08:00:03 +0000 (08:00 +0000)]
set the svn:executable property, seems that it is necessary for apache (discussed with Tanya by email)

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

7 years agoclang fix for LLVM API change: isKnownNonNull -> isKnownNonZero
Nuno Lopes [Sat, 9 Sep 2017 18:25:36 +0000 (18:25 +0000)]
clang fix for LLVM API change: isKnownNonNull -> isKnownNonZero

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

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

7 years ago[Basic] Update CMakeLists.txt to handle repo
MinSeong Kim [Sat, 9 Sep 2017 14:18:53 +0000 (14:18 +0000)]
[Basic] Update CMakeLists.txt to handle repo

Summary:
The find_first_existing_file and find_first_existing_vc_file macros in
lib/Basic/CMakeLists.txt are removed. The macros are also defined in
{LLVM}/cmake/modules/AddLLVM.cmake for the same purpose. This change
serves the following 2 objectives:

    1. To remove the redundant code in clang to use the same
       macros in llvm,
    2. The macros in AddLLVM.cmake can also handle repo for
       displaying correct version information.

Reviewers: jordan_rose, cfe-commits, modocache, hintonda

Reviewed By: hintonda

Subscribers: mgorny

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

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

7 years agoFix ownership of the MemoryBuffer in a FrontendInputFile.
Richard Smith [Sat, 9 Sep 2017 01:14:04 +0000 (01:14 +0000)]
Fix ownership of the MemoryBuffer in a FrontendInputFile.

This fixes a possible crash on certain kinds of corrupted AST file, but
checking in an AST file corrupted in just the right way will be a maintenance
nightmare because the format changes frequently.

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

7 years ago[cxx_status] Change "Clang 5" items from yellow to green now that Clang 5 has been...
Richard Smith [Sat, 9 Sep 2017 01:11:04 +0000 (01:11 +0000)]
[cxx_status] Change "Clang 5" items from yellow to green now that Clang 5 has been released.

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

7 years agoCatch more cases with -Wenum-compare
Richard Trieu [Sat, 9 Sep 2017 00:25:05 +0000 (00:25 +0000)]
Catch more cases with -Wenum-compare

Treat typedef enum as named enums instead of anonymous enums.  Anonymous enums
are ignored by the warning, so previously, typedef enums were ignored as well.

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

7 years agoCodeGen: correct arguments for NSFastEnumeration
Saleem Abdulrasool [Fri, 8 Sep 2017 23:41:17 +0000 (23:41 +0000)]
CodeGen: correct arguments for NSFastEnumeration

When performing a NSFastEnumeration, the compiler synthesizes a call to
`countByEnumeratingWithState:objects:count:` where the `count` parameter
is of type `NSUInteger` and the return type is a `NSUInteger`.  We would
previously always use a `UnsignedLongTy` for the `NSUInteger` type.  On
32-bit targets, `long` is 32-bits which is the same as `unsigned int`.
Most 64-bit targets are LP64, where `long` is 64-bits.  However, on
LLP64 targets, such as Windows, `long` is 32-bits.  Introduce new
`getNSUIntegerType` and `getNSIntegerType` helpers to allow us to
determine the correct type for the `NSUInteger` type.  Wire those
through into the generation of the message dispatch to the selector.

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

7 years agoReinstall the patch "Use EmitPointerWithAlignment to get alignment information of...
Wei Mi [Fri, 8 Sep 2017 21:58:18 +0000 (21:58 +0000)]
Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr".

This is to fix PR34347. EmitAtomicExpr now only uses alignment information from
Type, instead of Decl, so when the declaration of an atomic variable is marked
to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and
will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment
to get the precise alignment information.

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

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

7 years ago[Coverage] Precise region termination with deferred regions (reapply)
Vedant Kumar [Fri, 8 Sep 2017 18:44:56 +0000 (18:44 +0000)]
[Coverage] Precise region termination with deferred regions (reapply)

The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':

  void f() {
    if (true) {
      return; // The `if' body's region is terminated here.
    }
    // This line gets the same coverage as the `if' condition.
  }

If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.

The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.

Testing: lit test updates, a stage2 coverage-enabled build of clang

This is a reapplication but there are no changes from the original commit.
With D36813, the segment builder in llvm will be able to handle deferred
regions correctly.

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

7 years agoAdd some documentation on how to generate the documentation.
Aaron Ballman [Fri, 8 Sep 2017 18:40:39 +0000 (18:40 +0000)]
Add some documentation on how to generate the documentation.

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

7 years agoDelete empty file test/CodeGenCXX/atomic-align.cpp after the revert at rL312805.
Wei Mi [Fri, 8 Sep 2017 18:31:21 +0000 (18:31 +0000)]
Delete empty file test/CodeGenCXX/atomic-align.cpp after the revert at rL312805.

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

7 years agoRevert rL312801 since it generated some calls from libatomic and broke some tests.
Wei Mi [Fri, 8 Sep 2017 18:10:13 +0000 (18:10 +0000)]
Revert rL312801 since it generated some calls from libatomic and broke some tests.

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

7 years agoUse EmitPointerWithAlignment to get alignment information of the pointer used in...
Wei Mi [Fri, 8 Sep 2017 17:07:32 +0000 (17:07 +0000)]
Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr.

This is to fix PR34347. EmitAtomicExpr now only uses alignment information from
Type, instead of Decl, so when the declaration of an atomic variable is marked
to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and
will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment
to get the precise alignment information.

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

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

7 years agoAdd _Float16 as a C/C++ source language type
Sjoerd Meijer [Fri, 8 Sep 2017 16:43:10 +0000 (16:43 +0000)]
Add _Float16 as a C/C++ source language type

Pacify the windows builder; fixed the new test as on Windows some additional
attributes are printed.

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

7 years agoAdd '\n' in ClangDataCollectorsEmitter
Konstantin Zhuravlyov [Fri, 8 Sep 2017 16:17:16 +0000 (16:17 +0000)]
Add '\n' in ClangDataCollectorsEmitter

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

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

7 years agoRecommit "Add _Float16 as a C/C++ source language type"
Sjoerd Meijer [Fri, 8 Sep 2017 15:15:00 +0000 (15:15 +0000)]
Recommit "Add _Float16 as a C/C++ source language type"

This is a recommit of r312781; in some build configurations
variable names are omitted, so changed the new regression
test accordingly.

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

7 years ago[Sema] Put tautological comparison of unsigned and zero into it's own flag
Roman Lebedev [Fri, 8 Sep 2017 13:56:45 +0000 (13:56 +0000)]
[Sema] Put tautological comparison of unsigned and zero into it's own flag

Summary:
As requested by Sam McCall.

```
$ /build/llvm-build-Clang-release/./bin/clang -c /build/clang/test/Sema/outof-range-constant-compare.c /build/clang/test/Sema/outof-range-constant-compare.c:40:11: warning: comparison of unsigned expression < 0 is always false [-Wtautological-unsigned-zero-compare]
    if (a < 0x0000000000000000UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
        ~ ^ ~~~~~~~~~~~~~~~~~~~~
```

Reviewers: sammccall, bkramer, djasper, rsmith, rjmccall, aaron.ballman

Reviewed By: sammccall, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

Tags: #clang

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

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

7 years agoUpdated two annotations for Store.h and CodeGenFunction.h.
Krasimir Georgiev [Fri, 8 Sep 2017 13:44:51 +0000 (13:44 +0000)]
Updated two annotations for Store.h and CodeGenFunction.h.

Summary:
1.Updated annotations for include/clang/StaticAnalyzer/Core/PathSensitive/Store.h, which belong to the old version of clang.
2.Delete annotations for CodeGenFunction::getEvaluationKind() in clang/lib/CodeGen/CodeGenFunction.h, which belong to the old version of clang.

Reviewers: bkramer, krasimir, klimek

Reviewed By: bkramer

Subscribers: MTC

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

Contributed by @MTC!

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

7 years agoFixed a crash in code completion.
Ilya Biryukov [Fri, 8 Sep 2017 13:36:38 +0000 (13:36 +0000)]
Fixed a crash in code completion.

Summary: The crash occured when FunctionDecl was parsed with an initializer.

Reviewers: bkramer, klimek, francisco.lopes

Reviewed By: bkramer

Subscribers: cfe-commits

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

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

7 years agoDon't show deleted function (constructor) candidates for code completion
Erik Verbruggen [Fri, 8 Sep 2017 10:23:08 +0000 (10:23 +0000)]
Don't show deleted function (constructor) candidates for code completion

In case of copy constructor is implicitly deleted it's still shown.
PR34402 describes a way to reproduce that.

Patch by Ivan Donchevskii!

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

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

7 years agoRevert "Add _Float16 as a C/C++ source language type"
Sjoerd Meijer [Fri, 8 Sep 2017 10:20:52 +0000 (10:20 +0000)]
Revert "Add _Float16 as a C/C++ source language type"

The clang-with-lto-ubuntu bot didn't like the new regression
test, revert while I investigate the issue.

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

7 years agoAdd _Float16 as a C/C++ source language type
Sjoerd Meijer [Fri, 8 Sep 2017 09:42:32 +0000 (09:42 +0000)]
Add _Float16 as a C/C++ source language type

This adds _Float16 as a source language type, which is a 16-bit floating point
type defined in C11 extension ISO/IEC TS 18661-3.

In follow up patches documentation and more tests will be added.

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

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

7 years agoFix templated type alias completion when using global completion cache
Erik Verbruggen [Fri, 8 Sep 2017 09:31:13 +0000 (09:31 +0000)]
Fix templated type alias completion when using global completion cache

When we have enabled cache for global completions we did not have
diagnostics for Bar and could not complete Ba as in provided code
example.

template <typename T>
struct Foo { T member; };

template<typename T> using Bar = Foo<T>;

int main() {
   Ba
}

(This is the fixed version of r 311442, which was reverted in r311445.)

Patch by Ivan Donchevskii!

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

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

7 years agoCOFF: Implement ThinLTO cache and cache pruning support.
Peter Collingbourne [Fri, 8 Sep 2017 00:50:50 +0000 (00:50 +0000)]
COFF: Implement ThinLTO cache and cache pruning support.

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

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

7 years agoUpdate for llvm change.
Rafael Espindola [Fri, 8 Sep 2017 00:01:26 +0000 (00:01 +0000)]
Update for llvm change.

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

7 years ago[Sema] -Wtautological-compare: handle comparison of unsigned with 0S.
Roman Lebedev [Thu, 7 Sep 2017 22:14:25 +0000 (22:14 +0000)]
[Sema] -Wtautological-compare: handle comparison of unsigned with 0S.

Summary:
This is a first half(?) of a fix for the following bug:
https://bugs.llvm.org/show_bug.cgi?id=34147 (gcc -Wtype-limits)

GCC's -Wtype-limits does warn on comparison of unsigned value
with signed zero (as in, with 0), but clang only warns if the
zero is unsigned (i.e. 0U).

Also, be careful not to double-warn, or falsely warn on
comparison of signed/fp variable and signed 0.

Yes, all these testcases are needed.

Testing: $ ninja check-clang-sema check-clang-semacxx
Also, no new warnings for clang stage-2 build.

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rjmccall

Subscribers: cfe-commits

Tags: #clang

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

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

7 years agoAdd target triple to improve the happiness of MSVC buildbots.
Richard Smith [Thu, 7 Sep 2017 22:07:52 +0000 (22:07 +0000)]
Add target triple to improve the happiness of MSVC buildbots.

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

7 years agoFix validation of the -mthread-model flag in the Clang driver
Jonathan Roelofs [Thu, 7 Sep 2017 22:01:25 +0000 (22:01 +0000)]
Fix validation of the -mthread-model flag in the Clang driver

The ToolChain class validates the -mthread-model flag in the constructor which
doesn't work correctly since the thread model methods are virtual methods. The
check is moved into Clang::ConstructJob() when constructing the internal
command line.

https://reviews.llvm.org/D37496

Patch by: Ian Tessier!

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

7 years agoAdd IDNS_Tag to C++ declarations that conflict with tag declarations.
Richard Smith [Thu, 7 Sep 2017 20:22:00 +0000 (20:22 +0000)]
Add IDNS_Tag to C++ declarations that conflict with tag declarations.

Fixes some accepts-invalids with tags and other declarations declared in the
same scope.

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

7 years ago[OpenCL] Add half load and store builtins
Jan Vesely [Thu, 7 Sep 2017 19:39:10 +0000 (19:39 +0000)]
[OpenCL] Add half load and store builtins

This enables load/stores of half type, without half being a legal type.

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

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

7 years ago[CUDA] When compilation fails, print the compilation mode.
Justin Lebar [Thu, 7 Sep 2017 18:37:16 +0000 (18:37 +0000)]
[CUDA] When compilation fails, print the compilation mode.

Summary:
That is, instead of "1 error generated", we now say "1 error generated
when compiling for sm_35".

This (partially) solves a usability foogtun wherein e.g. users call a
function that's only defined on sm_60 when compiling for sm_35, and they
get an unhelpful error message.

Reviewers: tra

Subscribers: sanjoy, cfe-commits

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

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

7 years ago[CUDA] Added rudimentary support for CUDA-9 and sm_70.
Artem Belevich [Thu, 7 Sep 2017 18:14:32 +0000 (18:14 +0000)]
[CUDA] Added rudimentary support for CUDA-9 and sm_70.

For now CUDA-9 is not included in the list of CUDA versions clang
searches for, so the path to CUDA-9 must be explicitly passed
via --cuda-path=.

On LLVM side NVPTX added sm_70 GPU type which bumps required
PTX version to 6.0, but otherwise is equivalent to sm_62 at the moment.

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

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

7 years ago[OpenCL] Handle taking an address of block captures.
Anastasia Stulova [Thu, 7 Sep 2017 17:00:33 +0000 (17:00 +0000)]
[OpenCL] Handle taking an address of block captures.

Block captures can have different physical locations
in memory segments depending on the use case (as a function
call or as a kernel enqueue) and in different vendor
implementations.

Therefore it's unclear how to add address space to capture
addresses uniformly. Currently it has been decided to disallow
taking addresses of captured variables until further
clarifications in the spec.

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

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

7 years ago[clang-format] Add support for C++17 structured bindings.
Marek Kurdej [Thu, 7 Sep 2017 14:28:32 +0000 (14:28 +0000)]
[clang-format] Add support for C++17 structured bindings.

Summary:
Before:
```
    auto[a, b] = f();
```

After:
```
    auto [a, b] = f();
```
or, if SpacesInSquareBrackets is true:
```
    auto [ a, b ] = f();
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-format] Fix documentation for AllowAllParametersOfDeclarationOnNextLine
Daniel Jasper [Thu, 7 Sep 2017 13:45:41 +0000 (13:45 +0000)]
[clang-format] Fix documentation for AllowAllParametersOfDeclarationOnNextLine

The current description of AllowAllParametersOfDeclarationOnNextLine in
the Clang-Format Style Options guide suggests that it is possible to
format function declaration, which fits in a single line (what is not
supported in current clang-format version). Also the example was not
reproducible and mades no sense.

Patch by Lucja Mazur, thank you!

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

7 years agoAdd an usage example of BreakBeforeBraces
Sylvestre Ledru [Thu, 7 Sep 2017 12:09:14 +0000 (12:09 +0000)]
Add an usage example of BreakBeforeBraces

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRefresh the clang format options doc with the recent changes
Sylvestre Ledru [Thu, 7 Sep 2017 12:08:49 +0000 (12:08 +0000)]
Refresh the clang format options doc with the recent changes

Summary:
Looks like we are out of sync between the doc and the code.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

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

7 years agoFixing incorrectly capitalised regexps.
Benjamin Kramer [Thu, 7 Sep 2017 09:54:03 +0000 (09:54 +0000)]
Fixing incorrectly capitalised regexps.

Patch by Sam Allen!

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

7 years agoP0702R1: in class template argument deduction from a list of one element, if
Richard Smith [Thu, 7 Sep 2017 07:22:36 +0000 (07:22 +0000)]
P0702R1: in class template argument deduction from a list of one element, if
that element's type is (or is derived from) a specialization of the deduced
template, skip the std::initializer_list special case.

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

7 years ago[mips] Replace Triple::Environment check by the isGNUEnvironment() call. NFC
Simon Atanasyan [Thu, 7 Sep 2017 06:05:06 +0000 (06:05 +0000)]
[mips] Replace Triple::Environment check by the isGNUEnvironment() call. NFC

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

7 years agoFix off-by-one error in block mangling.
Richard Smith [Thu, 7 Sep 2017 05:41:24 +0000 (05:41 +0000)]
Fix off-by-one error in block mangling.

This restores the ABI prior to r214699.

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

7 years ago[modules ts] Add test for [basic.link]p3.
Richard Smith [Thu, 7 Sep 2017 05:29:39 +0000 (05:29 +0000)]
[modules ts] Add test for [basic.link]p3.

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

7 years ago[modules ts] Ensure that module linkage variables are always emitted and always have...
Richard Smith [Thu, 7 Sep 2017 00:55:55 +0000 (00:55 +0000)]
[modules ts] Ensure that module linkage variables are always emitted and always have their name mangled.

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

7 years ago[CUDA] Add device overloads for non-placement new/delete.
Justin Lebar [Thu, 7 Sep 2017 00:37:20 +0000 (00:37 +0000)]
[CUDA] Add device overloads for non-placement new/delete.

Summary:
Tests have to live in the test-suite, and so will come in a separate
patch.

Fixes PR34360.

Reviewers: tra

Subscribers: llvm-commits, sanjoy

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

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

7 years ago[StaticAnalyzer] Fix failures due to the iteration order of ExplodedNode
Mandeep Singh Grang [Wed, 6 Sep 2017 22:54:59 +0000 (22:54 +0000)]
[StaticAnalyzer] Fix failures due to the iteration order of ExplodedNode

Summary:
This fixes failures seen in the reverse iteration builder:
http://lab.llvm.org:8011/builders/reverse-iteration/builds/26

Failing Tests (4):
    Clang :: Analysis/MisusedMovedObject.cpp
    Clang :: Analysis/keychainAPI.m
    Clang :: Analysis/loop-unrolling.cpp
    Clang :: Analysis/malloc.c

Reviewers: zaks.anna, bkramer, chandlerc, krememek, nikhgupt

Reviewed By: zaks.anna

Subscribers: dcoughlin, NoQ, cfe-commits

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

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

7 years ago[CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h
George Karpenkov [Wed, 6 Sep 2017 21:45:03 +0000 (21:45 +0000)]
[CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.h

The implementation is in AnalysisDeclContext.cpp and the class is called
AnalysisDeclContext.

Making those match up has numerous benefits, including:

 - Easier jump from header to/from implementation.
 - Easily identify filename from class.

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

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

7 years ago[NFC] [CSA] Move AnyFunctionCall::getRuntimeDefinition implementation to cpp.
George Karpenkov [Wed, 6 Sep 2017 21:45:01 +0000 (21:45 +0000)]
[NFC] [CSA] Move AnyFunctionCall::getRuntimeDefinition implementation to cpp.

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

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

7 years ago[modules ts] Emit global variables in a module interface unit as part of that unit...
Richard Smith [Wed, 6 Sep 2017 20:01:14 +0000 (20:01 +0000)]
[modules ts] Emit global variables in a module interface unit as part of that unit, not in importers.

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

7 years agoFix ARM bare metal driver to support atomics
Jonathan Roelofs [Wed, 6 Sep 2017 17:09:25 +0000 (17:09 +0000)]
Fix ARM bare metal driver to support atomics

The new bare metal support only supports the single thread model. This causes
the builtin atomic functions (e.g.: __atomic_fetch_add) to not generate
thread-safe assembly for these operations, which breaks our firmware. We target
bare metal, and need to atomically modify variables in our interrupt routines,
and task threads.

Internally, the -mthread-model flag determines whether to lower or expand
atomic operations (see D4984).

This change removes the overridden thread model methods, and instead relies on
the base ToolChain class to validate the thread model (which already includes
logic to validate single thread model support). If the single thread model is
required, the -mthread-model flag will have to be provided.

As a workaround "-mthread-model posix" could be provided, but it only works due
to a bug in the validation of the -mthread-model flag (separate patch coming to
fix this).

https://reviews.llvm.org/D37493

Patch by: Ian Tessier!

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

7 years ago[OPENMP] Fix for PR33922: New ident_t flags for
Alexey Bataev [Wed, 6 Sep 2017 16:17:35 +0000 (16:17 +0000)]
[OPENMP] Fix for PR33922: New ident_t flags for
__kmpc_for_static_fini().

Added special flags for calls of __kmpc_for_static_fini(), like previous
ly for __kmpc_for_static_init(). Added flag OMP_IDENT_WORK_DISTRIBUTE
for distribute cnstruct, OMP_IDENT_WORK_SECTIONS for sections-based
  constructs and OMP_IDENT_WORK_LOOP for loop-based constructs in
  location flags.

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

7 years agoReplacing "or" with "||" to appease MSVC.
Aaron Ballman [Wed, 6 Sep 2017 15:12:05 +0000 (15:12 +0000)]
Replacing "or" with "||" to appease MSVC.

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

7 years ago[OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime in
Alexey Bataev [Wed, 6 Sep 2017 14:49:58 +0000 (14:49 +0000)]
[OPENMP] Fix for PR34445: Reduction initializer segfaults at runtime in
move constructor.

Previously user-defined reduction initializer was considered as an
assignment expression, not as initializer. Fixed this by treating the
initializer expression as an initializer.

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

7 years ago[AST] Add TableGen for StmtDataCollectors
Johannes Altmanninger [Wed, 6 Sep 2017 13:20:51 +0000 (13:20 +0000)]
[AST] Add TableGen for StmtDataCollectors

Summary:
This adds an option "-gen-clang-data-collectors" to the Clang TableGen
that is used to generate StmtDataCollectors.inc.

Reviewers: arphaman, teemperor!

Subscribers: mgorny, cfe-commits

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

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

7 years ago[AST] Traverse CXXOperatorCallExpr in LexicallyOrderedRecursiveASTVisitor
Johannes Altmanninger [Wed, 6 Sep 2017 13:12:11 +0000 (13:12 +0000)]
[AST] Traverse CXXOperatorCallExpr in LexicallyOrderedRecursiveASTVisitor

Summary:
This affects overloaded operators, which are represented by a
CXXOperatorCallExpr whose first child is always a DeclRefExpr referring to the
operator. For infix, postfix and call operators we want the first argument
to be traversed before the operator.

Reviewers: arphaman

Subscribers: klimek, cfe-commits

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

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

7 years ago[AST] Traverse templates in LexicallyOrderedRecursiveASTVisitor
Johannes Altmanninger [Wed, 6 Sep 2017 13:11:13 +0000 (13:11 +0000)]
[AST] Traverse templates in LexicallyOrderedRecursiveASTVisitor

Summary:
We need to specialize this because RecursiveASTVisitor visits template
template parameters after the templated declaration, unlike the order in
which they appear in the source code.

Reviewers: arphaman

Reviewed By: arphaman

Subscribers: klimek, cfe-commits

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

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

7 years agoCorrected testcase to work with release build
Karl-Johan Karlsson [Wed, 6 Sep 2017 10:12:32 +0000 (10:12 +0000)]
Corrected testcase to work with release build

The fault was introduced in r312623

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

7 years agoDebug info: Fixed faulty debug locations for attributed statements
Karl-Johan Karlsson [Wed, 6 Sep 2017 08:47:18 +0000 (08:47 +0000)]
Debug info: Fixed faulty debug locations for attributed statements

Summary:
As the attributed statements are considered simple statements no
stoppoint was generated before emitting attributed do/while/for/range-
statement. This lead to faulty debug locations.

Reviewers: echristo, aaron.ballman, dblaikie

Reviewed By: dblaikie

Subscribers: bjope, aprantl, cfe-commits

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

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

7 years agoFix __repr__ for Diagnostic in clang.cindex
Jonathan Coe [Wed, 6 Sep 2017 07:33:32 +0000 (07:33 +0000)]
Fix __repr__ for Diagnostic in clang.cindex

Summary: Also move misplaced tests for exception specification to fix failing Python tests.

Reviewers: hans, compnerd

Reviewed By: compnerd

Subscribers: cfe-commits

Tags: #clang-c

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

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

7 years agoDriver: delete some dead code (NFC)
Saleem Abdulrasool [Wed, 6 Sep 2017 05:11:19 +0000 (05:11 +0000)]
Driver: delete some dead code (NFC)

This code has been `#if 0`'ed out for a very long time.  After speaking
with Duncan, opt to remove it even if it is something which should be
fixed.  If the underlying issue is still valid, this can be restored
with proper explanation and tests.

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

7 years agoDriver: remove unused variable (NFC)
Saleem Abdulrasool [Wed, 6 Sep 2017 04:56:23 +0000 (04:56 +0000)]
Driver: remove unused variable (NFC)

Remove `IsHosted` which is no longer needed in `RenderSSPOptions` after
SVN r312595.  The single use can now be inlined.  NFC

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

7 years agoFix indentation mistake from r312595
Bruno Cardoso Lopes [Wed, 6 Sep 2017 00:44:10 +0000 (00:44 +0000)]
Fix indentation mistake from r312595

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

7 years ago[Darwin] Enable -fstack-protector (back) by default with -ffreestanding
Bruno Cardoso Lopes [Tue, 5 Sep 2017 23:50:58 +0000 (23:50 +0000)]
[Darwin] Enable -fstack-protector (back) by default with -ffreestanding

Go back to behavior prior to r289005.

rdar://problem/32987198

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

7 years agoFix memory leak after r312467. The ModuleMap is the owner of the global module object...
Richard Smith [Tue, 5 Sep 2017 21:46:22 +0000 (21:46 +0000)]
Fix memory leak after r312467. The ModuleMap is the owner of the global module object until it's reparented under a real module.

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

7 years agoCommit changes missing from r312572
Reid Kleckner [Tue, 5 Sep 2017 20:38:29 +0000 (20:38 +0000)]
Commit changes missing from r312572

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

7 years ago[ms] Implement the __annotation intrinsic
Reid Kleckner [Tue, 5 Sep 2017 20:27:35 +0000 (20:27 +0000)]
[ms] Implement the __annotation intrinsic

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

7 years ago[coroutines] Make sure auto return type of await_resume is properly handled
Gor Nishanov [Tue, 5 Sep 2017 19:31:52 +0000 (19:31 +0000)]
[coroutines] Make sure auto return type of await_resume is properly handled

Reviewers: rsmith, EricWF

Reviewed By: rsmith

Subscribers: javed.absar, cfe-commits

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

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

7 years ago[diagtool] Change default tree behavior to print only flags
Jonas Devlieghere [Tue, 5 Sep 2017 18:04:40 +0000 (18:04 +0000)]
[diagtool] Change default tree behavior to print only flags

This patch changes the default behavior of `diagtool tree` to only
display warning flags and not the internal warnings flags. The latter is
an implementation detail of the compiler and usually not what the users
wants.

Furthermore, flags that are enabled by default are now also printed in
green. Originally, this was only the case for the diagnostic names.

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

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

7 years ago[NFC] Loop modernization in diagtool
Jonas Devlieghere [Tue, 5 Sep 2017 18:04:34 +0000 (18:04 +0000)]
[NFC] Loop modernization in diagtool

Precommit for https://reviews.llvm.org/D37390

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

7 years ago[Preprocessor] Correct internal token parsing of newline characters in CRLF
Erich Keane [Tue, 5 Sep 2017 17:32:36 +0000 (17:32 +0000)]
[Preprocessor] Correct internal token parsing of newline characters in CRLF

Correct implementation:  Apparently I managed in r311683 to submit the wrong
version of the patch for this, so I'm correcting it now.

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

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

7 years ago[clang-format] Fix lines=all case in clang-format.py
Krasimir Georgiev [Tue, 5 Sep 2017 13:58:53 +0000 (13:58 +0000)]
[clang-format] Fix lines=all case in clang-format.py

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

7 years agoadd the option IndentPPDirectives to the release notes. Landed in r312125
Sylvestre Ledru [Tue, 5 Sep 2017 13:56:40 +0000 (13:56 +0000)]
add the option IndentPPDirectives to the release notes. Landed in r312125

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

7 years ago[Bash-autocomplete] Fix crash when invoking --autocomplete without value.
Raphael Isemann [Tue, 5 Sep 2017 12:41:00 +0000 (12:41 +0000)]
[Bash-autocomplete] Fix crash when invoking --autocomplete without value.

Summary:
Currently clang segfaults when invoked with `clang --autocomplete=`.
This patch adds the necessary boundary checks and some tests for corner cases like this.

Reviewers: yamaguchi

Reviewed By: yamaguchi

Subscribers: cfe-commits

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

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

7 years agoRemoved dead code (PR34467). NFCI.
Simon Pilgrim [Tue, 5 Sep 2017 10:37:13 +0000 (10:37 +0000)]
Removed dead code (PR34467). NFCI.

The for loop already checks that Idx < NumOfArgs.

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

7 years ago[AMDGPU] Implement infrastructure to set options in AMDGPUToolChain
Andrey Kasaurov [Tue, 5 Sep 2017 10:24:38 +0000 (10:24 +0000)]
[AMDGPU] Implement infrastructure to set options in AMDGPUToolChain

In current OpenCL implementation some options are set in OpenCL RT/Driver, which causes discrepancy between online and offline paths.
Implement infrastructure to move options from OpenCL RT/Driver to AMDGPUToolChain using overloaded TranslateArgs() method.
Create map for default options values, as Options.td doesn't support default values (in contrast with OPTIONS.def).
Add two driver options: -On and -mNN (like -O3, -m64).
Some minor formatting changes to follow the clang-format style.

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

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

7 years ago[X86][AVX512] _mm512_stream_load_si512 should take a void const* argument (PR33977)
Simon Pilgrim [Tue, 5 Sep 2017 10:06:41 +0000 (10:06 +0000)]
[X86][AVX512] _mm512_stream_load_si512 should take a void const* argument (PR33977)

Based off the Intel Intrinsics guide, we should expect a void const* argument.

Prevents 'passing 'const void *' to parameter of type 'void *' discards qualifiers' warnings.

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

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

7 years agoEmit static constexpr member as available_externally definition
Mehdi Amini [Tue, 5 Sep 2017 03:58:35 +0000 (03:58 +0000)]
Emit static constexpr member as available_externally definition

By exposing the constant initializer, the optimizer can fold many
of these constructs.

This is a recommit of r311857 that was reverted in r311898 because
an assert was hit when building Chromium.
We have to take into account that the GlobalVariable may be first
created with a different type than the initializer. This can
happen for example when the variable is a struct with tail padding
while the initializer does not have padding. In such case, the
variable needs to be destroyed an replaced with a new one with the
type of the initializer.

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

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

7 years agoAlways allocate room for a ModuleDecl on the TranslationUnitDecl.
Richard Smith [Tue, 5 Sep 2017 00:50:19 +0000 (00:50 +0000)]
Always allocate room for a ModuleDecl on the TranslationUnitDecl.

Sometimes we create the ASTContext and thus the TranslationUnitDecl before we know the LangOptions. This should fix the asan buildbot failures after r312467.

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

7 years agoclang-format: Fix indentation of macros in include guards (after r312125).
Daniel Jasper [Mon, 4 Sep 2017 13:33:52 +0000 (13:33 +0000)]
clang-format: Fix indentation of macros in include guards (after r312125).

Before:
  #ifndef A_H
  #define A_H

  #define A() \
  int i;    \
  int j;

  #endif // A_H

After:
  #ifndef A_H
  #define A_H

  #define A() \
    int i;    \
    int j;

  #endif // A_H

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

7 years agoFix MSVC narrowing conversion warning.
Simon Pilgrim [Mon, 4 Sep 2017 10:54:39 +0000 (10:54 +0000)]
Fix MSVC narrowing conversion warning.

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

7 years ago[analyzer] Increase minimum complexity filter of the CloneChecker.
Raphael Isemann [Mon, 4 Sep 2017 05:56:36 +0000 (05:56 +0000)]
[analyzer] Increase minimum complexity filter of the CloneChecker.

Summary:
So far we used a value of 10 which was useful for testing but produces many false-positives in real programs. The usual suspicious clones we find seem to be at around a complexity value of 70 and for normal clone-reporting everything above 50 seems to be a valid normal clone for users, so let's just go with 50 for now and set this as the new default value.

This patch also explicitly sets the complexity value for the regression tests as they serve more of a regression testing/debugging purpose and shouldn't really be reported by default in real programs. I'll add more tests that reflect actual found bugs that then need to pass with the default setting in the future.

Reviewers: NoQ

Subscribers: cfe-commits, javed.absar, xazax.hun, v.g.vassilev

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

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

7 years agoImplement Itanium name mangling support for C++ Modules TS.
Richard Smith [Mon, 4 Sep 2017 05:37:53 +0000 (05:37 +0000)]
Implement Itanium name mangling support for C++ Modules TS.

This follows the scheme agreed with Nathan Sidwell, which can be found here:

  https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile

This will be proposed to the itanium-cxx-abi list once we have some experience
with how well it works; the ABI for this TS should be considered unstable until
it is part of the Itanium C++ ABI.

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

7 years ago[CodeGen] Treat all vector fields as mayalias
Hal Finkel [Sun, 3 Sep 2017 17:18:25 +0000 (17:18 +0000)]
[CodeGen] Treat all vector fields as mayalias

Because it is common to treat vector types as an array of their elements, or
even some other type that's not the element type, and thus index into them, we
can't use struct-path TBAA for these accesses. Even though we already treat all
vector types as equivalent to 'char', we were using field-offset information
for them with TBAA, and this renders undefined the intra-value indexing we
intend to allow. Note that, although 'char' is universally aliasing, with path
TBAA, we can still differentiate between access to s.a and s.b in
  struct { char a, b; } s;. We can't use this capability as-is for vector types.

Fixes PR33967.

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

7 years agoTest commit access in clang.
Jatin Bhateja [Sun, 3 Sep 2017 15:29:38 +0000 (15:29 +0000)]
Test commit access in clang.

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

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