]> granicus.if.org Git - clang/log
clang
6 years ago[X86] Add test case for llvm change r329734
Craig Topper [Tue, 10 Apr 2018 18:43:44 +0000 (18:43 +0000)]
[X86] Add test case for llvm change r329734

This test ensures the popfd instruction in MS inline assembly can properly find a clobber name for the dirflag register. Previously the register was named 'DF', but it needs to be named 'dirflag' to match the name in the GCC register name list.

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

6 years ago[CUDA] Added --[no-]cuda-include-ptx=sm_XX|all option.
Artem Belevich [Tue, 10 Apr 2018 18:38:22 +0000 (18:38 +0000)]
[CUDA] Added --[no-]cuda-include-ptx=sm_XX|all option.

Currently we always include PTX into the fatbin along
with the GPU code.It about doubles the size of the GPU binary
we need to carry in the executable. These options allow control
inclusion of PTX into GPU binary.

This patch does not change the defaults, though we may consider
making no-PTX the default in the future.

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

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

6 years ago[Parser] Fix assertion-on-invalid for unexpected typename.
Volodymyr Sapsai [Tue, 10 Apr 2018 18:29:47 +0000 (18:29 +0000)]
[Parser] Fix assertion-on-invalid for unexpected typename.

In `ParseDeclarationSpecifiers` for the code

    class A typename A;

we were able to annotate token `kw_typename` because it refers to
existing type. But later during processing token `annot_typename` we
failed to `SetTypeSpecType` and exited switch statement leaving
annotation token unconsumed. The code after the switch statement failed
because it didn't expect a special token.

The fix is not to assume that switch statement consumes all special
tokens and consume any token, not just non-special.

rdar://problem/37099386

Reviewers: rsmith, arphaman

Reviewed By: rsmith

Subscribers: jkorous-apple, cfe-commits

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

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

6 years agoI removed the failed test.
Andrew V. Tischenko [Tue, 10 Apr 2018 15:45:43 +0000 (15:45 +0000)]
I removed the failed test.

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

6 years ago[X86] Disable SGX for Skylake Server - CPP test
Gabor Buella [Tue, 10 Apr 2018 15:03:03 +0000 (15:03 +0000)]
[X86] Disable SGX for Skylake Server - CPP test

Summary: Fix test case - corresponding to r329701

Reviewers: craig.topper, davezarzycki

Reviewed By: davezarzycki

Subscribers: cfe-commits

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

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

6 years agoAttempt to fix Windows build after r329698.
Nico Weber [Tue, 10 Apr 2018 14:08:25 +0000 (14:08 +0000)]
Attempt to fix Windows build after r329698.

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

6 years ago[X86] Disable SGX for Skylake Server
Gabor Buella [Tue, 10 Apr 2018 14:04:21 +0000 (14:04 +0000)]
[X86] Disable SGX for Skylake Server

Reviewers: craig.topper, zvi, echristo

Reviewed By: craig.topper

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

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

6 years agoUse llvm::sys::fs::real_path() in clang.
Nico Weber [Tue, 10 Apr 2018 13:36:38 +0000 (13:36 +0000)]
Use llvm::sys::fs::real_path() in clang.

No expected behavior change.
https://reviews.llvm.org/D45165

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

6 years agoThe test was fixed.
Andrew V. Tischenko [Tue, 10 Apr 2018 12:17:01 +0000 (12:17 +0000)]
The test was fixed.

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

6 years agoCodeGen tests - typo fixes NFC
Gabor Buella [Tue, 10 Apr 2018 11:20:05 +0000 (11:20 +0000)]
CodeGen tests - typo fixes NFC

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

6 years ago[Tooling] fix UB when interpolating compile commands with an empty index
Sam McCall [Tue, 10 Apr 2018 10:36:46 +0000 (10:36 +0000)]
[Tooling] fix UB when interpolating compile commands with an empty index

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

6 years ago-ftime-report switch support in Clang.
Andrew V. Tischenko [Tue, 10 Apr 2018 10:34:13 +0000 (10:34 +0000)]
-ftime-report switch support in Clang.
The current support of the feature produces only 2 lines in report:
 -Some general Code Generation Time;
 -Total time of Backend Consumer actions.
This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc.
Differential Revision: https://reviews.llvm.org/D43578

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

6 years ago[ExprConstant] Use an AST node and a version number as a key to create
Akira Hatanaka [Tue, 10 Apr 2018 05:15:01 +0000 (05:15 +0000)]
[ExprConstant] Use an AST node and a version number as a key to create
an APValue and retrieve it from map Temporaries.

The version number is needed when a single AST node is visited multiple
times and is used to create APValues that are required to be distinct
from each other (for example, MaterializeTemporaryExprs in default
arguments and VarDecls in loops).

rdar://problem/36505742

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

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

6 years ago[AST] Attempt to fix buildbot warnings + appease MSVC; NFCI
George Burgess IV [Tue, 10 Apr 2018 01:11:26 +0000 (01:11 +0000)]
[AST] Attempt to fix buildbot warnings + appease MSVC; NFCI

GCC 4.8.4 on a bot was warning about `ArgPassingKind` not fitting in
`ArgPassingRestrictions`, which appears to be incorrect, since
`ArgPassingKind` only has three potential values:

"warning: 'clang::RecordDecl::ArgPassingRestrictions' is too small to
hold all values of 'enum clang::RecordDecl::ArgPassingKind'"

Additionally, I remember hearing (though my knowledge may be outdated)
that MSVC won't merge adjacent bitfields if their types are different.

Try to fix both issues by turning these into `uint8_t`s.

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

6 years ago[ObjC++] Never pass structs that transitively contain __weak fields in
Akira Hatanaka [Mon, 9 Apr 2018 22:48:22 +0000 (22:48 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.

This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.

This reapplies r329617. r329617 didn't specify the underlying type for
enum ArgPassingKind, which caused regression tests to fail on a windows
bot.

rdar://problem/39194693

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

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

6 years ago[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).
Eugene Zelenko [Mon, 9 Apr 2018 22:14:10 +0000 (22:14 +0000)]
[AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Mon, 9 Apr 2018 21:54:38 +0000 (21:54 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoRevert "[ObjC++] Never pass structs that transitively contain __weak fields in"
Akira Hatanaka [Mon, 9 Apr 2018 21:47:58 +0000 (21:47 +0000)]
Revert "[ObjC++] Never pass structs that transitively contain __weak fields in"

This reverts commit r329617. It broke a windows bot.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16372/steps/test/logs/stdio

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

6 years ago[ObjC++] Never pass structs that transitively contain __weak fields in
Akira Hatanaka [Mon, 9 Apr 2018 20:39:47 +0000 (20:39 +0000)]
[ObjC++] Never pass structs that transitively contain __weak fields in
registers.

This patch fixes a bug in r328731 that caused structs transitively
containing __weak fields to be passed in registers. The patch replaces
the flag RecordDecl::CanPassInRegisters with a 2-bit enum that indicates
whether the struct or structs containing the struct are forced to be
passed indirectly.

rdar://problem/39194693

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

6 years agoasan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address
Vitaly Buka [Mon, 9 Apr 2018 20:10:29 +0000 (20:10 +0000)]
asan: kernel: make no_sanitize("address") attribute work with -fsanitize=kernel-address

Summary:
Right now to disable -fsanitize=kernel-address instrumentation, one needs to use no_sanitize("kernel-address"). Make either no_sanitize("address") or no_sanitize("kernel-address")  disable both ASan and KASan instrumentation. Also remove redundant test.

Patch by Andrey Konovalov

Reviewers: eugenis, kcc, glider, dvyukov, vitalybuka

Reviewed By: eugenis, vitalybuka

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

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

6 years agoRevert "[ObjC] Make C++ triviality type traits available to non-trivial C"
Akira Hatanaka [Mon, 9 Apr 2018 19:39:27 +0000 (19:39 +0000)]
Revert "[ObjC] Make C++ triviality type traits available to non-trivial C"

This reverts commit r329289.

It was decided that we shouldn't expose the __has_* traits to C since
they are deprecated and useless.

See the discussion here:

http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180402/thread.html#223921

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

6 years ago[X86] Emit native IR for pmuldq/pmuludq builtins.
Craig Topper [Mon, 9 Apr 2018 19:17:54 +0000 (19:17 +0000)]
[X86] Emit native IR for pmuldq/pmuludq builtins.

I believe all the pieces are now in place in the backend to make this work correctly. We can either mask the input to 32 bits for pmuludg or shl/ashr for pmuldq and use a regular mul instruction. The backend should combine this to PMULUDQ/PMULDQ and then SimplifyDemandedBits will remove the and/shifts.

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

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

6 years ago[CUDA] Revert defining __CUDA_ARCH__ for amdgcn targets
Yaxun Liu [Mon, 9 Apr 2018 15:43:01 +0000 (15:43 +0000)]
[CUDA] Revert defining __CUDA_ARCH__ for amdgcn targets

amdgcn targets only support HIP, which does not define __CUDA_ARCH__.

this is a partial unroll of r329232 / D45277.

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

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

6 years ago[Tooling] A CompilationDatabase wrapper that infers header commands.
Sam McCall [Mon, 9 Apr 2018 15:17:39 +0000 (15:17 +0000)]
[Tooling] A CompilationDatabase wrapper that infers header commands.

Summary:
The wrapper finds the closest matching compile command using filename heuristics
and makes minimal tweaks so it can be used with the header.

Subscribers: klimek, mgorny, cfe-commits

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

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

6 years ago[Index] Return SourceLocation to consumers, not FileID/Offset pair.
Sam McCall [Mon, 9 Apr 2018 14:12:51 +0000 (14:12 +0000)]
[Index] Return SourceLocation to consumers, not FileID/Offset pair.

Summary:
The FileID/Offset conversion is lossy. The code takes the fileLoc, which loses
e.g. the spelling location in some macro cases.
Instead, pass the original SourceLocation which preserves all information, and
update consumers to match current behavior.

This allows us to fix two bugs in clangd that need the spelling location.

Reviewers: akyrtzi, arphaman

Subscribers: ilya-biryukov, ioeric, cfe-commits

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

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

6 years agoTry to fix libclang reproducer tests after r329465
Hans Wennborg [Mon, 9 Apr 2018 12:21:12 +0000 (12:21 +0000)]
Try to fix libclang reproducer tests after r329465

They were failing on Windows because the output YAML didn't parse:

  YAML:1:664: error: Unrecognized escape code!

  {"toolchain":"D:\\buildslave\\clang-x64-ninja-win7\\stage1",
    "libclang.operation":"complete", "libclang.opts":1, "args":["clang",
    "-fno-spell-checking",
    "D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c",
    "-Xclang", "-detailed-preprocessing-record",
    "-fallow-editor-placeholders"],
    "invocation-args":["-code-completion-at=D:\buildslave\clang-x64-ninja-win7\llvm\tools\clang\test\Index\create-libclang-completion-reproducer.c:10:1"],
    "unsaved_file_hashes":[{"name":"D:\\buildslave\\clang-x64-ninja-win7\\llvm\\tools\\clang\\test\\Index\\create-libclang-completion-reproducer.c",
      "md5":"aee23773de90e665992b48209351d70e"}]}

This adds some more escaping to try to make it work.

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

6 years ago[XRay][llvm+clang] Consolidate attribute list files
Dean Michael Berris [Mon, 9 Apr 2018 04:02:09 +0000 (04:02 +0000)]
[XRay][llvm+clang] Consolidate attribute list files

Summary:
This change consolidates the always/never lists that may be provided to
clang to externally control which functions should be XRay instrumented
by imbuing attributes. The files follow the same format as defined in
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html for the
sanitizer blacklist.

We also deprecate the existing `-fxray-instrument-always=` and
`-fxray-instrument-never=` flags, in favour of `-fxray-attr-list=`.

This fixes http://llvm.org/PR34721.

Reviewers: echristo, vlad.tsyrklevich, eugenis

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, cfe-commits

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

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

6 years ago[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
Eric Fiselier [Sun, 8 Apr 2018 06:21:33 +0000 (06:21 +0000)]
[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Summary:
Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths  even though a qualified name is used.

For example:
```
class B {
protected:
 int i;
 union { int j; };
};

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
 int a() { return X::i; } // works
 int b() { return X::j; } // fails
};
```

Reviewers: rsmith, aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years agoRevert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple...
Eric Fiselier [Sun, 8 Apr 2018 06:05:33 +0000 (06:05 +0000)]
Revert "[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases."

This reverts commit r329519. There are some unaddressed test failures.

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

6 years ago[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.
Eric Fiselier [Sun, 8 Apr 2018 05:50:01 +0000 (05:50 +0000)]
[Sema] Fix PR35832 - Ambiguity accessing anonymous struct/union with multiple bases.

Summary:
Currently clang doesn't do qualified lookup when building indirect field decl references. This causes ambiguity when the field is in a base class to which there are multiple valid paths  even though a qualified name is used.

For example:
```
class B {
protected:
 int i;
 union { int j; };
};

class X : public B { };
class Y : public B { };

class Z : public X, public Y {
 int a() { return X::i; } // works
 int b() { return X::j; } // fails
};
```

Reviewers: rsmith, aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years ago[Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCI
Eric Fiselier [Sun, 8 Apr 2018 05:12:55 +0000 (05:12 +0000)]
[Sema] Remove dead code in BuildAnonymousStructUnionMemberReference. NFCI

Summary:
This patch cleans up a bunch of dead or unused code in BuildAnonymousStructUnionMemberReference.

The dead code was a branch that built a new CXXThisExpr when we weren't given a base object expression or base variable.
However, BuildAnonymousFoo has only two callers. One of which always builds a base object expression first, the second only calls when the IndirectFieldDecl is not a C++ class member. Even within C this branch seems entirely unused.

I tried diligently to write a test which hit it with no success.

This patch removes the branch and replaces it with an assertion that we were given either a base object expression or a base variable.

Reviewers: rsmith, aaron.ballman, majnemer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years ago[Sema] Fix PR22637 - IndirectFieldDecl's discard qualifiers during template instantia...
Eric Fiselier [Sun, 8 Apr 2018 05:11:59 +0000 (05:11 +0000)]
[Sema] Fix PR22637 - IndirectFieldDecl's discard qualifiers during template instantiation.

Summary:
Currently Clang fails to propagate qualifiers from the `CXXThisExpr` to the rebuilt `FieldDecl` for IndirectFieldDecls. For example:

```
template <class T> struct Foo {
  struct { int x; };
  int y;
  void foo() const {
      static_assert(__is_same(int const&, decltype((y))));
      static_assert(__is_same(int const&, decltype((x)))); // assertion fails
  }
};
template struct Foo<int>;
```

The fix is to delegate rebuilding of the MemberExpr to `BuildFieldReferenceExpr` which correctly propagates the qualifiers.

Reviewers: rsmith, lebedev.ri, aaron.ballman, bkramer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years ago[libclang] Add clang_File_tryGetRealPathName
Fangrui Song [Sat, 7 Apr 2018 20:50:35 +0000 (20:50 +0000)]
[libclang] Add clang_File_tryGetRealPathName

Summary:
clang_getFileName() may return a path relative to WorkingDir.
On Arch Linux, during clang_indexTranslationUnit(), clang_getFileName() on
CXIdxIncludedIncludedFileInfo::file may return
"/../lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string",
for `#include <string>`.

I presume WorkingDir is somehow changed to /usr/lib or /usr/include and
clang_getFileName() returns a path relative to WorkingDir.

clang_File_tryGetRealPathName() returns "/usr/include/c++/7.3.0/string"
which is more useful for the indexer in this case.

Subscribers: cfe-commits

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

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

6 years agoGeneralize the swiftcall API since being passed indirectly isn't
John McCall [Sat, 7 Apr 2018 20:16:47 +0000 (20:16 +0000)]
Generalize the swiftcall API since being passed indirectly isn't
C++-specific anymore.

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

6 years ago[Driver] Update GCC libraries detection logic for Gentoo.
Manoj Gupta [Sat, 7 Apr 2018 19:59:58 +0000 (19:59 +0000)]
[Driver] Update GCC libraries detection logic for Gentoo.

Summary:
1. Find GCC's LDPATH from the actual GCC config file.
2. Avoid picking libraries from a similar named tuple if the exact
   tuple is installed.

Reviewers: mgorny, chandlerc, thakis, rnk

Reviewed By: mgorny, rnk

Subscribers: cfe-commits, mgorny

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

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

6 years agoAllow equality comparisons between block pointers and
John McCall [Sat, 7 Apr 2018 17:42:06 +0000 (17:42 +0000)]
Allow equality comparisons between block pointers and
block-pointer-compatible ObjC object pointer types.

Patch by Dustin Howett!

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

6 years ago[Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assign...
Roman Lebedev [Sat, 7 Apr 2018 10:39:21 +0000 (10:39 +0000)]
[Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)

Summary:
This has just bit me, so i though it would be nice to avoid that next time :)
Motivational case:
  https://godbolt.org/g/cq9UNk
Basically, it's likely to happen if you don't like shadowing issues,
and use `-Wshadow` and friends. And it won't be diagnosed by clang.

The reason is, these self-assign diagnostics only work for builtin assignment
operators. Which makes sense, one could have a very special operator=,
that does something unusual in case of self-assignment,
so it may make sense to not warn on that.

But while it may be intentional in some cases, it may be a bug in other cases,
so it would be really great to have some diagnostic about it...

Reviewers: aaron.ballman, rsmith, rtrieu, nikola, rjmccall, dblaikie

Reviewed By: rjmccall

Subscribers: EricWF, lebedev.ri, thakis, Quuxplusone, cfe-commits

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

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

6 years agoSort source lists in lib/StaticAnalyzer.
Nico Weber [Sat, 7 Apr 2018 04:25:01 +0000 (04:25 +0000)]
Sort source lists in lib/StaticAnalyzer.

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

6 years agoMake CodeGen depend just once on clangAnalysis.
Nico Weber [Sat, 7 Apr 2018 03:29:47 +0000 (03:29 +0000)]
Make CodeGen depend just once on clangAnalysis.

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

6 years agoRemove another unnecessary -I flag passed to clang-tblgen.
Nico Weber [Sat, 7 Apr 2018 01:34:36 +0000 (01:34 +0000)]
Remove another unnecessary -I flag passed to clang-tblgen.

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

6 years agoGeneralize test for 32-bit targets.
Richard Smith [Sat, 7 Apr 2018 00:28:32 +0000 (00:28 +0000)]
Generalize test for 32-bit targets.

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

6 years agoRecommit r329442: Generate Libclang invocation reproducers using a new
Alex Lorenz [Sat, 7 Apr 2018 00:03:27 +0000 (00:03 +0000)]
Recommit r329442: Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option

The recommit fixes:
- An MSAN failure (CCPrintOptions wasn't initialized in the Driver)
- Ensures that the strings in the libclang invocation files are escaped

Original message:

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

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

6 years agoRemove two unnecessary -I flags passed to clang-tblgen.
Nico Weber [Fri, 6 Apr 2018 23:36:50 +0000 (23:36 +0000)]
Remove two unnecessary -I flags passed to clang-tblgen.

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

6 years agoDon't assume constructors return void.
Richard Smith [Fri, 6 Apr 2018 20:06:02 +0000 (20:06 +0000)]
Don't assume constructors return void.

Should fix ARM buildbot.

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

6 years agoRevert r329442 "Generate Libclang invocation reproducers using a new
Alex Lorenz [Fri, 6 Apr 2018 19:45:29 +0000 (19:45 +0000)]
Revert r329442 "Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option"

The tests are failing on some bots

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

6 years agoRevert "[analyzer] Remove an unused variable"
George Karpenkov [Fri, 6 Apr 2018 19:14:05 +0000 (19:14 +0000)]
Revert "[analyzer] Remove an unused variable"

This reverts commit 2fa3e3edc4ed6547cc4ce46a8c79d1891a5b3b36.

Removed the wrong variable.

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

6 years ago[analyzer] Remove an unused variable
George Karpenkov [Fri, 6 Apr 2018 19:03:43 +0000 (19:03 +0000)]
[analyzer] Remove an unused variable

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

6 years agoGenerate Libclang invocation reproducers using a new -cc1gen-reproducer
Alex Lorenz [Fri, 6 Apr 2018 18:30:14 +0000 (18:30 +0000)]
Generate Libclang invocation reproducers using a new -cc1gen-reproducer
driver option

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

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

6 years ago[HIP] define __CUDA_ARCH_=1 for amdgcn targets
Yaxun Liu [Fri, 6 Apr 2018 16:43:42 +0000 (16:43 +0000)]
[HIP] define __CUDA_ARCH_=1 for amdgcn targets

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

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

6 years ago[OPENMP, NVPTX] Fix codegen for the teams reduction.
Alexey Bataev [Fri, 6 Apr 2018 16:03:36 +0000 (16:03 +0000)]
[OPENMP, NVPTX] Fix codegen for the teams reduction.

Added NUW flags for all the add|mul|sub operations + replaced sdiv by udiv
as we operate on unsigned values only (addresses, converted to integers)

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

6 years agoFix typos in clang
Alexander Kornienko [Fri, 6 Apr 2018 15:14:32 +0000 (15:14 +0000)]
Fix typos in clang

Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

  archtype
  cas
  classs
  checkk
  compres
  definit
  frome
  iff
  inteval
  ith
  lod
  methode
  nd
  optin
  ot
  pres
  statics
  te
  thru

Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few
files that have dubious fixes reverted.)

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

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

6 years ago[Hexagon] Remove default values from lambda parameters
Krzysztof Parzyszek [Fri, 6 Apr 2018 13:51:48 +0000 (13:51 +0000)]
[Hexagon] Remove default values from lambda parameters

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

6 years agoAllow the creation of human-friendly ASTDumper to arbitrary output stream
Alexander Kornienko [Fri, 6 Apr 2018 13:01:12 +0000 (13:01 +0000)]
Allow the creation of human-friendly ASTDumper to arbitrary output stream

Summary:
`ASTPrinter` allows setting the ouput to any O-Stream, but that printer creates source-code-like syntax (and is also marked with a `FIXME`). The nice, colourful, mostly human-readable `ASTDumper` only works on the standard output, which is not feasible in case a user wants to see the AST of a file through a code navigation/comprehension tool.

This small addition of an overload solves generating a nice colourful AST block for the users of a tool I'm working on, [[ http://github.com/Ericsson/CodeCompass | CodeCompass ]], as opposed to having to duplicate the behaviour of definitions that only exist in the anonymous namespace of implementation TUs related to this module.

Reviewers: alexfh, klimek, rsmith

Reviewed By: alexfh

Subscribers: rnkovacs, dkrupp, gsd, xazax.hun, cfe-commits, #clang

Tags: #clang

Patch by Whisperity!

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

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

6 years ago[XRay][clang] Only run driver test for Linux and FreeBSD
Dean Michael Berris [Fri, 6 Apr 2018 06:09:57 +0000 (06:09 +0000)]
[XRay][clang] Only run driver test for Linux and FreeBSD

This is a follow-up to D45354, which we should have only been running on
Linux and FreeBSD for specific targets.

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

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

6 years ago[XRay][clang] Add a flag to enable/disable linking XRay deps explicitly
Dean Michael Berris [Fri, 6 Apr 2018 05:28:54 +0000 (05:28 +0000)]
[XRay][clang] Add a flag to enable/disable linking XRay deps explicitly

Summary:
This change introduces `-fxray-link-deps` and `-fnoxray-link-deps`. The
`-fnoxray-link-deps` allows for directly controlling which specific XRay
runtime to link. The default is for clang to link the XRay runtime that
is shipped with the compiler (if there are any), but users may want to
explicitly add the XRay dependencies from other locations or other
means.

Reviewers: eizan, echristo, chandlerc

Reviewed By: eizan

Subscribers: cfe-commits

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

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

6 years ago[XRay][clang] Consolidate runtime and link-time flag processing (NFC)
Dean Michael Berris [Fri, 6 Apr 2018 03:53:04 +0000 (03:53 +0000)]
[XRay][clang] Consolidate runtime and link-time flag processing (NFC)

Summary:
This change fixes http://llvm.org/PR36985 to define a single place in
CommonArgs.{h,cpp} where XRay runtime flags and link-time dependencies
are processed for all toolchains that support XRay instrumentation. This
is a refactoring of the same functionality spread across multiple
toolchain definitions.

Reviewers: echristo, devnexen, eizan

Reviewed By: eizan

Subscribers: emaste, cfe-commits

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

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

6 years agoCMake option to allow enabling experimental new pass manager by default
Petr Hosek [Fri, 6 Apr 2018 00:53:00 +0000 (00:53 +0000)]
CMake option to allow enabling experimental new pass manager by default

This CMake flag allows setting the default value for the
-f[no]-experimental-new-pass-manager flag.

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

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

6 years agoFix test added in r329301 to work properly with Windows paths.
Douglas Yung [Thu, 5 Apr 2018 22:58:14 +0000 (22:58 +0000)]
Fix test added in r329301 to work properly with Windows paths.

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

6 years ago[Sema] Revert r329346 because of memory sanitizer failures.
Eugene Zelenko [Thu, 5 Apr 2018 22:15:42 +0000 (22:15 +0000)]
[Sema] Revert r329346 because of memory sanitizer failures.

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

6 years agoAdd a couple more tests for DR372.
Richard Smith [Thu, 5 Apr 2018 21:49:20 +0000 (21:49 +0000)]
Add a couple more tests for DR372.

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

6 years ago[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 5 Apr 2018 21:09:03 +0000 (21:09 +0000)]
[Sema] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoPR36992: do not store beyond the dsize of a class object unless we know
Richard Smith [Thu, 5 Apr 2018 20:52:58 +0000 (20:52 +0000)]
PR36992: do not store beyond the dsize of a class object unless we know
the tail padding is not reused.

We track on the AggValueSlot (and through a couple of other
initialization actions) whether we're dealing with an object that might
share its tail padding with some other object, so that we can avoid
emitting stores into the tail padding if that's the case. We still
widen stores into tail padding when we can do so.

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

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

6 years agoDR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
Richard Smith [Thu, 5 Apr 2018 18:55:37 +0000 (18:55 +0000)]
DR1672, DR1813, DR1881, DR2120: Implement recent fixes to "standard
layout" rules.

The new rules say that a standard-layout struct has its first non-static
data member and all base classes at offset 0, and consider a class to
not be standard-layout if that would result in multiple subobjects of a
single type having the same address.

We track "is C++11 standard-layout class" separately from "is
standard-layout class" so that the ABIs that need this information can
still use it.

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

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

6 years agoRemove the temporary availability checking workaround for
Alex Lorenz [Thu, 5 Apr 2018 18:12:06 +0000 (18:12 +0000)]
Remove the temporary availability checking workaround for
the nested declarations in @interface.

rdar://28825862

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

6 years agoFix typo in comment -fmath-errno=0 -> -fno-math-errno
Sam Clegg [Thu, 5 Apr 2018 17:44:08 +0000 (17:44 +0000)]
Fix typo in comment -fmath-errno=0 -> -fno-math-errno

The former is not a valid clang argument

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

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

6 years ago[ASTImporter] Fix for importing unnamed structs
Aleksei Sidorin [Thu, 5 Apr 2018 15:31:49 +0000 (15:31 +0000)]
[ASTImporter] Fix for importing unnamed structs

Patch by Peter Szecsi!

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

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

6 years agoDisable -fmerge-all-constants as default.
Manoj Gupta [Thu, 5 Apr 2018 15:29:52 +0000 (15:29 +0000)]
Disable -fmerge-all-constants as default.

Summary:
"-fmerge-all-constants" is a non-conforming optimization and should not
be the default. It is also causing miscompiles when building Linux
Kernel (https://lkml.org/lkml/2018/3/20/872).

Fixes PR18538.

Reviewers: rjmccall, rsmith, chandlerc

Reviewed By: rsmith, chandlerc

Subscribers: srhines, cfe-commits

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

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

6 years ago[clang-format] Support lightweight Objective-C generics
Ben Hamilton [Thu, 5 Apr 2018 15:26:25 +0000 (15:26 +0000)]
[clang-format] Support lightweight Objective-C generics

Summary:
Previously, `clang-format` didn't understand lightweight
Objective-C generics, which have the form:

```
@interface Foo <KeyType,
                ValueTypeWithConstraint : Foo,
AnotherValueTypeWithGenericConstraint: Bar<Baz>, ... > ...
```

The lightweight generic specifier list appears before the base
class, if present, but because it starts with < like the protocol
specifier list, `UnwrappedLineParser` was getting confused and
failed to parse interfaces with both generics and protocol lists:

```
@interface Foo <KeyType> : NSObject <NSCopying>
```

Since the parsed line would be incomplete, the format result
would be very confused (e.g., https://bugs.llvm.org/show_bug.cgi?id=24381).

This fixes the issue by explicitly parsing the ObjC lightweight
generic conformance list, so the line is fully parsed.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=24381
Test Plan: New tests added. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Ensure ObjC selectors with 0 args are annotated correctly
Ben Hamilton [Thu, 5 Apr 2018 15:26:23 +0000 (15:26 +0000)]
[clang-format] Ensure ObjC selectors with 0 args are annotated correctly

Summary:
Previously, clang-format would incorrectly annotate 0-argument
Objective-C selector names as TT_TrailingAnnotation:

```
% echo "-(void)foo;" > /tmp/test.m
% ./bin/clang-format -debug /tmp/test.m
Language: Objective-C
----
Line(0, FSC=0): minus[T=68, OC=0] l_paren[T=68, OC=1] void[T=68, OC=2]
r_paren[T=68, OC=6] identifier[T=68, OC=7] semi[T=68, OC=10]
Line(0, FSC=0): eof[T=68, OC=0]
Run 0...
AnnotatedTokens(L=0):
 M=0 C=0 T=ObjCMethodSpecifier S=1 B=0 BK=0 P=0 Name=minus L=1 PPK=2
 FakeLParens= FakeRParens=0 Text='-'
 M=0 C=1 T=Unknown S=1 B=0 BK=0 P=33 Name=l_paren L=3 PPK=2
 FakeLParens= FakeRParens=0 Text='('
 M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=void L=7 PPK=2 FakeLParens=
 FakeRParens=0 Text='void'
 M=0 C=0 T=CastRParen S=0 B=0 BK=0 P=43 Name=r_paren L=8 PPK=2
 FakeLParens= FakeRParens=0 Text=')'
 M=0 C=1 T=TrailingAnnotation S=0 B=0 BK=0 P=120 Name=identifier L=11
 PPK=2 FakeLParens= FakeRParens=0 Text='foo'
 M=0 C=0 T=Unknown S=0 B=0 BK=0 P=23 Name=semi L=12 PPK=2 FakeLParens=
 FakeRParens=0 Text=';'
```

This caused us to incorrectly indent 0-argument wrapped selectors
when Style.IndentWrappedFunctionNames was false, as we thought
the 0-argument ObjC selector name was actually a trailing
annotation (which is always indented).

This diff fixes the issue and adds tests.

Test Plan: New tests added. Confirmed tests failed before diff.
  After diff, tests passed. Ran tests with:
  % make -j12 FormatTests &&
  ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper, jolesiak

Subscribers: klimek, cfe-commits

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

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

6 years ago[ObjC] Make C++ triviality type traits available to non-trivial C
Akira Hatanaka [Thu, 5 Apr 2018 14:39:57 +0000 (14:39 +0000)]
[ObjC] Make C++ triviality type traits available to non-trivial C
structs.

r326307 and r327870 made changes that allowed using non-trivial C
structs with fields qualified with __strong or __weak. This commit makes
the following C++ triviality type traits available to non-trivial C
structs:

__has_trivial_assign
__has_trivial_move_assign
__has_trivial_copy
__has_trivial_move_constructor
__has_trivial_constructor
__has_trivial_destructor

This reapplies r328680. This commit fixes a bug where the copy/move
__has_trivial_* traits would return false when a volatile type was being
passed. Thanks to Richard Smith for pointing out the mistake.

rdar://problem/33599681

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

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

6 years ago[PATCH] [RISCV] Extend getTargetDefines for RISCVTargetInfo
Shiva Chen [Thu, 5 Apr 2018 12:54:00 +0000 (12:54 +0000)]
[PATCH] [RISCV] Extend getTargetDefines for RISCVTargetInfo

Summary:
This patch extend getTargetDefines and implement handleTargetFeatures
and hasFeature. and define corresponding marco for those features.

Reviewers: asb, apazos, eli.friedman

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

Patch by Kito Cheng.

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

6 years ago[clang-format] Preserve spaces before a percent in (text) protos
Krasimir Georgiev [Thu, 5 Apr 2018 09:33:03 +0000 (09:33 +0000)]
[clang-format] Preserve spaces before a percent in (text) protos

This makes sure that we do not change the meaning of pieces of text with
format specifiers.

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

6 years agoRevert r328680 ("[ObjC] Make C++ triviality type traits available to non-trivial...
Richard Smith [Thu, 5 Apr 2018 00:34:54 +0000 (00:34 +0000)]
Revert r328680 ("[ObjC] Make C++ triviality type traits available to non-trivial C structs.")

It unintentionally caused the values of the __has_* type traits to change in
C++ for trivially-copyable classes with volatile members.

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

6 years ago[AST] Don't track lambda captures when checking a potential constant expression.
Erik Pilkington [Thu, 5 Apr 2018 00:12:05 +0000 (00:12 +0000)]
[AST] Don't track lambda captures when checking a potential constant expression.

Fixes PR36054.

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

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

6 years agoEnable msan unconditionally on Linux.
Evgeniy Stepanov [Wed, 4 Apr 2018 23:48:06 +0000 (23:48 +0000)]
Enable msan unconditionally on Linux.

Memory sanitizer compatibility are already done in
MemorySanitizer::doInitialization. It verifies whether the necessary offsets
exist and bails out if not. For this reason it is no good to duplicate two
checks in two projects. This patch removes clang check and postpones msan
compatibility validation till MemorySanitizer::doInitialization.

Another reason for this patch is to allow using msan with any CPU (given
compatible runtime) and custom mapping provided via the arguments added by
https://reviews.llvm.org/D44926.

Patch by vit9696.

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

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

6 years agoAArch64: Implement support for the shadowcallstack attribute.
Peter Collingbourne [Wed, 4 Apr 2018 21:55:44 +0000 (21:55 +0000)]
AArch64: Implement support for the shadowcallstack attribute.

The implementation of shadow call stack on aarch64 is quite different to
the implementation on x86_64. Instead of reserving a segment register for
the shadow call stack, we reserve the platform register, x18. Any function
that spills lr to sp also spills it to the shadow call stack, a pointer to
which is stored in x18.

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

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

6 years ago[Driver] Include the Android multiarch includes.
Dan Albert [Wed, 4 Apr 2018 21:28:34 +0000 (21:28 +0000)]
[Driver] Include the Android multiarch includes.

Summary:
Most Android headers live in a single directory, but a small handful
live in multiarch directories.

Reviewers: srhines

Reviewed By: srhines

Subscribers: javed.absar, cfe-commits

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

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

6 years ago[CUDA] Add amdgpu sub archs
Yaxun Liu [Wed, 4 Apr 2018 21:19:27 +0000 (21:19 +0000)]
[CUDA] Add amdgpu sub archs

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

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

6 years ago[clang-format] In tests, expected code should be format-stable
Mark Zeren [Wed, 4 Apr 2018 21:09:00 +0000 (21:09 +0000)]
[clang-format] In tests, expected code should be format-stable

Summary: Extend various verifyFormat helper functions to check that the
expected text is "stable". This provides some protection against bugs
where formatting results are ocilating between two forms, or continually
change in some other way.

Testing Done:

* Ran unit tests.

* Reproduced a known instability in preprocessor indentation which was
  caught by this new check.

Reviewers: krasimir

Subscribers: cfe-commits

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

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

6 years agoRevert "[CUDA] Check initializers of instantiated template variables."
Artem Belevich [Wed, 4 Apr 2018 20:48:42 +0000 (20:48 +0000)]
Revert "[CUDA] Check initializers of instantiated template variables."

This (temporarily) reverts commit r329127 due to the problems
it exposed in TensorFlow.

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

6 years ago[analyzer][test] Set C++14 as language standard for test depending on new
Jan Korous [Wed, 4 Apr 2018 19:58:48 +0000 (19:58 +0000)]
[analyzer][test] Set C++14 as language standard for test depending on new
features

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

6 years agoFixes errors with FS iterators caused by https://reviews.llvm.org/D44960
Max Moroz [Wed, 4 Apr 2018 19:47:25 +0000 (19:47 +0000)]
Fixes errors with FS iterators caused by https://reviews.llvm.org/D44960

Summary:
In https://reviews.llvm.org/D44960, file status check is executed every
time a real file system directory iterator is constructed or
incremented, and emits an error code. This change list fixes the errors
in VirtualFileSystem caused by https://reviews.llvm.org/D44960.

Patch by Yuke Liao (@liaoyuke).

Reviewers: vsk, pcc, zturner, liaoyuke

Reviewed By: vsk

Subscribers: mgrang, cfe-commits

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

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

6 years ago[XRay][clang] Allow clang to build XRay instrumented binaries in OpenBSD
Dean Michael Berris [Wed, 4 Apr 2018 12:47:49 +0000 (12:47 +0000)]
[XRay][clang] Allow clang to build XRay instrumented binaries in OpenBSD

Summary:
This patch was originally reviewed in D45126. It enables clang to add
the XRay runtime and the link-time dependencies for XRay instrumentation
in OpenBSD.

Landing for devnexen.

Reviewers: brad, dberris

Subscribers: dberris, krytarowski, cfe-commits

Author: devnexen

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

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

6 years agoMake helpers static. NFC.
Benjamin Kramer [Wed, 4 Apr 2018 11:45:11 +0000 (11:45 +0000)]
Make helpers static. NFC.

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

6 years agoAs we don't use minor version anymore, let's remove it from the release notes too
Sylvestre Ledru [Wed, 4 Apr 2018 09:38:22 +0000 (09:38 +0000)]
As we don't use minor version anymore, let's remove it from the release notes too

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

6 years agoFix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.
Eric Fiselier [Wed, 4 Apr 2018 06:31:21 +0000 (06:31 +0000)]
Fix typo in ASTStructuralEquivalence.cpp for UnaryTransform types.

Previously UnaryTransformType nodes were comparing the same node
for structural equivalence. This was due to a typo where T1 was
on both sides of the comparison. This patch corrects that typo.

Unfortunately I couldn't find a way to test this change. It seems
that currently UnaryTransform nodes are never actually checked
for equivalence, only their canonical types are.

None the less, this correction seemed appropriate.

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

6 years agoSplit test/Driver/darwin-sdkroot.c into two tests
Alex Lorenz [Wed, 4 Apr 2018 02:11:20 +0000 (02:11 +0000)]
Split test/Driver/darwin-sdkroot.c into two tests

The test additions in r329110 are Darwin-specific, as they rely
on a code path that is reachabled when driver is invoked without
-target. Instead of making the old test checks Darwin-specific too,
let's simply split it into two files to ensure that the old
checks are still platform-agnostic. Thanks Chandler for
suggesting this!

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

6 years ago[ObjC] Use the name specified by objc_runtime_name instead of the class
Akira Hatanaka [Tue, 3 Apr 2018 22:50:16 +0000 (22:50 +0000)]
[ObjC] Use the name specified by objc_runtime_name instead of the class
identifier.

This patch fixes a few places in CGObjCMac.cpp where the class
identifier was used instead of the name specified by objc_runtime_name.

rdar://problem/37910822

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

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

6 years ago[CUDA] Check initializers of instantiated template variables.
Artem Belevich [Tue, 3 Apr 2018 22:41:06 +0000 (22:41 +0000)]
[CUDA] Check initializers of instantiated template variables.

We were already performing checks on non-template variables,
but the checks on templated ones were missing.

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

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

6 years agoAdd the -fsanitize=shadow-call-stack flag
Vlad Tsyrklevich [Tue, 3 Apr 2018 22:33:53 +0000 (22:33 +0000)]
Add the -fsanitize=shadow-call-stack flag

Summary:
Add support for the -fsanitize=shadow-call-stack flag which causes clang
to add ShadowCallStack attribute to functions compiled with that flag
enabled.

Reviewers: pcc, kcc

Reviewed By: pcc, kcc

Subscribers: cryptoad, cfe-commits, kcc

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

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

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Tue, 3 Apr 2018 21:31:50 +0000 (21:31 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoAdd REQUIRES: darwin-system to test/Driver/darwin-sdkroot.c
Alex Lorenz [Tue, 3 Apr 2018 21:10:26 +0000 (21:10 +0000)]
Add REQUIRES: darwin-system to test/Driver/darwin-sdkroot.c

The test from r329110 is for Darwin only

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

6 years ago[driver][darwin] Do not infer -simulator environment for non-simulator SDKs
Alex Lorenz [Tue, 3 Apr 2018 20:50:05 +0000 (20:50 +0000)]
[driver][darwin] Do not infer -simulator environment for non-simulator SDKs

rdar://36369832

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

6 years ago[analyzer] Fix diagnostics in callees of interesting callees.
Artem Dergachev [Tue, 3 Apr 2018 18:52:30 +0000 (18:52 +0000)]
[analyzer] Fix diagnostics in callees of interesting callees.

removeUnneededCalls() is responsible for removing path diagnostic pieces within
functions that don't contain "interesting" events. It makes bug reports
much tidier.

When a stack frame is known to be interesting, the function doesn't descend
into it to prune anything within it, even other callees that are totally boring.

Fix the function to prune boring callees in interesting stack frames.

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

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

6 years agoRevert "Set calling convention for CUDA kernel"
Artem Belevich [Tue, 3 Apr 2018 18:29:31 +0000 (18:29 +0000)]
Revert "Set calling convention for CUDA kernel"

This reverts r328795 which introduced an issue with referencing __global__
function templates. More details in the original review D44747.

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

6 years agoUse Clang when referring to the project and clang when referring to the binary.
Richard Smith [Tue, 3 Apr 2018 18:28:13 +0000 (18:28 +0000)]
Use Clang when referring to the project and clang when referring to the binary.

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

6 years agoRestrict a test using named file descriptors to using the system shell
David Blaikie [Tue, 3 Apr 2018 18:22:14 +0000 (18:22 +0000)]
Restrict a test using named file descriptors to using the system shell

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

6 years ago[Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Krzysztof Parzyszek [Tue, 3 Apr 2018 15:59:10 +0000 (15:59 +0000)]
[Hexagon] Remove -mhvx-double and the corresponding subtarget feature

Specifying the HVX vector length should be done via the -mhvx-length
option.

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

6 years ago[clang-format/ObjC] Do not detect "[]" as ObjC method expression
Ben Hamilton [Tue, 3 Apr 2018 14:07:11 +0000 (14:07 +0000)]
[clang-format/ObjC] Do not detect "[]" as ObjC method expression

Summary:
The following C++ code was being detected by
`guessLanguage()` as Objective-C:

  #define FOO(...) auto bar = [] __VA_ARGS__;

This was because `[] __VA_ARGS__` is not currently detected as a C++
lambda expression (it has no parens or braces), so
`TokenAnnotator::parseSquare()` incorrectly treats the opening square
as an ObjC method expression.

We have two options to fix this:

1. Parse `[] __VA_ARGS__` explicitly as a C++ lambda
2. Make it so `[]` is never parsed as an Objective-C method expression

This diff implements option 2, which causes the `[` to be parsed
as `TT_ArraySubscriptLSquare` instead of `TT_ObjCMethodExpr`.

Note that when I fixed this, it caused one change in formatting
behavior, where the following was implicitly relying on the `[`
being parsed as `TT_ObjCMethodExpr`:

  A<int * []> a;

becomes:

  A<int *[]> a;

with `Style.PointerAlignment = Middle`.

I don't really know what the desired format is for this syntax; the
test was added by Janusz Sobczak and integrated by @djasper in
https://github.com/llvm-mirror/clang/commit/b511fe9818829d7ece0cc0b2ce1fbe04a1f0739a
.

I went ahead and changed the test for now.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Fixes: https://bugs.llvm.org/show_bug.cgi?id=36248
Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits, djasper

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

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

6 years ago[clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal
Ben Hamilton [Tue, 3 Apr 2018 14:07:09 +0000 (14:07 +0000)]
[clang-format/ObjC] Do not insert space after opening brace of ObjC dict literal

Summary:
D44816 attempted to fix a few cases where `clang-format` incorrectly
inserted a space before the closing brace of an Objective-C dictionary
literal.

This revealed there were still a few cases where we inserted a space
after the opening brace of an Objective-C dictionary literal.

This fixes the formatting to be consistent and adds more tests.

Test Plan: New tests added. Confirmed tests failed before
  diff and passed after diff.
  Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, krasimir

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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