]> granicus.if.org Git - clang/log
clang
5 years ago[NFC][clang] Refactor getCompilationPhases()+Types.def step 2.
Puyan Lotfi [Thu, 25 Jul 2019 22:05:55 +0000 (22:05 +0000)]
[NFC][clang] Refactor getCompilationPhases()+Types.def step 2.

- Removing a few of the entries in the Flags for the Types.def table.
- Removing redundant parts of getCompilationPhases().

Flags have been removed from Types.def:

 a - The type should only be assembled: Now, check that Phases contains
     phases::Assemble but not phases::Compile or phases::Backend.
 p - The type should only be precompiled: Now, check that Phases contains
     phases::Precompile but that Flags does not contain 'm'.
 m - Precompiling this type produces a module file: Now, check that
     isPrepeocessedModuleType.

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

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

5 years agoRevert "Revert "CodeGen: ensure placeholder instruction for cleanup is created""
Saleem Abdulrasool [Thu, 25 Jul 2019 20:59:48 +0000 (20:59 +0000)]
Revert "Revert "CodeGen: ensure placeholder instruction for cleanup is created""

This reverts commit fd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19.

Add an explicit triple for the test which is pattern matching overly
aggressively.

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

5 years agoReland the "[NewPM] Port Sancov" patch from rL365838. No functional
Leonard Chan [Thu, 25 Jul 2019 20:53:15 +0000 (20:53 +0000)]
Reland the "[NewPM] Port Sancov" patch from rL365838. No functional
changes were made to the patch since then.

--------

[NewPM] Port Sancov

This patch contains a port of SanitizerCoverage to the new pass manager. This one's a bit hefty.

Changes:

- Split SanitizerCoverageModule into 2 SanitizerCoverage for passing over
  functions and ModuleSanitizerCoverage for passing over modules.
- ModuleSanitizerCoverage exists for adding 2 module level calls to initialization
  functions but only if there's a function that was instrumented by sancov.
- Added legacy and new PM wrapper classes that own instances of the 2 new classes.
- Update llvm tests and add clang tests.

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

5 years agoRevert "CodeGen: ensure placeholder instruction for cleanup is created"
JF Bastien [Thu, 25 Jul 2019 20:50:09 +0000 (20:50 +0000)]
Revert "CodeGen: ensure placeholder instruction for cleanup is created"

Originally in https://reviews.llvm.org/D64656

Causes bot failures:

/home/buildslave/buildslave/clang-cmake-armv8-full/llvm/tools/clang/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp:20:16: error: CHECK-NEXT: expected string not found in input
// CHECK-NEXT: call void @_ZN1RC1E1Q(%struct.R* [[TMP_R]])
               ^
<stdin>:37:2: note: scanning from here
 %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1)
 ^
<stdin>:37:2: note: with "TMP_R" equal to "%1"
 %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1)
 ^
<stdin>:37:17: note: possible intended match here
 %8 = call %struct.R* @_ZN1RC1E1Q(%struct.R* %1)
                ^

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

5 years agoCodeGen: ensure placeholder instruction for cleanup is created
Saleem Abdulrasool [Thu, 25 Jul 2019 17:59:29 +0000 (17:59 +0000)]
CodeGen: ensure placeholder instruction for cleanup is created

A placeholder instruction for use in generation of cleanup code for an
initializer list would not be emitted if the base class contained a
non-trivial destructor and the class contains no fields of its own. This
would be the case when using CTAD to deduce the template arguments for a
struct with an overloaded call operator, e.g.

```
template <class... Ts> struct ctad : Ts... {};
template <class... Ts> ctad(Ts...)->ctad<Ts...>;
```

and this class was initialized with a list of lambdas capturing by copy,
e.g.

```
ctad c {[s](short){}, [s](long){}};
```

In a release build the bug would manifest itself as a crash in the SROA
pass, however, in a debug build the following assert in CGCleanup.cpp
would fail:

```
assert(dominatingIP && "no existing variable and no dominating IP!");
```

By ensuring that a placeholder instruction is emitted even if there's no
fields in the class, neither the assert nor the crash is reproducible.

See https://bugs.llvm.org/show_bug.cgi?id=40771

Patch by Ã˜ystein Dale!

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

5 years agoAdd lifetime categories attributes
Matthias Gehre [Thu, 25 Jul 2019 17:50:51 +0000 (17:50 +0000)]
Add lifetime categories attributes

Summary:
This is the first part of work announced in
"[RFC] Adding lifetime analysis to clang" [0],
i.e. the addition of the [[gsl::Owner(T)]] and
[[gsl::Pointer(T)]] attributes, which
will enable user-defined types to participate in
the lifetime analysis (which will be part of the
next PR).
The type `T` here is called "DerefType" in the paper,
and denotes the type that an Owner owns and a Pointer
points to. E.g. `std::vector<int>` should be annotated
with `[[gsl::Owner(int)]]` and
a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`.

[0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html

Reviewers: gribozavr

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

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

5 years agoRemove CallingConvMethodType
Erich Keane [Thu, 25 Jul 2019 17:14:45 +0000 (17:14 +0000)]
Remove CallingConvMethodType

This seems to be an old vestage of a previous implementation of getting
the default calling convention, and everything is now using
CXXABI/ASTContext's getDefaultCallingConvention.  Remove it, since it
isn't doing anything.

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

5 years agoFix cxx_status html for r367027
Erich Keane [Thu, 25 Jul 2019 17:14:37 +0000 (17:14 +0000)]
Fix cxx_status html for r367027

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

5 years agoAllow prefetching from non-zero address spaces
JF Bastien [Thu, 25 Jul 2019 16:11:57 +0000 (16:11 +0000)]
Allow prefetching from non-zero address spaces

Summary:
This is useful for targets which have prefetch instructions for non-default address spaces.

<rdar://problem/42662136>

Subscribers: nemanjai, javed.absar, hiraditya, kbarton, jkorous, dexonsmith, cfe-commits, llvm-commits, RKSimon, hfinkel, t.p.northover, craig.topper, anemet

Tags: #clang, #llvm

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

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

5 years agoImplement P1771
Erich Keane [Thu, 25 Jul 2019 15:10:56 +0000 (15:10 +0000)]
Implement P1771

As passed in the Cologne meeting and treated by Core as a DR,
[[nodiscard]] was applied to constructors so that they can be diagnosed
in cases where the user forgets a variable name for a type.

The intent is to enable the library to start using this on the
constructors of scope_guard/lock_guard.

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

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

5 years ago[clang] Remove IsDerivedFromDeathTest.DiesOnEmptyBaseName test.
Anton Bikineev [Thu, 25 Jul 2019 15:09:37 +0000 (15:09 +0000)]
[clang] Remove IsDerivedFromDeathTest.DiesOnEmptyBaseName test.

The semantics of an empty basename passed to isDerivedFrom matchers
changed in r367022, so this test is no longer relevant.

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

5 years ago[clang] Fail for empty names in is*DerivedFrom matchers.
Anton Bikineev [Thu, 25 Jul 2019 14:48:55 +0000 (14:48 +0000)]
[clang] Fail for empty names in is*DerivedFrom matchers.

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

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

5 years agoFix failing test plist-macros-with-expansion-ctu.c
Balazs Keri [Thu, 25 Jul 2019 12:46:42 +0000 (12:46 +0000)]
Fix failing test plist-macros-with-expansion-ctu.c

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

5 years agoUpdate some tests after r366702
Krasimir Georgiev [Thu, 25 Jul 2019 12:15:46 +0000 (12:15 +0000)]
Update some tests after r366702

Summary:
r366702 added a set of new clang-cl -- specific openmp flags together with tests.
The way the newly added tests work is problematic: consider for example this
asertion:
```
// RUN: %clang_cl --target=x86_64-windows-msvc /openmp -### -- %s 2>&1 | FileCheck --check-prefix=CHECK-CC1-OPENMP %s
...
// CHECK-CC1-OPENMP: "-fopenmp"
```

It asserts that an `/openmp` flag should expand into `-fopenmp`. This however
depends on the default value of Clang's CLANG_DEFAULT_OPENMP_RUNTIME value.
Indeed, the code that adds `-fopenmp` to the output only does it if the default
runtime is `libomp` or `libiomp5`, not when it is `libgomp`.

I've updated the tests to not depend on the default value of this setting by
specifying the runtime to use explicitly in each assertion.

Reviewers: jdoerfert

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang] Add isDirectlyDerivedFrom AST matcher.
Anton Bikineev [Thu, 25 Jul 2019 11:54:13 +0000 (11:54 +0000)]
[clang] Add isDirectlyDerivedFrom AST matcher.

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

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

5 years ago[OpenCL] Rename lang mode flag for C++ mode
Anastasia Stulova [Thu, 25 Jul 2019 11:04:29 +0000 (11:04 +0000)]
[OpenCL] Rename lang mode flag for C++ mode

Rename lang mode flag to -cl-std=clc++/-cl-std=CLC++
or -std=clc++/-std=CLC++.

This aligns with OpenCL C conversion and removes ambiguity
with OpenCL C++.

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

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

5 years ago[CrossTU] Fix plist macro expansion if macro in other file.
Balazs Keri [Thu, 25 Jul 2019 10:53:22 +0000 (10:53 +0000)]
[CrossTU] Fix plist macro expansion if macro in other file.

Summary:
When cross TU analysis is used it is possible that a macro expansion
is generated for a macro that is defined (and used) in other than
the main translation unit. To get the expansion for it the source
location in the original source file and original preprocessor
is needed.

Reviewers: martong, xazax.hun, Szelethus, ilya-biryukov

Reviewed By: Szelethus

Subscribers: mgorny, NoQ, ilya-biryukov, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Reorder fields after structure import is finished
Gabor Marton [Thu, 25 Jul 2019 09:07:17 +0000 (09:07 +0000)]
[ASTImporter] Reorder fields after structure import is finished

We reorder declarations in RecordDecls because they may have another order
in the "to" context than they have in the "from" context. This may happen
e.g when we import a class like this:
   struct declToImport {
       int a = c + b;
       int b = 1;
       int c = 2;
   };
During the import of `a` we import first the dependencies in sequence,
thus the order would be `c`, `b`, `a`. We will get the normal order by
first removing the already imported members and then adding them in the
order as they apper in the "from" context.

Keeping field order is vital because it determines structure layout.

Reviewers: a_sidorin, shafik

Tags: #clang

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

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

5 years ago[Clang] New loop pragma vectorize_predicate
Sjoerd Meijer [Thu, 25 Jul 2019 07:33:13 +0000 (07:33 +0000)]
[Clang] New loop pragma vectorize_predicate

This adds a new vectorize predication loop hint:

  #pragma clang loop vectorize_predicate(enable)

that can be used to indicate to the vectoriser that all (load/store)
instructions should be predicated (masked). This allows, for example, folding
of the remainder loop into the main loop.

This patch will be followed up with D64916 and D65197. The former is a
refactoring in the loopvectorizer and the groundwork to make tail loop folding
a more general concept, and in the latter the actual tail loop folding
transformation will be implemented.

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

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

5 years agoRevert "[Sema] Enable -Wimplicit-float-conversion for integral to floating point...
Petr Hosek [Thu, 25 Jul 2019 03:11:49 +0000 (03:11 +0000)]
Revert "[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss"

This reverts commit r366972 which broke the following tests:

  Clang :: CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
  Clang :: CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp

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

5 years ago[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision...
Ziang Wan [Thu, 25 Jul 2019 00:32:50 +0000 (00:32 +0000)]
[Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Issue an warning when the code tries to do an implicit int -> float
conversion, where the float type ha a narrower significant than the
float type.

The new warning is controlled by flag -Wimplicit-int-float-conversion,
under -Wimplicit-float-conversion and -Wconversion.

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

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

5 years agoRevert "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"
Azharuddin Mohammed [Wed, 24 Jul 2019 22:42:50 +0000 (22:42 +0000)]
Revert "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"

This reverts commit 9178b10163f758cbf8a5290ea6a827990427ddc0 (r365969).

We are back to using Python2 and this is failing. This should instead be made
to be compatible with both Python 2 and 3.

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

5 years agoFix exporting SARIF files from scan-build on Windows.
Aaron Ballman [Wed, 24 Jul 2019 20:03:27 +0000 (20:03 +0000)]
Fix exporting SARIF files from scan-build on Windows.

In Perl, -z is defined as checking if a "file has zero size" and makes no mention what it does when given a directory. It looks like the behavior differs across platforms, which is why on Windows the SARIF file was always being deleted.

Patch by Joe Ranieri.

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

5 years agoclang-format: Add another test like r366926
Nico Weber [Wed, 24 Jul 2019 17:15:47 +0000 (17:15 +0000)]
clang-format: Add another test like r366926

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

5 years agoclang-format: Add a test that shows that some code I thought was dead is not dead.
Nico Weber [Wed, 24 Jul 2019 17:01:57 +0000 (17:01 +0000)]
clang-format: Add a test that shows that  some code I thought was dead is not dead.

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

5 years ago[Support] Fix `-ftime-trace-granularity` option
Anton Afanasyev [Wed, 24 Jul 2019 14:55:40 +0000 (14:55 +0000)]
[Support] Fix `-ftime-trace-granularity` option

Summary:
Move `-ftime-trace-granularity` option to frontend options. Without patch
this option is showed up in the help for any tool that links libSupport.

Reviewers: sammccall

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoTest commit. NFC.
Sjoerd Meijer [Wed, 24 Jul 2019 13:30:36 +0000 (13:30 +0000)]
Test commit. NFC.

Removed 2 trailing whitespaces in 2 files that used to be in different
repos to test my new github monorepo workflow.

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

5 years ago[CrossTU] Add a function to retrieve original source location.
Balazs Keri [Wed, 24 Jul 2019 10:16:37 +0000 (10:16 +0000)]
[CrossTU] Add a function to retrieve original source location.

Summary:
A new function will be added to get the original SourceLocation
for a SourceLocation that was imported as result of getCrossTUDefinition.
The returned SourceLocation is in the context of the (original)
SourceManager for the original source file. Additionally the
ASTUnit object for that source file is returned. This is needed
to get a SourceManager to operate on with the returned source location.

The new function works if multiple different source files are loaded
with the same CrossTU context.

Reviewers: martong, shafik

Reviewed By: martong

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

Tags: #clang

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

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

5 years ago[Format] getFormattingLangOpts: make LS_Auto uses LS_Cpp11 lexing rule
Fangrui Song [Wed, 24 Jul 2019 09:50:56 +0000 (09:50 +0000)]
[Format] getFormattingLangOpts: make LS_Auto uses LS_Cpp11 lexing rule

Suggested by sammccall in post-commit review of D65183

Reviewed By: sammccall

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

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

5 years ago[SVE][Inline-Asm] Add support to specify SVE registers in the clobber list
Sander de Smalen [Wed, 24 Jul 2019 08:42:34 +0000 (08:42 +0000)]
[SVE][Inline-Asm] Add support to specify SVE registers in the clobber list

Adds the SVE vector and predicate registers to the list of known registers.

Patch by Kerry McLaughlin.

Reviewers: erichkeane, sdesmalen, rengolin

Reviewed By: sdesmalen

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

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

5 years ago[Format] Make it easy to add new format::FormatStyle::LanguageStandard. NFCI
Fangrui Song [Wed, 24 Jul 2019 08:04:29 +0000 (08:04 +0000)]
[Format] Make it easy to add new format::FormatStyle::LanguageStandard. NFCI

Preparatory change for D65043.

We current use `!=LS_Cpp03` to enable language standards 11,14,17, and
2a. `>=LS_Cpp11` is better if we decide to add new LanguageStandard in
the future.

Reviewed By: sammccall

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

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

5 years agoclang-format: Fix namespace end comments for namespaces with attributes and macros.
Nico Weber [Tue, 23 Jul 2019 17:49:45 +0000 (17:49 +0000)]
clang-format: Fix namespace end comments for namespaces with attributes and macros.

Fixes PR39247.

While here, also make C++20 `namespace A::inline B::inline C` nested
inline namespaced definitions work.

Before:
    #define DEPRECATE_WOOF [[deprecated("meow")]]

    namespace DEPRECATE_WOOF woof {
    void f() {}
    } // namespace DEPRECATE_WOOFwoof

    namespace [[deprecated("meow")]] woof {
      void f() {}
    } // namespace [[deprecated("meow")]]woof

    namespace woof::inline bark {
      void f() {}
    } // namespace woof::inlinebark

Now:
    #define DEPRECATE_WOOF [[deprecated("meow")]]

    namespace DEPRECATE_WOOF woof {
    void f() {}
    } // namespace woof

    namespace [[deprecated("meow")]] woof {
    void f() {}
    } // namespace woof

    namespace woof::inline bark {
    void f() {}
    } // namespace woof::inline bark

(In addition to the fixed namespace end comments, also note the correct
indent of the namespace contents.)

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

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

5 years agoImprove clang-format-diff help output
Nico Weber [Tue, 23 Jul 2019 17:34:18 +0000 (17:34 +0000)]
Improve clang-format-diff help output

The description in clang-format-diff.py is more useful than the one
in `clang-format-diff -h`, so use the same description in both places.

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

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

5 years ago[clang][NFCI] Fix random typos
Jan Korous [Tue, 23 Jul 2019 16:54:11 +0000 (16:54 +0000)]
[clang][NFCI] Fix random typos

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

5 years ago[clang, test] Fix Clang :: Headers/max_align.c on 64-bit SPARC
Rainer Orth [Tue, 23 Jul 2019 16:24:00 +0000 (16:24 +0000)]
[clang, test] Fix Clang :: Headers/max_align.c on 64-bit SPARC

Clang :: Headers/max_align.c currently FAILs on 64-bit SPARC:

  error: 'error' diagnostics seen but not expected:
    File /vol/llvm/src/clang/dist/test/Headers/max_align.c Line 12: static_assert failed due to requirement '8 == _Alignof(max_align_t)' ""
  1 error generated.

This happens because SuitableAlign isn't defined for SPARCv9 unlike SPARCv8
(which uses the default of 64 bits).  gcc's sparc/sparc.h has

  #define BIGGEST_ALIGNMENT (TARGET_ARCH64 ? 128 : 64)

This patch sets SuitableAlign to match and updates the corresponding testcase.

Tested on sparcv9-sun-solaris2.11.

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

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

5 years ago[ASTImporter] Fix inequivalence of ClassTemplateInstantiations
Gabor Marton [Tue, 23 Jul 2019 15:46:38 +0000 (15:46 +0000)]
[ASTImporter] Fix inequivalence of ClassTemplateInstantiations

Summary:
We falsely state inequivalence if the template parameter is a
qualified/nonquialified template in the first/second instantiation.
Also, different kinds of TemplateName should be equal if the template
decl (if available) is equal (even if the name kind is different).

Reviewers: a_sidorin, a.sidorin

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

Tags: #clang

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

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

5 years agoPlistDiagnostics Fix for compile warning (NFC).
Balazs Keri [Tue, 23 Jul 2019 10:21:42 +0000 (10:21 +0000)]
PlistDiagnostics Fix for compile warning (NFC).

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

5 years ago[CrossTU] Added CTU argument to diagnostic consumer create fn.
Balazs Keri [Tue, 23 Jul 2019 07:04:20 +0000 (07:04 +0000)]
[CrossTU] Added CTU argument to diagnostic consumer create fn.

Summary:
The PListDiagnosticConsumer needs a new CTU parameter that is passed
through the create functions.

Reviewers: NoQ, Szelethus, xazax.hun, martong

Reviewed By: Szelethus

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

Tags: #clang

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

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

5 years ago[NFC][clang] Refactor getCompilationPhases()+Types.def step 1.
Puyan Lotfi [Mon, 22 Jul 2019 23:10:10 +0000 (23:10 +0000)]
[NFC][clang] Refactor getCompilationPhases()+Types.def step 1.

Moves list of phases into Types.def table: Currently Types.def contains a
table of strings that are used to assemble a list of compilation phases to be
setup in the clang driver's jobs pipeline. This change makes it so that the table
itself contains the list of phases. A subsequent patch will remove the strings.

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

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

5 years ago[Driver] Set the default win32-macho debug format to DWARF
Vedant Kumar [Mon, 22 Jul 2019 21:46:45 +0000 (21:46 +0000)]
[Driver] Set the default win32-macho debug format to DWARF

rdar://53267670

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

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

5 years agoAdds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and...
Ben Hamilton [Mon, 22 Jul 2019 18:20:01 +0000 (18:20 +0000)]
Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.

Summary:
Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5.

Before:

```
typedef NS_CLOSED_ENUM(NSInteger, Foo){FooValueOne = 1, FooValueTwo,
                                       FooValueThree};
```

After:

```
typedef NS_CLOSED_ENUM(NSInteger, Foo) {
  FooValueOne = 1,
  FooValueTwo,
  FooValueThree
};
```

Contributed by heijink.

Reviewers: benhamilton, krasimir

Reviewed By: benhamilton

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP][MSVC]Enable /openmp[:experimental] to compile OpenMP.
Alexey Bataev [Mon, 22 Jul 2019 16:49:59 +0000 (16:49 +0000)]
[OPENMP][MSVC]Enable /openmp[:experimental] to compile OpenMP.

Mapped /openmp[:experimental] to -fopenmp option and /openmp- option to
-fno-openmp

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

5 years ago[X86] Remove const from some intrinsics that shouldn't have them
Paul Robinson [Mon, 22 Jul 2019 16:14:09 +0000 (16:14 +0000)]
[X86] Remove const from some intrinsics that shouldn't have them

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

5 years ago[clangd] Add dlog()s for SelectionTree, enabling -debug-only=SelectionTree.cpp
Sam McCall [Mon, 22 Jul 2019 15:55:53 +0000 (15:55 +0000)]
[clangd] Add dlog()s for SelectionTree, enabling -debug-only=SelectionTree.cpp

Summary:
SelectionTree is a RecursiveASTVisitor which processes getSourceRange() for
every node. This is a lot of surface area with the AST, as getSourceRange()
is specialized for *many* node types.
And the resulting SelectionTree depends on the source ranges of many
visited nodes, and the order of traversal.

Put together, this means we really need a traversal log to debug when we
get an unexpected SelectionTree. I've built this ad-hoc a few times, now
it's time to check it in.

Example output:
```
D[14:07:44.184] Computing selection for </usr/local/google/home/sammccall/test.cc:1:7, col:8>
D[14:07:44.184]  push: VarDecl const auto x = 42
D[14:07:44.184]   claimRange: </usr/local/google/home/sammccall/test.cc:1:12, col:13>
D[14:07:44.184]   push: NestedNameSpecifierLoc (empty NestedNameSpecifierLoc)
D[14:07:44.184]   pop: NestedNameSpecifierLoc (empty NestedNameSpecifierLoc)
D[14:07:44.184]   push: QualifiedTypeLoc const auto
D[14:07:44.184]   pop: QualifiedTypeLoc const auto
D[14:07:44.184]    claimRange: </usr/local/google/home/sammccall/test.cc:1:7, col:11>
D[14:07:44.184]    hit selection: </usr/local/google/home/sammccall/test.cc:1:7, col:8>
D[14:07:44.184]   skip: IntegerLiteral 42
D[14:07:44.184]    skipped range = </usr/local/google/home/sammccall/test.cc:1:16>
D[14:07:44.184]  pop: VarDecl const auto x = 42
D[14:07:44.184]   claimRange: </usr/local/google/home/sammccall/test.cc:1:1, col:18>
D[14:07:44.184]  skip: VarDecl int y = 43
D[14:07:44.184]   skipped range = </usr/local/google/home/sammccall/test.cc:2:1, col:9>
D[14:07:44.184] Built selection tree
TranslationUnitDecl
  VarDecl const auto x = 42
     .QualifiedTypeLoc const auto

```

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] Relaxed regression tests for PR42665
Marco Antognini [Mon, 22 Jul 2019 14:47:36 +0000 (14:47 +0000)]
[NFC] Relaxed regression tests for PR42665

Following up on the buildbot failures, this commits relaxes some tests:
instead of checking for specific IR output, it now ensures that the
underlying issue (the crash), and only that, doesn't happen.

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

5 years ago[OPENMP]Add support for analysis of firstprivate variables.
Alexey Bataev [Mon, 22 Jul 2019 13:51:07 +0000 (13:51 +0000)]
[OPENMP]Add support for analysis of firstprivate variables.

Summary:
Firstprivate variables are the variables, for which the private copies
must be created in the OpenMP regions and must be initialized with the
original values. Thus, we must report if the uninitialized variable is
used as firstprivate.

Reviewers: NoQ

Subscribers: guansong, jdoerfert, caomhin, kkwli0, cfe-commits

Tags: #clang

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

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

5 years agoUpdated the signature for some stack related intrinsics (CLANG)
Christudasan Devadasan [Mon, 22 Jul 2019 12:50:30 +0000 (12:50 +0000)]
Updated the signature for some stack related intrinsics (CLANG)

Modified the intrinsics
int_addressofreturnaddress,
int_frameaddress & int_sponentry.
This commit depends on the changes in rL366679

Reviewed By: arsenm

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

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

5 years agoRevert the change to the [[nodiscard]] feature test macro value.
Aaron Ballman [Mon, 22 Jul 2019 12:49:28 +0000 (12:49 +0000)]
Revert the change to the [[nodiscard]] feature test macro value.

This value only gets bumped once both P1301 and P1771 are implemented.

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

5 years ago[AST] Treat semantic form of InitListExpr as implicit code in traversals
Ilya Biryukov [Mon, 22 Jul 2019 09:58:53 +0000 (09:58 +0000)]
[AST] Treat semantic form of InitListExpr as implicit code in traversals

Summary:
In particular, do not traverse the semantic form if shouldVisitImplicitCode()
returns false.

This simplifies the common case of traversals, avoiding the need to
worry about some expressions being traversed twice.

No tests break after the change, the change would allow to simplify at
least one of the usages, i.e. r366070 which had to handle this in
clangd.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Improve destructor support in C++ for OpenCL
Marco Antognini [Mon, 22 Jul 2019 09:39:13 +0000 (09:39 +0000)]
[OpenCL] Improve destructor support in C++ for OpenCL

This re-applies r366422 with a fix for Bug PR42665 and a new regression
test.

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

5 years ago[analyzer] Fix -Wunused-function in NDEBUG builds with #ifdef LLVM_DUMP_METHOD
Fangrui Song [Mon, 22 Jul 2019 04:14:09 +0000 (04:14 +0000)]
[analyzer] Fix -Wunused-function in NDEBUG builds with #ifdef LLVM_DUMP_METHOD

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

5 years ago[Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'
Yuanfang Chen [Sat, 20 Jul 2019 22:50:50 +0000 (22:50 +0000)]
[Clang] Replace cc1 options '-mdisable-fp-elim' and '-momit-leaf-frame-pointer'
with '-mframe-pointer'

After D56351 and D64294, frame pointer handling is migrated to tri-state
(all, non-leaf, none) in clang driver and on the function attribute.
This patch makes the frame pointer handling cc1 option tri-state.

Reviewers: chandlerc, rnk, t.p.northover, MaskRay

Reviewed By: MaskRay

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

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

5 years agoFix cppcheck reduce scope variable warnings. NFCI
Simon Pilgrim [Sat, 20 Jul 2019 13:01:16 +0000 (13:01 +0000)]
Fix cppcheck reduce scope variable warnings. NFCI

Move a couple of variables inside the block where they are actually needed.

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

5 years ago[c++20] P1161R3: a[b,c] is deprecated.
Richard Smith [Sat, 20 Jul 2019 09:32:27 +0000 (09:32 +0000)]
[c++20] P1161R3: a[b,c] is deprecated.

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

5 years agoMark P1301R4 in C++2a as being SVN instead.
Aaron Ballman [Sat, 20 Jul 2019 08:57:08 +0000 (08:57 +0000)]
Mark P1301R4 in C++2a as being SVN instead.

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

5 years agoWe support P1301R4 in C++2a as of r366626.
Aaron Ballman [Sat, 20 Jul 2019 08:24:56 +0000 (08:24 +0000)]
We support P1301R4 in C++2a as of r366626.

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

5 years ago[cxx_status] Update status page for WG21 Cologne meeting motions.
Richard Smith [Sat, 20 Jul 2019 08:20:54 +0000 (08:20 +0000)]
[cxx_status] Update status page for WG21 Cologne meeting motions.

Note that many of the paper links will be dead until the post-meeting
mailing is released.

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

5 years agoImplement P1301R4, which allows specifying an optional message on the [[nodiscard...
Aaron Ballman [Sat, 20 Jul 2019 07:56:34 +0000 (07:56 +0000)]
Implement P1301R4, which allows specifying an optional message on the [[nodiscard]] attribute.

This also bumps the attribute feature test value and introduces the notion of a C++2a extension warning.

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

5 years ago[WebAssembly] Compute and export TLS block alignment
Guanzhong Chen [Fri, 19 Jul 2019 23:34:16 +0000 (23:34 +0000)]
[WebAssembly] Compute and export TLS block alignment

Summary:
Add immutable WASM global `__tls_align` which stores the alignment
requirements of the TLS segment.

Add `__builtin_wasm_tls_align()` intrinsic to get this alignment in Clang.

The expected usage has now changed to:

    __wasm_init_tls(memalign(__builtin_wasm_tls_align(),
                             __builtin_wasm_tls_size()));

Reviewers: tlively, aheejin, sbc100, sunfish, alexcrichton

Reviewed By: tlively

Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1
Teresa Johnson [Fri, 19 Jul 2019 23:02:58 +0000 (23:02 +0000)]
[LTO] Always mark regular LTO units with EnableSplitLTOUnit=1

Summary:
Regular LTO modules do not need LTO Unit splitting, only ThinLTO does
(they must be consistently split into regular and Thin units for
optimizations such as whole program devirtualization and lower type
tests). In order to avoid spurious errors from LTO when combining with
split ThinLTO modules, always set this flag for regular LTO modules.

Reviewers: pcc

Subscribers: mehdi_amini, Prazek, inglorion, steven_wu, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[NFC] Remove unused variable
Denis Bakhvalov [Fri, 19 Jul 2019 21:59:42 +0000 (21:59 +0000)]
[NFC] Remove unused variable

Change-Id: I5aee24dcdf6eebfbf788e52be22463387f23d927

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

5 years agoDisallow most calling convention attributes on PS4
Sunil Srivastava [Fri, 19 Jul 2019 21:38:34 +0000 (21:38 +0000)]
Disallow most calling convention attributes on PS4

PS4 now only allows "cdecl", and its equivalent on PS4, "sysv_abi".

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

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

5 years ago[Format/ObjC] Avoid breaking between unary operators and operands
Ben Hamilton [Fri, 19 Jul 2019 16:50:24 +0000 (16:50 +0000)]
[Format/ObjC] Avoid breaking between unary operators and operands

Summary:
Test Plan:
  New tests added. Ran tests with:
  % ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
  Confirmed tests failed before change and passed after change.

Reviewers: krasimir, djasper, sammccall, klimek

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Define CLK_NULL_EVENT without cast
Sven van Haastregt [Fri, 19 Jul 2019 09:11:48 +0000 (09:11 +0000)]
[OpenCL] Define CLK_NULL_EVENT without cast

Defining CLK_NULL_EVENT with a `(void*)` cast has the (unintended?)
side-effect that the address space will be fixed (as generic in OpenCL
2.0 mode).  The consequence is that any target specific address space
for the clk_event_t type will not be applied.

It is not clear why the void pointer cast was needed in the first
place, and it seems we can do without it.

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

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

5 years ago[sanitizers] Use covering ObjectFormatType switches
Hubert Tong [Fri, 19 Jul 2019 08:46:18 +0000 (08:46 +0000)]
[sanitizers] Use covering ObjectFormatType switches

Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
(`UnknownObjectFormat`, `Wasm`, and `XCOFF`) are then added.

For `UnknownObjectFormat`, the effect of the action for the `default`
case is maintained; otherwise, where `llvm_unreachable` is called,
`report_fatal_error` is used instead.

Where the `default` case returns a default value, `report_fatal_error`
is used for XCOFF as a placeholder. For `Wasm`, the effect of the action
for the `default` case in maintained.

The code is structured to avoid strongly implying that the `Wasm` case
is present for any reason other than to make the switch cover all
`ObjectFormatType` enumerator values.

Reviewers: sfertile, jasonliu, daltenty

Reviewed By: sfertile

Subscribers: hiraditya, aheejin, sunfish, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

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

5 years agoFix formatting of inline argument comments. NFC.
Sam Clegg [Fri, 19 Jul 2019 00:30:23 +0000 (00:30 +0000)]
Fix formatting of inline argument comments. NFC.

Also, remove the final arg from ItaniumCXXABI in the PNaCl case since
its not needed.

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

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

5 years agoUpdate the SimpleJIT class in the clang-interpreter example to use ORCv2.
Lang Hames [Thu, 18 Jul 2019 22:47:18 +0000 (22:47 +0000)]
Update the SimpleJIT class in the clang-interpreter example to use ORCv2.

This will remove the ORCv1 deprecation warnings.

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

5 years ago[clang-scan-deps] Dependency directives source minimizer: handle #pragma once
Alex Lorenz [Thu, 18 Jul 2019 22:33:14 +0000 (22:33 +0000)]
[clang-scan-deps] Dependency directives source minimizer: handle #pragma once

We should re-emit `#pragma once` to ensure the preprocessor will
still honor it when running on minimized sources.

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

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

5 years ago[WebAssembly] Fix __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 21:17:52 +0000 (21:17 +0000)]
[WebAssembly] Fix __builtin_wasm_tls_base intrinsic

Summary:
Properly generate the outchain for the `__builtin_wasm_tls_base` intrinsic.

Also marked the intrinsic pure, per @sunfish's suggestion.

Reviewers: tlively, aheejin, sbc100, sunfish

Reviewed By: tlively

Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits, sunfish

Tags: #clang, #llvm

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

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

5 years ago[OPENMP]Fix sharing of threadprivate variables with TLS support.
Alexey Bataev [Thu, 18 Jul 2019 19:40:24 +0000 (19:40 +0000)]
[OPENMP]Fix sharing of threadprivate variables with TLS support.

If the threadprivate variable is used in the copyin clause on inner
parallel directive with TLS support, we capture this variable in all
outer OpenMP scopes. It leads to the fact that in all scopes we're
working with the original variable, not the threadprivate copies.

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

5 years ago[RISCV] Hard float ABI support
Alex Bradbury [Thu, 18 Jul 2019 18:29:59 +0000 (18:29 +0000)]
[RISCV] Hard float ABI support

The RISC-V hard float calling convention requires the frontend to:

* Detect cases where, once "flattened", a struct can be passed using
int+fp or fp+fp registers under the hard float ABI and coerce to the
appropriate type(s)
* Track usage of GPRs and FPRs in order to gate the above, and to
determine when signext/zeroext attributes must be added to integer
scalars

This patch attempts to do this in compliance with the documented ABI,
and uses ABIArgInfo::CoerceAndExpand in order to do this. @rjmccall, as
author of that code I've tagged you as reviewer for initial feedback on
my usage.

Note that a previous version of the ABI indicated that when passing an
int+fp struct using a GPR+FPR, the int would need to be sign or
zero-extended appropriately. GCC never did this and the ABI was changed,
which makes life easier as ABIArgInfo::CoerceAndExpand can't currently
handle sign/zero-extension attributes.

Re-landed after backing out 366450 due to missed hunks.

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

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

5 years ago[WebAssembly] Implement __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 17:53:22 +0000 (17:53 +0000)]
[WebAssembly] Implement __builtin_wasm_tls_base intrinsic

Summary:
Add `__builtin_wasm_tls_base` so that LeakSanitizer can find the thread-local
block and scan through it for memory leaks.

Reviewers: tlively, aheejin, sbc100

Subscribers: dschuff, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[OPENMP]Provide correct data sharing attributes for loop control
Alexey Bataev [Thu, 18 Jul 2019 17:49:13 +0000 (17:49 +0000)]
[OPENMP]Provide correct data sharing attributes for loop control
variables.

Loop control variables are private in loop-based constructs and we shall
take this into account when generate the code for inner constructs.
Currently, those variables are reported as shared in many cases. Moved
the analysis of the data-sharing attributes of the loop control variable
to an early semantic stage to correctly handle their attributes.

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

5 years ago[LibTooling] Relax Transformer to allow rewriting macro expansions
Yitzhak Mandelbaum [Thu, 18 Jul 2019 17:44:54 +0000 (17:44 +0000)]
[LibTooling] Relax Transformer to allow rewriting macro expansions

Summary:
Currently, Transformer rejects any changes to source locations inside macro
expansions. This change relaxes that constraint to allow rewrites when the
entirety of the expansion is replaced, since that can be mapped to replacing the
entirety of the expansion range in the file source.  This change makes
Transformer consistent with the handling of edit ranges in `clang::edit::Commit`
(which is used, for example, for applying `FixItHint`s from diagnostics).

Reviewers: ilya-biryukov

Subscribers: gribozavr, cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Add function to translate and validate source range for editing
Yitzhak Mandelbaum [Thu, 18 Jul 2019 17:26:57 +0000 (17:26 +0000)]
[LibTooling] Add function to translate and validate source range for editing

Summary:
Adds the function `getRangeForEdit` to validate that a given source range is
editable and, if needed, translate it into a range in the source file (for
example, if it's sourced in macro expansions).

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[ASTUnit] Attempt to unbreak Windows buildbots after r366448
Ilya Biryukov [Thu, 18 Jul 2019 16:24:09 +0000 (16:24 +0000)]
[ASTUnit] Attempt to unbreak Windows buildbots after r366448

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

5 years agoRevert "[RISCV] Hard float ABI support" r366450
Alex Bradbury [Thu, 18 Jul 2019 16:13:17 +0000 (16:13 +0000)]
Revert "[RISCV] Hard float ABI support" r366450

The commit was missing a few hunks. Will fix and recommit.

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

5 years agoRevert r366449: [CrossTU] Add a function to retrieve original source location.
Ilya Biryukov [Thu, 18 Jul 2019 15:43:26 +0000 (15:43 +0000)]
Revert r366449: [CrossTU] Add a function to retrieve original source location.

Reason: the commit breaks layering by adding a dependency on ASTUnit
(which is inside clangFrontend) from the ASTImporter (which is inside
clangAST).

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

5 years ago[RISCV] Hard float ABI support
Alex Bradbury [Thu, 18 Jul 2019 15:33:41 +0000 (15:33 +0000)]
[RISCV] Hard float ABI support

The RISC-V hard float calling convention requires the frontend to:

* Detect cases where, once "flattened", a struct can be passed using
int+fp or fp+fp registers under the hard float ABI and coerce to the
appropriate type(s) * Track usage of GPRs and FPRs in order to gate the
above, and to
determine when signext/zeroext attributes must be added to integer
scalars

This patch attempts to do this in compliance with the documented ABI,
and uses ABIArgInfo::CoerceAndExpand in order to do this. @rjmccall, as
author of that code I've tagged you as reviewer for initial feedback on
my usage.

Note that a previous version of the ABI indicated that when passing an
int+fp struct using a GPR+FPR, the int would need to be sign or
zero-extended appropriately. GCC never did this and the ABI was changed,
which makes life easier as ABIArgInfo::CoerceAndExpand can't currently
handle sign/zero-extension attributes.

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

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

5 years ago[CrossTU] Add a function to retrieve original source location.
Balazs Keri [Thu, 18 Jul 2019 15:23:10 +0000 (15:23 +0000)]
[CrossTU] Add a function to retrieve original source location.

Summary:
A new function will be added to get the original SourceLocation
for a SourceLocation that was imported as result of getCrossTUDefinition.
The returned SourceLocation is in the context of the (original)
SourceManager for the original source file. Additionally the
ASTUnit object for that source file is returned. This is needed
to get a SourceManager to operate on with the returned source location.

The new function works if multiple different source files are loaded
with the same CrossTU context.

This patch can be treated as part of a bigger change that is needed to
improve macro expansion handliong at plist generation.

Reviewers: martong, shafik, a_sidorin, xazax.hun

Reviewed By: martong

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

Tags: #clang

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

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

5 years ago[ASTUnit] Fix a regression in cached completions
Ilya Biryukov [Thu, 18 Jul 2019 15:21:34 +0000 (15:21 +0000)]
[ASTUnit] Fix a regression in cached completions

Summary:
After r345152 cached completions started adding namespaces after
nested name specifiers, e.g. in `some_name::^`

The CCC_Symbol indicates the completed item cannot be a namespace (it is
described as being "a type, a function or a variable" in the comments).

Therefore, 'nested specifier' completions should only be added from cache
when the context is CCC_SymbolOrNewName (which roughly seems to indicate
that a nested name specifier is allowed).

Fixes https://bugs.llvm.org/show_bug.cgi?id=42646

Reviewers: kadircet, sammccall

Reviewed By: kadircet, sammccall

Subscribers: arphaman, nik, sammccall, cfe-commits

Tags: #clang

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

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

5 years ago[CMake] Don't set Python_ADDITIONAL_VERSIONS
Jonas Devlieghere [Thu, 18 Jul 2019 15:17:42 +0000 (15:17 +0000)]
[CMake] Don't set Python_ADDITIONAL_VERSIONS

Until recently, Python_ADDITIONAL_VERSIONS was used to limit LLVM's
Python support to 2.7. Now that both LLVM and LLDB both support Python
3, there's no longer a need to put an arbitrary limit on this.

However, instead of removing the variable, r365692 expanded the list,
which has the (presumably unintentional) side-effect of expression
preference for Python 3.

Instead, as Michal proposed in the original code review, we should just
not set the list at all, and let CMake pick whatever Python interpreter
you have in your path.

This patch removes the Python_ADDITIONAL_VERSIONS variable in llvm,
clang and lld. I've also updated the docs with the default behavior and
how to force a different Python version to be used.

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

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

5 years ago[analyzer] Add CTU user docs
Gabor Marton [Thu, 18 Jul 2019 14:03:25 +0000 (14:03 +0000)]
[analyzer] Add CTU user docs

Reviewers: dkrupp, a_sidorin, Szelethus, NoQ

Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, gamesh411, Charusso, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP][NVPTX]Mark barrier functions calls as convergent.
Alexey Bataev [Thu, 18 Jul 2019 13:49:24 +0000 (13:49 +0000)]
[OPENMP][NVPTX]Mark barrier functions calls as convergent.

Added convergent attribute to the barrier functions calls for correct
optimizations.

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

5 years agoRevert r366422: [OpenCL] Improve destructor support in C++ for OpenCL
Ilya Biryukov [Thu, 18 Jul 2019 11:55:33 +0000 (11:55 +0000)]
Revert r366422: [OpenCL] Improve destructor support in C++ for OpenCL

Reason: this commit causes crashes in the clang compiler when building
LLVM Support with libc++, see https://bugs.llvm.org/show_bug.cgi?id=42665
for details.

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

5 years agoBump the trunk version to 10.0.0svn
Hans Wennborg [Thu, 18 Jul 2019 11:51:05 +0000 (11:51 +0000)]
Bump the trunk version to 10.0.0svn

and clear the release notes.

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

5 years ago[OpenCL] Improve destructor support in C++ for OpenCL
Marco Antognini [Thu, 18 Jul 2019 10:04:18 +0000 (10:04 +0000)]
[OpenCL] Improve destructor support in C++ for OpenCL

Summary:
This patch does mainly three things:
 1. It fixes a false positive error detection in Sema that is similar to
    D62156. The error happens when explicitly calling an overloaded
    destructor for different address spaces.
 2. It selects the correct destructor when multiple overloads for
    address spaces are available.
 3. It inserts the expected address space cast when invoking a
    destructor, if needed, and therefore fixes a crash due to the unmet
    assertion in llvm::CastInst::Create.

The following is a reproducer of the three issues:

    struct MyType {
      ~MyType() {}
      ~MyType() __constant {}
    };

    __constant MyType myGlobal{};

    kernel void foo() {
      myGlobal.~MyType(); // 1 and 2.
      // 1. error: cannot initialize object parameter of type
      //    '__generic MyType' with an expression of type '__constant MyType'
      // 2. error: no matching member function for call to '~MyType'
    }

    kernel void bar() {
      // 3. The implicit call to the destructor crashes due to:
      //    Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
      //    in llvm::CastInst::Create.
      MyType myLocal;
    }

The added test depends on D62413 and covers a few more things than the
above reproducer.

Subscribers: yaxunl, Anastasia, cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Update comments/diagnostics to refer to C++ for OpenCL
Anastasia Stulova [Thu, 18 Jul 2019 10:02:35 +0000 (10:02 +0000)]
[OpenCL] Update comments/diagnostics to refer to C++ for OpenCL

Clang doesn't implement OpenCL C++, change the comments to
reflect that.

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

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

5 years ago[OpenCL][PR42033] Fix addr space deduction with template parameters
Anastasia Stulova [Thu, 18 Jul 2019 09:12:49 +0000 (09:12 +0000)]
[OpenCL][PR42033] Fix addr space deduction with template parameters

If dependent types appear in pointers or references we allow addr
space deduction because the addr space in template argument will
belong to the pointee and not the pointer or reference itself.

We also don't diagnose addr space on a function return type after
template instantiation. If any addr space for the return type was
provided on a template parameter this will be diagnosed during the
parsing of template definition.

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

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

5 years ago[CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken in r342528
Sam McCall [Thu, 18 Jul 2019 07:17:49 +0000 (07:17 +0000)]
[CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken in r342528

Summary:
The problem is the default LoadExternal with no completer, which happens when
loading global results.

Reviewers: ilya-biryukov, nik

Subscribers: arphaman, llvm-commits

Tags: #llvm

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

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

5 years ago[PowerPC][Clang] Remove use of malloc in mm_malloc
Qiu Chaofan [Thu, 18 Jul 2019 06:20:12 +0000 (06:20 +0000)]
[PowerPC][Clang] Remove use of malloc in mm_malloc

Remove dependency of malloc in implementation of mm_malloc function in PowerPC
intrinsics and alignment assumption on glibc.

Reviewed By: Hal Finkel

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

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

5 years ago[analyzer] MallocChecker: Prevent Integer Set Library false positives
Csaba Dabis [Thu, 18 Jul 2019 00:03:55 +0000 (00:03 +0000)]
[analyzer] MallocChecker: Prevent Integer Set Library false positives

Summary:
Integer Set Library using retain-count based allocation which is not
modeled in MallocChecker.

Reviewed By: NoQ

Tags: #clang

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

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

5 years agohwasan: Initialize the pass only once.
Peter Collingbourne [Wed, 17 Jul 2019 21:45:19 +0000 (21:45 +0000)]
hwasan: Initialize the pass only once.

This will let us instrument globals during initialization. This required
making the new PM pass a module pass, which should still provide access to
analyses via the ModuleAnalysisManager.

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

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

5 years agoRenamed and changed the wording of warn_cconv_ignored
Sunil Srivastava [Wed, 17 Jul 2019 20:41:26 +0000 (20:41 +0000)]
Renamed and changed the wording of warn_cconv_ignored

As discussed in D64780 the wording of this warning message is being
changed to say 'is not supported' instead of 'ignored', and the
diag ID itself is being changed to warn_cconv_not_supported.

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

5 years ago[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.
Alexey Bataev [Wed, 17 Jul 2019 18:03:39 +0000 (18:03 +0000)]
[OPENMP]Fix PR42632: crash on the analysis of the OpenMP constructs.

Fixed processing of the CapturedStmt children to fix the crash of the
OpenMP constructs during analysis.

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

5 years agoRevert [AArch64] Add support for Transactional Memory Extension (TME)
Momchil Velikov [Wed, 17 Jul 2019 17:43:32 +0000 (17:43 +0000)]
Revert [AArch64] Add support for Transactional Memory Extension (TME)

This reverts r366322 (git commit 4b8da3a503e434ddbc08ecf66582475765f449bc)

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

5 years ago[Docs][OpenCL] Documentation of C++ for OpenCL mode
Anastasia Stulova [Wed, 17 Jul 2019 17:21:31 +0000 (17:21 +0000)]
[Docs][OpenCL] Documentation of C++ for OpenCL mode

Added documentation of C++ for OpenCL mode into Clang
User Manual and Language Extensions document.

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

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

5 years ago[OPENMP]Fix crash in LoopCounterRefChecker when MemberExpr is not Var or Field
Mike Rice [Wed, 17 Jul 2019 15:18:45 +0000 (15:18 +0000)]
[OPENMP]Fix crash in LoopCounterRefChecker when MemberExpr is not Var or Field

checkDecl is only valid for VarDecls or FieldDecls, since getCanonicalDecl
expects only these. Prevent other Decl kinds (such as CXXMethodDecls and
EnumConstantDecls) from entering and asserting.

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

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

5 years ago[ASTImporter] Fix structural eq of lambdas
Gabor Marton [Wed, 17 Jul 2019 14:40:09 +0000 (14:40 +0000)]
[ASTImporter] Fix structural eq of lambdas

Summary:
The structural equivalence check reported false eq between lambda classes
with different parameters in their call signature.
The solution is to check the methods for equality too in case of lambda
classes.

Reviewers: a_sidorin, a.sidorin

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

Tags: #clang

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

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

5 years ago[ASTImporter] Fix LLDB lookup in transparent ctx and with ext src
Gabor Marton [Wed, 17 Jul 2019 13:47:46 +0000 (13:47 +0000)]
[ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

Summary:
With LLDB we use localUncachedLookup(), however, that fails to find
Decls when a transparent context is involved and the given DC has
external lexical storage.  The solution is to use noload_lookup, which
works well with transparent contexts.  But, we cannot use only the
noload_lookup since the slow case of localUncachedLookup is still needed
in some other cases.

These other cases are handled in ASTImporterLookupTable, but we cannot
use that with LLDB since that traverses through the AST which initiates
the load of external decls again via DC::decls().

We must avoid loading external decls during the import becuase
ExternalASTSource is implemented with ASTImporter, so external loads
during import results in uncontrolled and faulty import.

Reviewers: shafik, teemperor, jingham, clayborg, a_sidorin, a.sidorin

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

Tags: #clang, #lldb

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

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