]> granicus.if.org Git - clang/log
clang
5 years agoRemove unused variable to silence compiler warning [NFC]
Mikael Holmen [Thu, 14 Mar 2019 14:20:50 +0000 (14:20 +0000)]
Remove unused variable to silence compiler warning [NFC]

The only use of MI was removed in r356142.

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

5 years ago[ASTImporter] Fix import of NestedNameSpecifierLoc.
Balazs Keri [Thu, 14 Mar 2019 14:20:23 +0000 (14:20 +0000)]
[ASTImporter] Fix import of NestedNameSpecifierLoc.

Summary:
Import type location in case of TypeSpec and TypeSpecWithTemplate.
Without this fix the imported NespedNameSpecifierLoc will have an
invalid begin location.

Reviewers: a.sidorin, shafik, a_sidorin, martong

Reviewed By: a_sidorin

Subscribers: rnkovacs, jdoerfert, dkrupp, martong, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years agoObjective-C++11: Support static_assert() in @interface/@implementation ivar lists...
Nico Weber [Thu, 14 Mar 2019 14:18:56 +0000 (14:18 +0000)]
Objective-C++11: Support static_assert() in @interface/@implementation ivar lists and method declarations

This adds support for static_assert() (and _Static_assert()) in
@interface/@implementation ivar lists and in @interface method declarations.

It was already supported in @implementation blocks outside of the ivar lists.

The assert AST nodes are added at file scope, matching where other
(non-Objective-C) declarations at @interface / @implementation level go (cf
`allTUVariables`).

Also add a `__has_feature(objc_c_static_assert)` that's true in C11 (and
`__has_extension(objc_c_static_assert)` that's always true) and
`__has_feature(objc_cxx_static_assert)` that's true in C++11 modea fter this
patch, so it's possible to check if this is supported.

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

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

5 years ago[analyzer] Fix function macro crash
Kristof Umann [Thu, 14 Mar 2019 13:38:16 +0000 (13:38 +0000)]
[analyzer] Fix function macro crash

Re-commit D57893.

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

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

5 years ago[X86] Only define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 in 64-bit mode.
Craig Topper [Thu, 14 Mar 2019 05:45:42 +0000 (05:45 +0000)]
[X86] Only define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 in 64-bit mode.

Summary:
This define should correspond to CMPXCHG16B being available which requires 64-bit mode.

I checked and gcc also seems to only define this in 64-bit mode.

Reviewers: RKSimon, spatel, efriedma, jyknight, jfb

Reviewed By: jfb

Subscribers: jfb, cfe-commits, llvm-commits

Tags: #clang

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

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

5 years agoFix invocation of Gold plugin with LTO after r355331
Nemanja Ivanovic [Wed, 13 Mar 2019 23:54:52 +0000 (23:54 +0000)]
Fix invocation of Gold plugin with LTO after r355331

The above commit breaks the usage of PGO and LTO when -fprofile-use is
supplied without a path. This patch changes the usage of this argument
to be inline with its use in addPGOAndCoverageFlags().

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

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

5 years agoRevert "Add a new attribute, fortify_stdlib"
Erik Pilkington [Wed, 13 Mar 2019 21:37:01 +0000 (21:37 +0000)]
Revert "Add a new attribute, fortify_stdlib"

This reverts commit r353765. After talking with our c stdlib folks, we decided
to use the existing pass_object_size attribute to implement _FORTIFY_SOURCE
wrappers, like Bionic does (I didn't realize that pass_object_size could be used
for this purpose). Sorry for the flip/flop, and thanks to James Y. Knight for
pointing this out to me.

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

5 years ago[clang-format] Propagate inferred language to getLLVMStyle() in getPredefinedStyle()
Jordan Rupprecht [Wed, 13 Mar 2019 21:13:01 +0000 (21:13 +0000)]
[clang-format] Propagate inferred language to getLLVMStyle() in getPredefinedStyle()

rC355158 added an optional language parameter to getLLVMStyle(), but this parameter was not used in getPredefinedStyle(). Because unit tests directly specify the style, this codepath wasn't tested. Add an additional unit test for getStyle().

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

5 years ago[OPENMP]Fix PR37283: Assertion failure on openmp task with by reference
Alexey Bataev [Wed, 13 Mar 2019 20:46:28 +0000 (20:46 +0000)]
[OPENMP]Fix PR37283: Assertion failure on openmp task with by reference
array.

If the firstprivate variable is a reference, we may incorrectly classify
the kind of the private copy. Use the type of the private copy instead
of the original shared variable.

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

5 years ago[clang-format][NFC] Include TableGen in enum->string mapping used for debugging
Jordan Rupprecht [Wed, 13 Mar 2019 20:34:34 +0000 (20:34 +0000)]
[clang-format][NFC] Include TableGen in enum->string mapping used for debugging

Running `clang-format -debug` prints "Unknown" for tablegen files because of this missing mapping, even though it is recognized as a tablegen file.

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

5 years ago[LibTooling] Add retrieval of extended AST-node source to FixIt library
Yitzhak Mandelbaum [Wed, 13 Mar 2019 19:48:51 +0000 (19:48 +0000)]
[LibTooling] Add retrieval of extended AST-node source to FixIt library

Summary:
Introduces variants of `getText` and `getSourceRange` that extract the source text of an AST node potentially with a trailing token.

Some of the new functions manipulate `CharSourceRange`s, rather than `SourceRange`s, because they document and dynamically enforce their type.  So, this revision also updates the corresponding existing FixIt functions to manipulate `CharSourceRange`s.  This change is not strictly necessary, but seems like the correct choice, to keep the API self-consistent.

This revision is the first in a series intended to improve the abstractions available to users for writing source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: kimgr, riccibruno, JonasToth, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Disable ADL in C for user-defined reductions.
Alexey Bataev [Wed, 13 Mar 2019 19:31:34 +0000 (19:31 +0000)]
[OPENMP]Disable ADL in C for user-defined reductions.

C does not support ADL, disable it for C to prevent compiler crash.

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

5 years ago[Analyzer] Clean up test/Analysis/ptr-sort.cpp
Mandeep Singh Grang [Wed, 13 Mar 2019 19:21:11 +0000 (19:21 +0000)]
[Analyzer] Clean up test/Analysis/ptr-sort.cpp

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

5 years agoFix a failing test.
Erik Pilkington [Wed, 13 Mar 2019 19:20:45 +0000 (19:20 +0000)]
Fix a failing test.

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

5 years ago[Analyzer] Update the LLVM license in PointerSortingChecker.cpp
Mandeep Singh Grang [Wed, 13 Mar 2019 19:09:48 +0000 (19:09 +0000)]
[Analyzer] Update the LLVM license in PointerSortingChecker.cpp

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

5 years ago[Parse] Parse '#pragma clang attribute' as an external-declaration
Erik Pilkington [Wed, 13 Mar 2019 18:30:59 +0000 (18:30 +0000)]
[Parse] Parse '#pragma clang attribute' as an external-declaration

Previously, we parsed it only in the top level, which excludes namespaces and
extern "C" blocks.

rdar://problem/48818890

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

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

5 years ago[OPENMP][NVPTX]Fix PR40893: Size doesn't match for
Alexey Bataev [Wed, 13 Mar 2019 18:21:10 +0000 (18:21 +0000)]
[OPENMP][NVPTX]Fix PR40893: Size doesn't match for
'_openmp_teams_reductions_buffer_$_.

nvlink does not handle weak linkage correctly, same symbols with the
different sizes are reported as erroneous though the largest size must
be chosen instead. Patch fixes this problem by using Internal linkage
instead of the Common.

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

5 years agoRevert "Add AIX Target Info"
Jason Liu [Wed, 13 Mar 2019 17:57:23 +0000 (17:57 +0000)]
Revert "Add AIX Target Info"

This reverts commit 4e192d0e1e72ce32fabf1bccc06ac31ab5385e78.
The newly added test case max_align.c do not work on all platforms.

original llvm-svn: 356060

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

5 years ago[libclang] Expose aligned() attribute.
Emilio Cobos Alvarez [Wed, 13 Mar 2019 16:16:54 +0000 (16:16 +0000)]
[libclang] Expose aligned() attribute.

Summary:
This is useful because otherwise there's no easy way to distinguish #pragma
packed(N) from attribute(packed, aligned(N)) that isn't looking at field
offsets (since pragma packed() also creates a packed attribute).

Reviewers: Anastasia, arphaman, serge-sans-paille

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd AIX Target Info
Jason Liu [Wed, 13 Mar 2019 16:02:26 +0000 (16:02 +0000)]
Add AIX Target Info

Summary:
A first pass over platform-specific properties of the C API/ABI
on AIX for both 32-bit and 64-bit modes.
This is a continuation of D18360 by Andrew Paprocki and further work by Wu Zhao.

Patch by Andus Yu

Reviewers: apaprocki, chandlerc, hubert.reinterpretcast, jasonliu,
xingxue, sfertile

Reviewed by: hubert.reinterpretcast, apaprocki, sfertile

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

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

5 years ago[Analyzer] Skip symbolic regions based on conjured symbols in comparison of the conta...
Adam Balogh [Wed, 13 Mar 2019 13:55:11 +0000 (13:55 +0000)]
[Analyzer] Skip symbolic regions based on conjured symbols in comparison of the containers of iterators

Checking whether two regions are the same is a partially decidable problem:
either we know for sure that they are the same or we cannot decide. A typical
case for this are the symbolic regions based on conjured symbols. Two
different conjured symbols are either the same or they are different. Since
we cannot decide this and want to reduce false positives as much as possible
we exclude these regions whenever checking whether two containers are the
same at iterator mismatch check.

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

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

5 years ago[AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`
Aleksandr Urakov [Wed, 13 Mar 2019 13:38:12 +0000 (13:38 +0000)]
[AST] Improve support of external layouts in `MicrosoftRecordLayoutBuilder`

Summary:
This patch fixes several small problems with external layouts support in
`MicrosoftRecordLayoutBuilder`:
- aligns properly the size of a struct that ends with a bit field. It was
  aligned on byte before, not on the size of the field, so the struct size was
  smaller than it should be;
- adjusts the struct size when injecting a vbptr in the case when there were no
  bases or fields allocated after the vbptr. Similarly, without the adjustment
  the struct was smaller than it should be;
- the same fix as above for the vfptr.
All these fixes affect the non-virtual size of a struct, so they are tested
through non-virtual inheritance.

Reviewers: rnk, zturner, rsmith

Reviewed By: rnk

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
Paul Hoad [Wed, 13 Mar 2019 08:26:39 +0000 (08:26 +0000)]
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

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

5 years agoRevert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working...
Paul Hoad [Wed, 13 Mar 2019 08:15:03 +0000 (08:15 +0000)]
Revert "[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present"

This reverts commit b358cbb9b78389e20f7be36e1a98e26515c3ecce.

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

5 years ago[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else...
Paul Hoad [Wed, 13 Mar 2019 08:07:46 +0000 (08:07 +0000)]
[clang-format] [PR25010] AllowShortIfStatementsOnASingleLine not working if an "else" statement is present

Summary:
Addressing: PR25010 - https://bugs.llvm.org/show_bug.cgi?id=25010

Code like:

```
    if(true) var++;
    else  {
        var--;
    }
```

is reformatted to be

```
  if (true)
    var++;
  else {
    var--;
  }
```

Even when `AllowShortIfStatementsOnASingleLine` is true

The following revision comes from a +1'd suggestion in the PR to support AllowShortIfElseStatementsOnASingleLine

This suppresses the clause prevents the merging of the if when there is a compound else

Reviewers: klimek, djasper, JonasToth, alexfh, krasimir, reuk
Reviewed By: reuk
Subscribers: reuk, Higuoxing, jdoerfert, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D59087

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

5 years ago[X86] Remove 'cx16' from 'prescott' and 'yonah' as they are 32-bit only CPUs and...
Craig Topper [Wed, 13 Mar 2019 05:14:52 +0000 (05:14 +0000)]
[X86] Remove 'cx16' from 'prescott' and 'yonah' as they are 32-bit only CPUs and cmpxchg16b requires 64-bit mode.

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

5 years ago[X86] Add 'yonah' test to predefined-arch-macros.c test.
Craig Topper [Wed, 13 Mar 2019 05:14:50 +0000 (05:14 +0000)]
[X86] Add 'yonah' test to predefined-arch-macros.c test.

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

5 years agoDelete unused declaration of DeclContextPrintAction after the removal of -print-decl...
Fangrui Song [Wed, 13 Mar 2019 03:22:33 +0000 (03:22 +0000)]
Delete unused declaration of DeclContextPrintAction after the removal of -print-decl-contexts by D52529

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

5 years agoAdd XCOFF triple object format type for AIX
Jason Liu [Tue, 12 Mar 2019 22:01:10 +0000 (22:01 +0000)]
Add XCOFF triple object format type for AIX

This patch adds an XCOFF triple object format type into LLVM.
This XCOFF triple object file type will be used later by object file and assembly generation for the AIX platform.

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

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

5 years ago[NFC][clang][PCH][ObjC] Add some missing `VisitStmt(S);`
Roman Lebedev [Tue, 12 Mar 2019 21:31:00 +0000 (21:31 +0000)]
[NFC][clang][PCH][ObjC] Add some missing `VisitStmt(S);`

Summary:
These ObjC AST classes inherit from Stmt, but don't call `VisitStmt(S);`.
Some were founded with help of existing tests (with `NumStmtFields` bumped to `1`),
but some of them don't even have PCH test coverage. :/

Reviewers: arphaman, sammccall, smeenai, aprantl, rsmith, jordan_rose

Reviewed By: jordan_rose

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoReland "[Remarks] Add -foptimization-record-passes to filter remark emission"
Francis Visoiu Mistrih [Tue, 12 Mar 2019 21:22:27 +0000 (21:22 +0000)]
Reland "[Remarks] Add -foptimization-record-passes to filter remark emission"

Currently we have -Rpass for filtering the remarks that are displayed as
diagnostics, but when using -fsave-optimization-record, there is no way
to filter the remarks while generating them.

This adds support for filtering remarks by passes using a regex.
Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline`

will only emit the remarks coming from the pass `inline`.

This adds:

* `-fsave-optimization-record` to the driver
* `-opt-record-passes` to cc1
* `-lto-pass-remarks-filter` to the LTOCodeGenerator
* `--opt-remarks-passes` to lld
* `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2
* `-opt-remarks-passes` to gold-plugin

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

Original llvm-svn: 355964

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

5 years agoRevert "[Remarks] Add -foptimization-record-passes to filter remark emission"
Francis Visoiu Mistrih [Tue, 12 Mar 2019 20:54:18 +0000 (20:54 +0000)]
Revert "[Remarks] Add -foptimization-record-passes to filter remark emission"

This reverts commit 20fff32b7d1f1a1bd417b22aa9f26ededd97a3e5.

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

5 years ago[Remarks] Add -foptimization-record-passes to filter remark emission
Francis Visoiu Mistrih [Tue, 12 Mar 2019 20:28:50 +0000 (20:28 +0000)]
[Remarks] Add -foptimization-record-passes to filter remark emission

Currently we have -Rpass for filtering the remarks that are displayed as
diagnostics, but when using -fsave-optimization-record, there is no way
to filter the remarks while generating them.

This adds support for filtering remarks by passes using a regex.
Ex: `clang -fsave-optimization-record -foptimization-record-passes=inline`

will only emit the remarks coming from the pass `inline`.

This adds:

* `-fsave-optimization-record` to the driver
* `-opt-record-passes` to cc1
* `-lto-pass-remarks-filter` to the LTOCodeGenerator
* `--opt-remarks-passes` to lld
* `-pass-remarks-filter` to llc, opt, llvm-lto, llvm-lto2
* `-opt-remarks-passes` to gold-plugin

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

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

5 years ago[OPENMP]Allow to redefine entry for the variables definitions.
Alexey Bataev [Tue, 12 Mar 2019 20:05:17 +0000 (20:05 +0000)]
[OPENMP]Allow to redefine entry for the variables definitions.

If the variable was declared and marked as declare target, a new offload
entry with size 0 is created. But if later a definition is created and
marked as declare target, this definition is not added to the entry set
and the definition remains not mapped to the target. Patch fixes this
problem allowing to redefine the size and linkage for
previously registered declaration.

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

5 years ago[OPENMP 5.0]Initial support for 'allocator' clause.
Alexey Bataev [Tue, 12 Mar 2019 18:52:33 +0000 (18:52 +0000)]
[OPENMP 5.0]Initial support for 'allocator' clause.

Added parsing/sema analysis/serialization/deserialization for the
'allocator' clause of the 'allocate' directive.

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

5 years agoModules: Add LangOptions::CacheGeneratedPCH
Duncan P. N. Exon Smith [Tue, 12 Mar 2019 18:38:04 +0000 (18:38 +0000)]
Modules: Add LangOptions::CacheGeneratedPCH

Add an option to cache the generated PCH in the ModuleCache when
emitting it.  This protects clients that build PCHs and read them in the
same process, allowing them to avoid race conditions between parallel
jobs the same way that Clang's implicit module build system does.

rdar://problem/48740787

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

5 years agoAdd a creduce script for clang crashes
George Burgess IV [Tue, 12 Mar 2019 17:48:53 +0000 (17:48 +0000)]
Add a creduce script for clang crashes

This CL adds a script that calls C-Reduce on an input file and given the
clang crash script, which is used to generate an interestingness test
for C-Reduce.

Patch by Amy Huang!

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

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

5 years ago[CMake] Tell libc++ that we're using compiler-rt on Apple platforms
Louis Dionne [Tue, 12 Mar 2019 15:32:00 +0000 (15:32 +0000)]
[CMake] Tell libc++ that we're using compiler-rt on Apple platforms

Reviewers: beanz, arphaman, EricWF

Subscribers: dberris, mgorny, jkorous, dexonsmith, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[PR41007][OpenCL] Allow printf in C++ mode.
Anastasia Stulova [Tue, 12 Mar 2019 12:46:56 +0000 (12:46 +0000)]
[PR41007][OpenCL] Allow printf in C++ mode.

As for OpenCL C, we need to allow using printf and toolchain variadic
functions (prefixed by "__") in C++ mode.

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

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

5 years agoRevert "[analyzer] Fix function macro crash"
Kristof Umann [Tue, 12 Mar 2019 11:22:30 +0000 (11:22 +0000)]
Revert "[analyzer] Fix function macro crash"

Buildbot breaks when LLVm is compiled with memory sanitizer.

WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xa3d16d8 in getMacroNameAndPrintExpansion(blahblah)
                             lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:903:11

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

5 years ago[analyzer] Fix function macro crash
Kristof Umann [Tue, 12 Mar 2019 10:03:32 +0000 (10:03 +0000)]
[analyzer] Fix function macro crash

When there is a functor-like macro which is passed as parameter to another
"function" macro then its parameters are not listed at the place of expansion:

#define foo(x) int bar() { return x; }
#define hello(fvar) fvar(0)
hello(foo)
int main() { 1 / bar(); }

Expansion of hello(foo) asserted Clang, because it expected an l_paren token in
the 3rd line after "foo", since it is a function-like token.

Patch by Tibor Brunner!

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

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

5 years ago[Driver] Support object files in addition to static and shared libraries in compiler-rt
Petr Hosek [Tue, 12 Mar 2019 02:12:48 +0000 (02:12 +0000)]
[Driver] Support object files in addition to static and shared libraries in compiler-rt

This change introduces support for object files in addition to static
and shared libraries which were already supported which requires
changing the type of the argument from boolean to an enum.

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

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

5 years ago[DebugInfo] Add test cases for FlagNonTrivial
Aaron Smith [Tue, 12 Mar 2019 02:00:39 +0000 (02:00 +0000)]
[DebugInfo] Add test cases for FlagNonTrivial

Summary:
This is a test case to go with D44406 which added FlagNonTrivial to mark that a C++ record is non-trivial to support CodeView debug emission.

While it looks like FlagTypePassByValue can imply triviality and FlagTypePassByReference can imply non-triviality that is not true. Some non-trivial cases use a combination of FlagNonTrivial and FlagTypePassByValue instead of FlagTypePassByReference. See the test cases and D44406 for discussion.

Reviewers: dblaikie, rnk, zturner

Reviewed By: dblaikie

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

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

5 years agoRemove esan.
Nico Weber [Mon, 11 Mar 2019 20:23:40 +0000 (20:23 +0000)]
Remove esan.

It hasn't seen active development in years, and it hasn't reached a
state where it was useful.

Remove the code until someone is interested in working on it again.

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

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

5 years ago[OPENMP]Fix codegen for declare target link in target regions.
Alexey Bataev [Mon, 11 Mar 2019 19:51:42 +0000 (19:51 +0000)]
[OPENMP]Fix codegen for declare target link in target regions.

If the declare target link global is used in the target region
indirectly (used in the inner parallel, teams, etc. regions), we may
miss this variable and it leads to incorrect codegen.

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

5 years ago[clang] Add install targets for API headers
Shoaib Meenai [Mon, 11 Mar 2019 18:53:57 +0000 (18:53 +0000)]
[clang] Add install targets for API headers

Add an install target for clang's API headers, which allows them to be
included in distributions. The install rules already existed, but they
lacked a component and a target, making them only accessible via a full
install. These headers are useful for writing clang-based tooling, for
example. They're the clang equivalent to the llvm-headers target and
complement the clang-libraries target.

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

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

5 years agoclang-format: distinguish ObjC call subexpressions after r355434
Krasimir Georgiev [Mon, 11 Mar 2019 16:02:52 +0000 (16:02 +0000)]
clang-format: distinguish ObjC call subexpressions after r355434

Summary:
The revision r355434 had the unfortunate side-effect that it started to
recognize certain ObjC expressions with a call subexpression followed by a
`a->b` subexpression as C++ lambda expressions.

This patch adds a bit of logic to handle these cases and documents them in
tests.

The commented-out test cases in the new test suite are ones that were
problematic before r355434.

Reviewers: MyDeveloperDay, gribozavr

Reviewed By: MyDeveloperDay, gribozavr

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang

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

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

5 years agoRemove an unnecessary -f when cp'ing to a file that was just deleted. NFC.
Benjamin Kramer [Mon, 11 Mar 2019 10:44:10 +0000 (10:44 +0000)]
Remove an unnecessary -f when cp'ing to a file that was just deleted. NFC.

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

5 years ago[Serialization] Add missing include
Benjamin Kramer [Mon, 11 Mar 2019 10:30:51 +0000 (10:30 +0000)]
[Serialization] Add missing include

forward decl is not sufficient for destroying a unique_ptr<MemoryBuffer>.

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

5 years agoStop relying on allocator behaviour in modules unit test
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 20:15:01 +0000 (20:15 +0000)]
Stop relying on allocator behaviour in modules unit test

Another fixup for r355778 for Windows bots, this time to stop
accidentally relying on allocator behaviour for the test to pass.

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

5 years agoFix slashes in path references in -Rmodule-import test from r355778
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 19:33:32 +0000 (19:33 +0000)]
Fix slashes in path references in -Rmodule-import test from r355778

Fixup for r355778 to fix all the Windows bots.  Apparently I already
forgot the lesson from r355482 :/.

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

5 years agoModules: Invalidate out-of-date PCMs as they're discovered
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:44:01 +0000 (17:44 +0000)]
Modules: Invalidate out-of-date PCMs as they're discovered

Leverage the InMemoryModuleCache to invalidate a module the first time
it fails to import (and to lock a module as soon as it's built or
imported successfully).  For implicit module builds, this optimizes
importing deep graphs where the leaf module is out-of-date; see example
near the end of the commit message.

Previously the cache finalized ("locked in") all modules imported so far
when starting a new module build.  This was sufficient to prevent
loading two versions of the same module, but was somewhat arbitrary and
hard to reason about.

Now the cache explicitly tracks module state, where each module must be
one of:

- Unknown: module not in the cache (yet).
- Tentative: module in the cache, but not yet fully imported.
- ToBuild: module found on disk could not be imported; need to build.
- Final: module in the cache has been successfully built or imported.

Preventing repeated failed imports avoids variation in builds based on
shifting filesystem state.  Now it's guaranteed that a module is loaded
from disk exactly once.  It now seems safe to remove
FileManager::invalidateCache, but I'm leaving that for a later commit.

The new, precise logic uncovered a pre-existing problem in the cache:
the map key is the module filename, and different contexts use different
filenames for the same PCM file.  (In particular, the test
Modules/relative-import-path.c does not build without this commit.
r223577 started using a relative path to describe a module's base
directory when importing it within another module.  As a result, the
module cache sees an absolute path when (a) building the module or
importing it at the top-level, and a relative path when (b) importing
the module underneath another one.)

The "obvious" fix is to resolve paths using FileManager::getVirtualFile
and change the map key for the cache to a FileEntry, but some contexts
(particularly related to ASTUnit) have a shorter lifetime for their
FileManager than the InMemoryModuleCache.  This is worth pursuing
further in a later commit; perhaps by tying together the FileManager and
InMemoryModuleCache lifetime, or moving the in-memory PCM storage into a
VFS layer.

For now, use the PCM's base directory as-written for constructing the
filename to check the ModuleCache.

Example
=======

To understand the build optimization, first consider the build of a
module graph TU -> A -> B -> C -> D with an empty cache:

    TU builds A'
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

If we build TU again, where A, B, C, and D are in the cache and D is
out-of-date, we would previously get this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A'
       A' imports B
          imports C
          imports D (out-of-date)
          builds B'
          B' imports C
             imports D (out-of-date)
             builds C'
             C' imports D (out-of-date)
                builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
     TU imports A'
        imports B'
        imports C'
        imports D'

After this commit, we'll immediateley invalidate A, B, C, and D when we
first observe that D is out-of-date, giving this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A' // The same graph as an empty cache.
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

The new build matches what we'd naively expect, pretty closely matching
the original build with the empty cache.

rdar://problem/48545366

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

5 years agoModules: Rename MemoryBufferCache to InMemoryModuleCache
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:33:56 +0000 (17:33 +0000)]
Modules: Rename MemoryBufferCache to InMemoryModuleCache

Change MemoryBufferCache to InMemoryModuleCache, moving it from Basic to
Serialization.  Another patch will start using it to manage module build
more explicitly, but this is split out because it's mostly mechanical.

Because of the move to Serialization we can no longer abuse the
Preprocessor to forward it to the ASTReader.  Besides the rename and
file move, that means Preprocessor::Preprocessor has one fewer parameter
and ASTReader::ASTReader has one more.

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

5 years ago[CMake] Support stripping and linking output to .build-id directory
Petr Hosek [Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)]
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

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

5 years ago[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments...
Eric Fiselier [Fri, 8 Mar 2019 22:06:48 +0000 (22:06 +0000)]
[8.0 Regression] Fix handling of `__builtin_constant_p` inside template arguments, enumerators, case statements, and the enable_if attribute.

Summary:
The following code is accepted by Clang 7 and prior but rejected by the upcoming 8 release and in trunk [1]

```
// error {{never produces a constant expression}}
void foo(const char* s) __attribute__((enable_if(__builtin_constant_p(*s) == false, "trap"))) {}
void test() { foo("abc"); }
```

Prior to Clang 8, the call to `__builtin_constant_p` was a constant expression returning false. Currently, it's not a valid constant expression.

The bug is caused because we failed to set `InConstantContext` when attempting to evaluate unevaluated constant expressions.

[1]  https://godbolt.org/z/ksAjmq

Reviewers: rsmith, hans, sbenza

Reviewed By: rsmith

Subscribers: kristina, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Remove debug service variable.
Alexey Bataev [Fri, 8 Mar 2019 20:48:54 +0000 (20:48 +0000)]
[OPENMP]Remove debug service variable.

Removed not required service variable for the debug info.

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

5 years ago[docs] Fix checkers.rst doc for PointerSorting checker
Mandeep Singh Grang [Fri, 8 Mar 2019 20:35:25 +0000 (20:35 +0000)]
[docs] Fix checkers.rst doc for PointerSorting checker

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

5 years agoRevert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
Matthew Voss [Fri, 8 Mar 2019 20:33:55 +0000 (20:33 +0000)]
Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"

This broke the windows bots.

This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0.

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

5 years agoRevert "Recommit "Support attribute used in member funcs of class templates""
Rafael Auler [Fri, 8 Mar 2019 20:23:57 +0000 (20:23 +0000)]
Revert "Recommit "Support attribute used in member funcs of class templates""

There is nontrivial bug caused in lld that I need to further
investigate. Meanwhile, I'll revert this.

This reverts commit 8297e93480c636dc90fd14653c5a66406193363f.

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

5 years ago[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements
Mandeep Singh Grang [Fri, 8 Mar 2019 20:13:53 +0000 (20:13 +0000)]
[Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

Summary:
Added a new category of checkers for non-determinism. Added a checker for non-determinism
caused due to sorting containers with pointer-like elements.

Reviewers: NoQ, george.karpenkov, whisperity, Szelethus

Reviewed By: NoQ, Szelethus

Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Fix infinite recursion in printing macros
Kristof Umann [Fri, 8 Mar 2019 16:26:29 +0000 (16:26 +0000)]
[analyzer] Fix infinite recursion in printing macros

In the commited testfile, macro expansion (the one implemented for the plist
output) runs into an infinite recursion. The issue originates from the algorithm
being faulty, as in

#define value REC_MACRO_FUNC(value)

the "value" is being (or at least attempted) expanded from the same macro.

The solved this issue by gathering already visited macros in a set, which does
resolve the crash, but will result in an incorrect macro expansion, that would
preferably be fixed down the line.

Patch by Tibor Brunner!

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

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

5 years ago[analyzer] Emit an error rather than assert on invalid checker option input
Kristof Umann [Fri, 8 Mar 2019 16:00:42 +0000 (16:00 +0000)]
[analyzer] Emit an error rather than assert on invalid checker option input

Asserting on invalid input isn't very nice, hence the patch to emit an error
instead.

This is the first of many patches to overhaul the way we handle checker options.

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

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

5 years ago[analyzer] Use the new infrastructure of expressing taint propagation, NFC
Kristof Umann [Fri, 8 Mar 2019 15:47:56 +0000 (15:47 +0000)]
[analyzer] Use the new infrastructure of expressing taint propagation, NFC

In D55734, we implemented a far more general way of describing taint propagation
rules for functions, like being able to specify an unlimited amount of
source and destination parameters. Previously, we didn't have a particularly
elegant way of expressing the propagation rules for functions that always return
(either through an out-param or return value) a tainted value. In this patch,
we model these functions similarly to other ones, by assigning them a
TaintPropagationRule that describes that they "create a tainted value out of
nothing".

The socket C function is somewhat special, because for certain parameters (for
example, if we supply localhost as parameter), none of the out-params should
be tainted. For this, we added a general solution of being able to specify
custom taint propagation rules through function pointers.

Patch by Gábor Borsik!

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

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

5 years agoUse {{.*}} in test case to match the type of wide string literals.
Akira Hatanaka [Fri, 8 Mar 2019 15:20:12 +0000 (15:20 +0000)]
Use {{.*}} in test case to match the type of wide string literals.

The type of wide string literals varies depending on the target.

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

5 years agoRe-fix _lrotl/_lrotr to always take Long, no matter the platform.
Erich Keane [Fri, 8 Mar 2019 15:10:07 +0000 (15:10 +0000)]
Re-fix _lrotl/_lrotr to always take Long, no matter the platform.

r355322 fixed this, however is being reverted due to concerns with
enabling it in other modes.

Change-Id: I6a939b7469b8fa196d5871a627eb2330dbd30f29

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

5 years agoRevert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."
Erich Keane [Fri, 8 Mar 2019 15:10:05 +0000 (15:10 +0000)]
Revert "Enable _rotl, _lrotl, _rotr, _lrotr on all platforms."

This reverts commit 24400dafe16716f28cd0e7e5fa6e004c0e50686a.

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Fri, 8 Mar 2019 10:44:06 +0000 (10:44 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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

5 years ago[clang][Index] Fix msan failure
Kadir Cetinkaya [Fri, 8 Mar 2019 10:18:40 +0000 (10:18 +0000)]
[clang][Index] Fix msan failure

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

5 years agoclang-cl : Parse all /d2 options
Hans Wennborg [Fri, 8 Mar 2019 10:00:42 +0000 (10:00 +0000)]
clang-cl : Parse all /d2 options

We will now warn about such options being unused,
which is better than the current
"no such file or directory: '/d2foo'" errors.

Note that we can still handle specific flags separately,
e.g. we were already ignoring /d2FastFail and /d2Zi+

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

5 years ago[clang][Tooling] Delete dots and dotdots when generating absolute paths
Kadir Cetinkaya [Fri, 8 Mar 2019 09:42:04 +0000 (09:42 +0000)]
[clang][Tooling] Delete dots and dotdots when generating absolute paths

Summary:
GetAllFiles interface returns absolute paths, but keeps dots and dot
dots. This patch makes those paths canonical by deleting them.

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd another test for r354937 that came up in PR40890
Hans Wennborg [Fri, 8 Mar 2019 09:01:10 +0000 (09:01 +0000)]
Add another test for r354937 that came up in PR40890

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

5 years ago[clang][Index] Mark references from Constructors and Destructors to class as NameRefe...
Kadir Cetinkaya [Fri, 8 Mar 2019 08:30:20 +0000 (08:30 +0000)]
[clang][Index] Mark references from Constructors and Destructors to class as NameReference

Summary:
In current indexing logic we get references to class itself when we see
a constructor/destructor which is only syntactically true. Semantically
this information is not correct. This patch marks that reference as
NameReference to let clients deal with it.

Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir

Reviewed By: gribozavr, nathawes

Subscribers: nathawes, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[Clang] Include the test directory ommited in r355665
Petr Hosek [Fri, 8 Mar 2019 06:16:32 +0000 (06:16 +0000)]
[Clang] Include the test directory ommited in r355665

This was omitted in r355655 causing the test to fail.

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

5 years ago[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
Petr Hosek [Fri, 8 Mar 2019 05:35:22 +0000 (05:35 +0000)]
[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/

This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.

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

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

5 years agoFix test case committed in r355662.
Akira Hatanaka [Fri, 8 Mar 2019 05:30:54 +0000 (05:30 +0000)]
Fix test case committed in r355662.

Build bots were failing because wide string literals don't have type
'int *' on some targets.

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

5 years ago[ObjC] Emit a boxed expression as a compile-time constant if the
Akira Hatanaka [Fri, 8 Mar 2019 04:45:37 +0000 (04:45 +0000)]
[ObjC] Emit a boxed expression as a compile-time constant if the
expression inside the parentheses is a valid UTF-8 string literal.

Previously clang emitted an expression like @("abc") as a message send
to stringWithUTF8String. This commit makes clang emit the boxed
expression as a compile-time constant instead.

This commit also has the effect of silencing the nullable-to-nonnull
conversion warning clang started emitting after r317727, which
originally motivated this commit (see https://oleb.net/2018/@keypath).

rdar://problem/42684601

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

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

5 years agoVariable auto-init: split out small arrays
JF Bastien [Fri, 8 Mar 2019 01:26:49 +0000 (01:26 +0000)]
Variable auto-init: split out small arrays

Summary: Following up with r355181, initialize small arrays as well.

LLVM stage2 shows a tiny size gain.

<rdar://48523005>

Reviewers: glider, pcc, kcc, rjmccall

Subscribers: jkorous, dexonsmith, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Make x86-intrinsics-headers-clean.cpp stricter.
Craig Topper [Fri, 8 Mar 2019 01:15:18 +0000 (01:15 +0000)]
[X86] Make x86-intrinsics-headers-clean.cpp stricter.

Remove the -Wno-ignored-attributes.

Add -fno-lax-vector-conversions

Also use -ffreestanding instead of defining _MM_MALLOC_H.

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

5 years agoRecommit "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 7 Mar 2019 19:14:30 +0000 (19:14 +0000)]
Recommit "Support attribute used in member funcs of class templates"

The patch originally broke code that was incompatible with GCC, but
we want to follow GCC behavior here according to the discussion in
https://reviews.llvm.org/D58216

Original commit message:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

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

5 years agoFix some clang analysis tests passing arguments incorrectly
Reid Kleckner [Thu, 7 Mar 2019 18:57:04 +0000 (18:57 +0000)]
Fix some clang analysis tests passing arguments incorrectly

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

5 years agoDelete x86_64 ShadowCallStack support
Vlad Tsyrklevich [Thu, 7 Mar 2019 18:56:36 +0000 (18:56 +0000)]
Delete x86_64 ShadowCallStack support

Summary:
ShadowCallStack on x86_64 suffered from the same racy security issues as
Return Flow Guard and had performance overhead as high as 13% depending
on the benchmark. x86_64 ShadowCallStack was always an experimental
feature and never shipped a runtime required to support it, as such
there are no expected downstream users.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mgorny, javed.absar, hiraditya, jdoerfert, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years agoRollback of rL355585.
Mitch Phillips [Thu, 7 Mar 2019 18:13:39 +0000 (18:13 +0000)]
Rollback of rL355585.

Introduces memory leak in FunctionTest.GetPointerAlignment that breaks sanitizer buildbots:

```
=================================================================
==2453==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x16936bc in llvm::User::operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/User.cpp:151:19
    #2 0x7c3fe9 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:12
    #3 0x7c3fe9 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #4 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #5 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #6 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #7 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #8 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #9 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #10 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #11 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #12 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #13 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

Indirect leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x610428 in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x151be6b in make_unique<llvm::ValueSymbolTable> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/ADT/STLExtras.h:1349:29
    #2 0x151be6b in llvm::Function::Function(llvm::FunctionType*, llvm::GlobalValue::LinkageTypes, unsigned int, llvm::Twine const&, llvm::Module*) /b/sanitizer-x86_64-linux-bootstrap/build/llvm/lib/IR/Function.cpp:241
    #3 0x7c4006 in Create /b/sanitizer-x86_64-linux-bootstrap/build/llvm/include/llvm/IR/Function.h:144:16
    #4 0x7c4006 in (anonymous namespace)::FunctionTest_GetPointerAlignment_Test::TestBody() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/unittests/IR/FunctionTest.cpp:136
    #5 0x1a836a0 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #6 0x1a836a0 in testing::Test::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #7 0x1a85c55 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #8 0x1a870d0 in testing::TestCase::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #9 0x1aa5b84 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #10 0x1aa4d30 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc
    #11 0x1aa4d30 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #12 0x1a6b656 in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #13 0x1a6b656 in main /b/sanitizer-x86_64-linux-bootstrap/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #14 0x7f5af37a22e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)

SUMMARY: AddressSanitizer: 168 byte(s) leaked in 2 allocation(s).
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/11358/steps/check-llvm%20asan/logs/stdio for more information.

Also introduces use-of-uninitialized-value in ConstantsTest.FoldGlobalVariablePtr:
```
==7070==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x14e703c in User /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5
    #1 0x14e703c in Constant /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/Constant.h:44
    #2 0x14e703c in llvm::GlobalValue::GlobalValue(llvm::Type*, llvm::Value::ValueTy, llvm::Use*, unsigned int, llvm::GlobalValue::LinkageTypes, llvm::Twine const&, unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalValue.h:78
    #3 0x14e5467 in GlobalObject /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/GlobalObject.h:34:9
    #4 0x14e5467 in llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool) /b/sanitizer-x86_64-linux-fast/build/llvm/lib/IR/Globals.cpp:314
    #5 0x6938f1 in llvm::(anonymous namespace)::ConstantsTest_FoldGlobalVariablePtr_Test::TestBody() /b/sanitizer-x86_64-linux-fast/build/llvm/unittests/IR/ConstantsTest.cpp:565:18
    #6 0x1a240a1 in HandleExceptionsInMethodIfSupported<testing::Test, void> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #7 0x1a240a1 in testing::Test::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2474
    #8 0x1a26d26 in testing::TestInfo::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2656:11
    #9 0x1a2815f in testing::TestCase::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:2774:28
    #10 0x1a43de8 in testing::internal::UnitTestImpl::RunAllTests() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4649:43
    #11 0x1a42c47 in HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc
    #12 0x1a42c47 in testing::UnitTest::Run() /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/src/gtest.cc:4257
    #13 0x1a0dfba in RUN_ALL_TESTS /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/googletest/include/gtest/gtest.h:2233:46
    #14 0x1a0dfba in main /b/sanitizer-x86_64-linux-fast/build/llvm/utils/unittest/UnitTestMain/TestMain.cpp:50
    #15 0x7f2081c412e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #16 0x4dff49 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/unittests/IR/IRTests+0x4dff49)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/IR/User.h:79:5 in User
```

See http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30222/steps/check-llvm%20msan/logs/stdio for more information.

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

5 years ago[OPENMP 5.0]Add initial support for 'allocate' directive.
Alexey Bataev [Thu, 7 Mar 2019 17:54:44 +0000 (17:54 +0000)]
[OPENMP 5.0]Add initial support for 'allocate' directive.

Added parsing/sema analysis/serialization/deserialization support for
'allocate' directive.

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

5 years ago[Sema] Change addr space diagnostics in casts to follow C++ style.
Anastasia Stulova [Thu, 7 Mar 2019 17:06:30 +0000 (17:06 +0000)]
[Sema] Change addr space diagnostics in casts to follow C++ style.

This change adds a new diagnostic for mismatching address spaces
to be used for C++ casts (only enabled in C style cast for now,
the rest will follow!).

The change extends C-style cast rules to account for address spaces.
It also adds a separate function for address space cast checking that
can be used to map from a separate address space cast operator
addrspace_cast (to be added as a follow up patch).

Note, that after this change clang will no longer allows arbitrary
address space conversions in reinterpret_casts because they can lead
to accidental errors. The implicit safe conversions would still be
allowed.

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

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

5 years ago[PR40778][Sema] Adjust addr space of operands in builtin operators.
Anastasia Stulova [Thu, 7 Mar 2019 16:43:41 +0000 (16:43 +0000)]
[PR40778][Sema] Adjust addr space of operands in builtin operators.

Adjust address space for references and pointer operands of builtin operators.

Currently this change only fixes addr space in assignment (= and |=) operator,
that is needed for the test case reported in the bug. Wider support for all
other operations will follow.

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

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

5 years ago[PR40778] Preserve addr space in Derived to Base cast.
Anastasia Stulova [Thu, 7 Mar 2019 16:23:15 +0000 (16:23 +0000)]
[PR40778] Preserve addr space in Derived to Base cast.

The address space for the Base class pointer when up-casting
from Derived should be taken from the Derived class pointer.

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

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

5 years ago[analyzer] handle modification of vars inside an expr with comma operator
Petar Jovanovic [Thu, 7 Mar 2019 15:50:52 +0000 (15:50 +0000)]
[analyzer] handle modification of vars inside an expr with comma operator

We should track mutation of a variable within a comma operator expression.
Current code in ExprMutationAnalyzer does not handle it.

This will handle cases like:

(a, b) ++ < == b is modified
(a, b) = c < == b is modifed

Patch by Djordje Todorovic.

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

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

5 years agoexpected-no-diagnostics@ does not make sense, switching to a more idiomatic form...
Aaron Ballman [Thu, 7 Mar 2019 15:03:06 +0000 (15:03 +0000)]
expected-no-diagnostics@ does not make sense, switching to a more idiomatic form; NFC.

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

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Balazs Keri [Thu, 7 Mar 2019 14:09:18 +0000 (14:09 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.

Reviewers: a.sidorin, shafik, a_sidorin, martong

Reviewed By: a_sidorin

Subscribers: rnkovacs, jdoerfert, davide, aprantl, llvm-commits, gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Import member expr with explicit template args
Gabor Marton [Thu, 7 Mar 2019 13:38:20 +0000 (13:38 +0000)]
[ASTImporter] Import member expr with explicit template args

Summary:
Member expressions with explicit template arguments were not imported
correctly: the DeclRefExpr was missing. This patch fixes.

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Handle redecl chain of FunctionTemplateDecls
Gabor Marton [Thu, 7 Mar 2019 13:01:51 +0000 (13:01 +0000)]
[ASTImporter] Handle redecl chain of FunctionTemplateDecls

Summary:
Redecl chains of function templates are not handled well currently. We
want to handle them similarly to functions, i.e. try to keep the
structure of the original AST as much as possible. The aim is to not
squash a prototype with a definition, rather we create both and put them
in a redecl chain.

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Handle comparison between non-default AS symbol and constant
David Stenberg [Thu, 7 Mar 2019 13:01:17 +0000 (13:01 +0000)]
[analyzer] Handle comparison between non-default AS symbol and constant

Summary:
When comparing a symbolic region and a constant, the constant would be
widened or truncated to the width of a void pointer, meaning that the
constant could be incorrectly truncated when handling symbols for
non-default address spaces. In the attached test case this resulted in a
false positive since the constant was truncated to zero. To fix this,
widen/truncate the constant to the width of the symbol expression's
type.

This commit does not consider non-symbolic regions as I'm not sure how
to generalize getting the type there.

This fixes PR40814.

Reviewers: NoQ, zaks.anna, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits

Tags: #clang

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

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

5 years ago[libclang] Fix CXTranslationUnit_KeepGoing
Ivan Donchevskii [Thu, 7 Mar 2019 10:13:50 +0000 (10:13 +0000)]
[libclang] Fix CXTranslationUnit_KeepGoing

Since
  commit 56f548bbbb7e4387a69708f70724d00e9e076153
  [modules] Round-trip -Werror flag through explicit module build.
the behavior of CXTranslationUnit_KeepGoing changed:
Unresolved #includes are fatal errors again. As a consequence, some
templates are not instantiated and lead to confusing errors.

Revert to the old behavior: With CXTranslationUnit_KeepGoing fatal
errors are mapped to errors.

Patch by Nikolai Kosjar.

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

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Thu, 7 Mar 2019 09:15:23 +0000 (09:15 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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

5 years ago[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)
Rong Xu [Wed, 6 Mar 2019 23:00:38 +0000 (23:00 +0000)]
[PGO] Re-submit: Clang part of change for context-sensitive PGO (part2)

Part 2 of CSPGO change in Clang: Add test cases.

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

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

5 years ago[CUDA][HIP][DebugInfo] Skip reference device function
Michael Liao [Wed, 6 Mar 2019 21:16:27 +0000 (21:16 +0000)]
[CUDA][HIP][DebugInfo] Skip reference device function

Summary:
- A device functions could be used as a non-type template parameter in a
  global/host function template. However, we should not try to retrieve that
  device function and reference it in the host-side debug info as it's
  only valid at device side.

Subscribers: aprantl, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoAMDGPU: Fix the mapping of sub group sync scope
Konstantin Zhuravlyov [Wed, 6 Mar 2019 20:54:48 +0000 (20:54 +0000)]
AMDGPU: Fix the mapping of sub group sync scope

Map memory_scope_sub_group to "wavefront" sync scope

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

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

5 years agoPassthrough compiler launcher
JF Bastien [Wed, 6 Mar 2019 20:36:00 +0000 (20:36 +0000)]
Passthrough compiler launcher

Summary: Not having this seems like an oversight, and makes stage2 builds odd.

Reviewers: ddunbar, dexonsmith

Subscribers: mgorny, jkorous, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years agoRevert "[IR][ARM] Add function pointer alignment to datalayout"
Mitch Phillips [Wed, 6 Mar 2019 19:17:18 +0000 (19:17 +0000)]
Revert "[IR][ARM] Add function pointer alignment to datalayout"

This reverts commit 2391bfca97290181ae65796ea6da135d1b6d037b.

This reverts rL355522 (https://reviews.llvm.org/D57335).

Kills buildbots that use '-Werror' with the following error:
/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/llvm/lib/IR/Value.cpp:657:7: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]

See buildbots http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/30200/steps/check-llvm%20asan/logs/stdio for more information.

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

5 years ago[IR][ARM] Add function pointer alignment to datalayout
Michael Platings [Wed, 6 Mar 2019 17:24:11 +0000 (17:24 +0000)]
[IR][ARM] Add function pointer alignment to datalayout

Use this feature to fix a bug on ARM where 4 byte alignment is
incorrectly assumed.

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

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