]> granicus.if.org Git - clang/log
clang
5 years ago[NFC] Remove unneeded local variables
Vitaly Buka [Thu, 27 Jun 2019 01:34:21 +0000 (01:34 +0000)]
[NFC] Remove unneeded local variables

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

5 years ago[ObjC] Improve error message for a malformed objc-type-name
Erik Pilkington [Wed, 26 Jun 2019 23:39:23 +0000 (23:39 +0000)]
[ObjC] Improve error message for a malformed objc-type-name

If the type didn't exist, we used to emit a really bad error:

t.m:3:12: error: expected ')'
-(nullable NoSuchType)foo3;
           ^

rdar://50925632

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

5 years agoFix formatting after r364479
Aaron Puchert [Wed, 26 Jun 2019 21:39:19 +0000 (21:39 +0000)]
Fix formatting after r364479

The reflowing obscurs the functional changes, so here is a separate
commit.

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

5 years ago[Clang] Remove unused -split-dwarf and obsolete -enable-split-dwarf
Aaron Puchert [Wed, 26 Jun 2019 21:36:35 +0000 (21:36 +0000)]
[Clang] Remove unused -split-dwarf and obsolete -enable-split-dwarf

Summary:
The changes in D59673 made the choice redundant, since we can achieve
single-file split DWARF just by not setting an output file name.
Like llc we can also derive whether to enable Split DWARF from whether
-split-dwarf-file is set, so we don't need the flag at all anymore.

The test CodeGen/split-debug-filename.c distinguished between having set
or not set -enable-split-dwarf with -split-dwarf-file, but we can
probably just always emit the metadata into the IR.

The flag -split-dwarf wasn't used at all anymore.

Reviewers: dblaikie, echristo

Reviewed By: dblaikie

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

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

5 years agoRevert r363191 "[MS] Pretend constexpr variable template specializations are inline"
Reid Kleckner [Wed, 26 Jun 2019 21:16:51 +0000 (21:16 +0000)]
Revert r363191 "[MS] Pretend constexpr variable template specializations are inline"

The next Visual Studio update will fix this issue, and it doesn't make
sense to implement this non-conforming behavior going forward.

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

5 years ago[clang-scan-deps] Introduce the DependencyScanning library with the
Alex Lorenz [Wed, 26 Jun 2019 21:11:51 +0000 (21:11 +0000)]
[clang-scan-deps] Introduce the DependencyScanning library with the
thread worker code and better error handling

This commit extracts out the code that will powers the fast scanning
worker into a new file in a new DependencyScanning library. The error
and output handling is improved so that the clients can gather
errors/results from the worker directly.

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

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

5 years ago[WebAssembly] Implement Address Sanitizer for Emscripten
Guanzhong Chen [Wed, 26 Jun 2019 20:16:14 +0000 (20:16 +0000)]
[WebAssembly] Implement Address Sanitizer for Emscripten

Summary:
This diff enables address sanitizer on Emscripten.

On Emscripten, real memory starts at the value passed to --global-base.

All memory before this is used as shadow memory, and thus the shadow mapping
function is simply dividing by 8.

Reviewers: tlively, aheejin, sbc100

Reviewed By: sbc100

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

Tags: #clang, #llvm

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

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

5 years agoBitStream reader: propagate errors
JF Bastien [Wed, 26 Jun 2019 19:50:12 +0000 (19:50 +0000)]
BitStream reader: propagate errors

The bitstream reader handles errors poorly. This has two effects:

 * Bugs in file handling (especially modules) manifest as an "unexpected end of
   file" crash
 * Users of clang as a library end up aborting because the code unconditionally
   calls `report_fatal_error`

The bitstream reader should be more resilient and return Expected / Error as
soon as an error is encountered, not way late like it does now. This patch
starts doing so and adopting the error handling where I think it makes sense.
There's plenty more to do: this patch propagates errors to be minimally useful,
and follow-ups will propagate them further and improve diagnostics.

https://bugs.llvm.org/show_bug.cgi?id=42311
<rdar://problem/33159405>

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

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

5 years agoPrint NULL as "(null)" in diagnostic message
Xing Xue [Wed, 26 Jun 2019 19:27:16 +0000 (19:27 +0000)]
Print NULL as "(null)" in diagnostic message

Summary:
Passing a null pointer to the printf family for a %s format specifier leads to undefined behaviour. The tests currently expect (null). Explicitly test for a null pointer and provide the expected string.

Authored By: andusy

Reviewers: hubert.reinterpretcast, xingxue, jasonliu, daltenty, cebowleratibm

Reviewed By: hubert.reinterpretcast

Subscribers: arphaman, jsji, cfe-commits

Tags: #llvm

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

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

5 years agoMake AddLastArg() variadic and use it more. No behavior change.
Nico Weber [Wed, 26 Jun 2019 17:51:47 +0000 (17:51 +0000)]
Make AddLastArg() variadic and use it more. No behavior change.

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

5 years agoMake CodeGen depend on ASTMatchers
Michael Liao [Wed, 26 Jun 2019 14:13:43 +0000 (14:13 +0000)]
Make CodeGen depend on ASTMatchers

- Shared library builds are broken due to the missing dependency.

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

5 years ago[clang/DIVar] Emit the flag for params that have unmodified value
Djordje Todorovic [Wed, 26 Jun 2019 13:32:02 +0000 (13:32 +0000)]
[clang/DIVar] Emit the flag for params that have unmodified value

Emit the debug info flag that indicates that a parameter has unchanged
value throughout a function.

([5/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D58035

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

5 years ago[OpenCL] Improve diagnostic for placement new
Sven van Haastregt [Wed, 26 Jun 2019 13:31:24 +0000 (13:31 +0000)]
[OpenCL] Improve diagnostic for placement new

Without an explicit declaration for placement new, clang would reject
uses of placement new with "'default new' is not supported in OpenCL
C++".  This may mislead users into thinking that placement new is not
supported, see e.g. PR42060.

Clarify that placement new requires an explicit declaration.

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

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

5 years ago[clang] Fix test failures after the rL364399
Djordje Todorovic [Wed, 26 Jun 2019 10:23:25 +0000 (10:23 +0000)]
[clang] Fix test failures after the rL364399

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

5 years ago[CC1Option] Add the option to enable the debug entry values
Djordje Todorovic [Wed, 26 Jun 2019 09:38:09 +0000 (09:38 +0000)]
[CC1Option] Add the option to enable the debug entry values

The option enables debug info about parameter's entry values.

The example of using the option:

clang -g -O2 -Xclang -femit-debug-entry-values test.c

In addition, when the option is set add the flag all_call_sites
in a subprogram in order to support GNU extension as well.

([3/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D58033

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

5 years ago[clang][Tooling] Fix windows build-bots after rL364386
Kadir Cetinkaya [Wed, 26 Jun 2019 08:39:42 +0000 (08:39 +0000)]
[clang][Tooling] Fix windows build-bots after rL364386

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

5 years ago[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase
Kadir Cetinkaya [Wed, 26 Jun 2019 07:39:03 +0000 (07:39 +0000)]
[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase

Summary:
Wraps JSON compilation database with a target and mode adding database
wrapper. So that driver can correctly figure out which toolchain to use.

Note that clients that wants to make use of this target discovery mechanism
needs to link in TargetsInfos and initialize them at startup.

Reviewers: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[HIP] Support attribute hip_pinned_shadow
Yaxun Liu [Wed, 26 Jun 2019 03:47:37 +0000 (03:47 +0000)]
[HIP] Support attribute hip_pinned_shadow

This patch introduces support of hip_pinned_shadow variable for HIP.

A hip_pinned_shadow variable is a global variable with attribute hip_pinned_shadow.
It has external linkage on device side and has no initializer. It has internal
linkage on host side and has initializer or static constructor. It can be accessed
in both device code and host code.

This allows HIP runtime to implement support of HIP texture reference.

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

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

5 years agoFix build failure due to missing break
Yaxun Liu [Wed, 26 Jun 2019 03:33:03 +0000 (03:33 +0000)]
Fix build failure due to missing break

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

5 years ago[analyzer] exploded-graph-rewriter: Prettier location context dumps.
Artem Dergachev [Wed, 26 Jun 2019 00:14:49 +0000 (00:14 +0000)]
[analyzer] exploded-graph-rewriter: Prettier location context dumps.

Make them span wider.

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

5 years agoprint-supported-cpus quality of life patch.
Ziang Wan [Tue, 25 Jun 2019 23:57:14 +0000 (23:57 +0000)]
print-supported-cpus quality of life patch.

Claim all input files so that clang does not give a warning. Add two
short-cut aliases: -mcpu=? and -mtune=?.

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

5 years agoRevert Devirtualize destructor of final class.
Rumeet Dhindsa [Tue, 25 Jun 2019 22:58:25 +0000 (22:58 +0000)]
Revert Devirtualize destructor of final class.

This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)

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

5 years agoandroid: enable double-word CAS on x64
Saleem Abdulrasool [Tue, 25 Jun 2019 21:43:34 +0000 (21:43 +0000)]
android: enable double-word CAS on x64

The android target assumes that for the x86_64 target, the CPU supports SSE4.2
and popcnt. This implies that the CPU is Nehalem or newer. This should be
sufficiently new to provide the double word compare and exchange instruction.
This allows us to directly lower `__sync_val_compare_and_swap_16` to a `cmpxchg16b`.
It appears that the libatomic in android's NDK does not provide the
implementation for lowering calls to the library function.

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

5 years agoRemove redundant expression evaluation context when substituting into a
Richard Smith [Tue, 25 Jun 2019 20:40:27 +0000 (20:40 +0000)]
Remove redundant expression evaluation context when substituting into a
template argument.

We do need one of these but we don't need two.

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

5 years agoAdd regression test for PR41576 (which is already fixed in trunk,
Richard Smith [Tue, 25 Jun 2019 18:42:53 +0000 (18:42 +0000)]
Add regression test for PR41576 (which is already fixed in trunk,
perhaps by r361300).

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

5 years ago[ARM] Support inline assembler constraints for MVE.
Simon Tatham [Tue, 25 Jun 2019 16:49:32 +0000 (16:49 +0000)]
[ARM] Support inline assembler constraints for MVE.

"To" selects an odd-numbered GPR, and "Te" an even one. There are some
8.1-M instructions that have one too few bits in their register fields
and require registers of particular parity, without necessarily using
a consecutive even/odd pair.

Also, the constraint letter "t" should select an MVE q-register, when
MVE is present. This didn't need any source changes, but some extra
tests have been added.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: javed.absar, eraman, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[OPENMP]Fix PR41966: type mismatch in runtime functions.
Alexey Bataev [Tue, 25 Jun 2019 16:00:43 +0000 (16:00 +0000)]
[OPENMP]Fix PR41966: type mismatch in runtime functions.

Target-based runtime functions use int64_t type for sizes, while the
compiler uses size_t type. It leads to miscompilation in 32 bit mode.

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

5 years ago[clangd] Narrow rename to local symbols.
Haojian Wu [Tue, 25 Jun 2019 08:43:17 +0000 (08:43 +0000)]
[clangd] Narrow rename to local symbols.

Summary:
Previously, we performed rename for all kinds of symbols (local, global).

This patch narrows the scope by only renaming symbols not being used
outside of the main file (with index asisitance). Renaming global
symbols is not supported at the moment (return an error).

Reviewers: sammccall

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

Tags: #clang

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

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

5 years ago[ASTImporter] Store import errors for Decls
Gabor Marton [Tue, 25 Jun 2019 08:00:51 +0000 (08:00 +0000)]
[ASTImporter] Store import errors for Decls

Summary:
We add a new member which is a mapping from the already-imported
declarations in the "from" context to the error status of the import of
that declaration.  This map contains only the declarations that were not
correctly imported. The same declaration may or may not be included in
ImportedDecls. This map is updated continuously during imports and never
cleared (like ImportedDecls).  In Import(Decl*) we use this mapping, so
if there was a previous failed import we return with the existing error.

We add/remove from the Lookuptable in consistency with ImportedFromDecls.
When we map a decl in the 'to' context to something in the 'from'
context then and only then we add it to the lookup table. When we
remove a mapping then and only then we remove it from the lookup table.

This patch is the first in a series of patches whose aim is to further
strengthen the error handling in ASTImporter.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Create pointers
Csaba Dabis [Tue, 25 Jun 2019 03:17:55 +0000 (03:17 +0000)]
[analyzer] print() JSONify: Create pointers

Summary: -

Reviewers: NoQ

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[analyzer] JsonSupport: Escape escapes
Csaba Dabis [Tue, 25 Jun 2019 03:08:32 +0000 (03:08 +0000)]
[analyzer] JsonSupport: Escape escapes

Summary: -

Reviewers: NoQ

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.
Artem Dergachev [Tue, 25 Jun 2019 02:16:56 +0000 (02:16 +0000)]
[analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.

'|' is a special character in graphviz, so it needs to be properly
escaped and unescaped.

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

5 years ago[analyzer] exploded-graph-rewriter: Add support for range constraints.
Artem Dergachev [Tue, 25 Jun 2019 02:16:53 +0000 (02:16 +0000)]
[analyzer] exploded-graph-rewriter: Add support for range constraints.

Diff support included.

A cheap solution is implemented that treats range constraints as
"some sort of key-value map", so it's going to be trivial
to add support for other such maps later, such as dynamic type info.

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

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

5 years ago[analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.
Artem Dergachev [Tue, 25 Jun 2019 02:16:50 +0000 (02:16 +0000)]
[analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.

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

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

5 years ago[analyzer] Add more timers for performance profiling.
Artem Dergachev [Tue, 25 Jun 2019 02:16:47 +0000 (02:16 +0000)]
[analyzer] Add more timers for performance profiling.

The -analyzer-stats flag now allows you to find out how much time was spent
on AST-based analysis and on path-sensitive analysis and, separately,
on bug visitors, as they're occasionally a performance problem on their own.

The total timer wasn't useful because there's anyway a total time printed out.
Remove it.

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

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

5 years ago[cxx2a] P1236R1: the validity of a left shift does not depend on the
Richard Smith [Tue, 25 Jun 2019 01:45:26 +0000 (01:45 +0000)]
[cxx2a] P1236R1: the validity of a left shift does not depend on the
value of the LHS operand.

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

5 years ago[analyzer] ExprEngine: Escape pointers in bitwise operations
Csaba Dabis [Tue, 25 Jun 2019 00:44:33 +0000 (00:44 +0000)]
[analyzer] ExprEngine: Escape pointers in bitwise operations

Summary:
After evaluation it would be an Unknown value and tracking would be lost.

Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp, cfe-commits

Tags: #clang

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

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

5 years agoAMDGPU: Fix missing declaration for mbcnt builtins
Matt Arsenault [Mon, 24 Jun 2019 23:34:06 +0000 (23:34 +0000)]
AMDGPU: Fix missing declaration for mbcnt builtins

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

5 years agoFix test cl-response-file.c to work on all platforms including Windows/Solaris.
Douglas Yung [Mon, 24 Jun 2019 22:26:08 +0000 (22:26 +0000)]
Fix test cl-response-file.c to work on all platforms including Windows/Solaris.

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

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

5 years ago[Syntax] Do not glue multiple empty PP expansions to a single mapping
Ilya Biryukov [Mon, 24 Jun 2019 21:39:51 +0000 (21:39 +0000)]
[Syntax] Do not glue multiple empty PP expansions to a single mapping

Summary:
This change makes sure we have a single mapping for each macro expansion,
even if the result of expansion was empty.

To achieve that, we take information from PPCallbacks::MacroExpands into
account. Previously we relied only on source locations of expanded tokens.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAugment location information when dumping the AST to JSON.
Aaron Ballman [Mon, 24 Jun 2019 20:07:11 +0000 (20:07 +0000)]
Augment location information when dumping the AST to JSON.

Rather than create JSON objects for source locations and ranges, we instead stream them out directly. This allows us to elide duplicate information (without JSON field reordering causing an issue) like file names and line numbers, similar to the text dump. This also adds token length information when dumping the source location.

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

5 years ago[clang][NewPM] Add RUNS for tests that produce slightly different IR under new PM
Leonard Chan [Mon, 24 Jun 2019 16:49:18 +0000 (16:49 +0000)]
[clang][NewPM] Add RUNS for tests that produce slightly different IR under new PM

For CodeGenOpenCL/convergent.cl, the new PM produced a slightly different for
loop, but this still checks for no loop unrolling as intended. This is
committed separately from D63174.

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

5 years ago[clang][NewPM] Remove exception handling before loading pgo sample profile data
Leonard Chan [Mon, 24 Jun 2019 16:44:27 +0000 (16:44 +0000)]
[clang][NewPM] Remove exception handling before loading pgo sample profile data

This patch ensures that SimplifyCFGPass comes before SampleProfileLoaderPass
on PGO runs in the new PM and fixes clang/test/CodeGen/pgo-sample.c.

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

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

5 years ago[analyzer] print() JSONify: ProgramPoint revision
Csaba Dabis [Mon, 24 Jun 2019 16:19:39 +0000 (16:19 +0000)]
[analyzer] print() JSONify: ProgramPoint revision

Summary: Now we also print out the filename with its path.

Reviewers: NoQ

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[analyzer] Fix JSON dumps for ExplodedNodes
Csaba Dabis [Mon, 24 Jun 2019 16:06:44 +0000 (16:06 +0000)]
[analyzer] Fix JSON dumps for ExplodedNodes

Summary:
- Now we could see the `has_report` property in `trim-egraph` mode.
- This patch also removes the trailing comma after each node.

Reviewers: NoQ

Reviewed By: NoQ

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

Tags: #clang

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

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

5 years ago[OPENMP]Relax the test checks to pacify 32bit buildbots, NFC.
Alexey Bataev [Mon, 24 Jun 2019 15:30:20 +0000 (15:30 +0000)]
[OPENMP]Relax the test checks to pacify 32bit buildbots, NFC.

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

5 years ago[CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential...
Konstantin Pyzhov [Mon, 24 Jun 2019 14:40:20 +0000 (14:40 +0000)]
[CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential Revision: https://reviews.llvm.org/D63277

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

5 years ago[OpenCL] Restore ATOMIC_VAR_INIT
Sven van Haastregt [Mon, 24 Jun 2019 10:06:40 +0000 (10:06 +0000)]
[OpenCL] Restore ATOMIC_VAR_INIT

We accidentally lost the ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT macros
in r363794.

Also put the `memory_order` typedef back inside a `>= CL2.0` guard.

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

5 years ago[OpenCL] Remove more duplicates from opencl-c.h
Sven van Haastregt [Mon, 24 Jun 2019 10:06:34 +0000 (10:06 +0000)]
[OpenCL] Remove more duplicates from opencl-c.h

Identified the duplicate declarations using

  sort lib/Headers/opencl-c.h | uniq -c | grep '      2'

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

5 years agoPR42362: Fix auto deduction of template parameter packs from
Richard Smith [Mon, 24 Jun 2019 05:53:11 +0000 (05:53 +0000)]
PR42362: Fix auto deduction of template parameter packs from
type-dependent argument packs.

We need to strip off the PackExpansionExpr to get the real (dependent)
type rather than an opaque DependentTy.

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

5 years agoFix test for 32-bit targets.
Richard Smith [Sun, 23 Jun 2019 17:42:18 +0000 (17:42 +0000)]
Fix test for 32-bit targets.

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

5 years agoRevert "builtins: relax __iso_volatile_{load,store}32"
Saleem Abdulrasool [Sun, 23 Jun 2019 02:53:03 +0000 (02:53 +0000)]
Revert "builtins: relax __iso_volatile_{load,store}32"

This reverts commit SVN r364137.  This seems to be cause problems with
casting in C.

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

5 years agoMSVC visualizers for type aliases
Mike Spertus [Sun, 23 Jun 2019 01:15:48 +0000 (01:15 +0000)]
MSVC visualizers for type aliases

For example, the following TypeAliasTemplateDecl now displays in the autos window as
template<class T> using type_identity_t = type_identity<T>::type;

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

5 years agoFix TBAA representation for zero-sized fields and unnamed bit-fields.
Richard Smith [Sat, 22 Jun 2019 21:30:43 +0000 (21:30 +0000)]
Fix TBAA representation for zero-sized fields and unnamed bit-fields.

Unnamed bit-fields should not be represented in the TBAA metadata
because they do not represent storage fields (they only affect layout).

Zero-sized fields should not be represented in the TBAA metadata
because by definition they have no associated storage (so we will never
emit a load or store through them), and they might not appear in
declaration order within the struct layout.

Fixes a verifier failure when emitting a TBAA-enabled load through a
class type containing a zero-sized field.

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

5 years agoRemove reliance on toCharUnitsFromBits rounding down.
Richard Smith [Sat, 22 Jun 2019 20:41:57 +0000 (20:41 +0000)]
Remove reliance on toCharUnitsFromBits rounding down.

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

5 years agoNatural MSVC visualization of constructors
Mike Spertus [Sat, 22 Jun 2019 18:56:40 +0000 (18:56 +0000)]
Natural MSVC visualization of constructors

E.g., Allow MSVC to visualize a CXXConstructorDecl like
Constructor { Y(type_identity_t<T>)}

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

5 years agobuiltins: relax __iso_volatile_{load,store}32
Saleem Abdulrasool [Sat, 22 Jun 2019 18:55:51 +0000 (18:55 +0000)]
builtins: relax __iso_volatile_{load,store}32

This is reduced from MSVC's MSVCPRT 14.21.27702 atomic header.  Because
Windows is a LLP64 environment, `long`, `long int`, and `int` are all
synonymous.  Change the signature for `__iso_volatile_load32` and
`__iso_volatile_store32` to accept a `long int` instead.  This allows
an implicit cast of `int` to `long int` while also permitting `long`
to be accepted.

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

5 years ago[X86] Don't use _MM_FROUND_CUR_DIRECTION in the intrinsics tests.
Craig Topper [Sat, 22 Jun 2019 07:21:48 +0000 (07:21 +0000)]
[X86] Don't use _MM_FROUND_CUR_DIRECTION in the intrinsics tests.

_MM_FROUND_CUR_DIRECTION is the behavior of the intrinsics that
don't take a rounding mode argument. So a better test
is using _MM_FROUND_NO_EXC with the SAE only intrinsics and
an explicit rounding mode with the intrinsics that support
embedded rounding mode.

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

5 years agoAMDGPU: Fix target builtins for gfx10
Matt Arsenault [Sat, 22 Jun 2019 01:30:00 +0000 (01:30 +0000)]
AMDGPU: Fix target builtins for gfx10

This wasn't setting some of the features from older generations.

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

5 years ago[ODRHash] Skip some typedef types.
Richard Trieu [Sat, 22 Jun 2019 00:32:19 +0000 (00:32 +0000)]
[ODRHash] Skip some typedef types.

In some cases, a typedef only strips aways a keyword for a type, keeping the
same name as the root record type.  This causes some confusion when the type
is defined in one modules but only forward declared in another.  Skipping the
typedef and going straight to the record will avoid this issue.

typedef struct S {} S;
S* s;  // S is TypedefType here

struct S;
S* s;  // S is RecordType here

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

5 years agoRemove binary finally accidentially committed in r364109
Erich Keane [Fri, 21 Jun 2019 22:31:59 +0000 (22:31 +0000)]
Remove binary finally accidentially committed in r364109

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

5 years agoEnsure Target Features always_inline error happens in C++ cases.
Erich Keane [Fri, 21 Jun 2019 22:29:32 +0000 (22:29 +0000)]
Ensure Target Features always_inline error happens in C++ cases.

A handful of C++ cases as reported in PR42352 didn't actually give an
error when always_inlining with a different target feature list. This
resulted in broken IR.

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

5 years agoFix has_attribute.cpp test on Windows after r364102
Reid Kleckner [Fri, 21 Jun 2019 22:28:52 +0000 (22:28 +0000)]
Fix has_attribute.cpp test on Windows after r364102

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

5 years agoclang-format a block; NFC
George Burgess IV [Fri, 21 Jun 2019 20:49:47 +0000 (20:49 +0000)]
clang-format a block; NFC

The indentation of the return here was off, and confusing as a result.
Cleaned up a bit extra while I was in the area.

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

5 years agoPR42301: Abort cleanly if we encounter a huge source file rather than
Richard Smith [Fri, 21 Jun 2019 20:46:22 +0000 (20:46 +0000)]
PR42301: Abort cleanly if we encounter a huge source file rather than
crashing.

Ideally we wouldn't care about the size of a file so long as it fits in
memory, but in practice we have lots of hardocded assumptions that
unsigned can be used to index files, string literals, and so on.

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

5 years agoFix __has_cpp_attribute expansion to produce trailing L and (where
Richard Smith [Fri, 21 Jun 2019 20:20:21 +0000 (20:20 +0000)]
Fix __has_cpp_attribute expansion to produce trailing L and (where
necessary) leading whitespace.

Simplify unit test and extend to cover no_unique_address attribute.

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

5 years agoDevirtualize destructor of final class.
Hiroshi Yamauchi [Fri, 21 Jun 2019 20:04:29 +0000 (20:04 +0000)]
Devirtualize destructor of final class.

Summary:
Take advantage of the final keyword to devirtualize destructor calls.

Fix https://bugs.llvm.org/show_bug.cgi?id=21368

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: davidxl, Prazek, cfe-commits

Tags: #clang

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

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

5 years agoRevert [test][Driver] Fix Clang :: Driver/cl-response-file.c
Reid Kleckner [Fri, 21 Jun 2019 18:33:20 +0000 (18:33 +0000)]
Revert [test][Driver] Fix Clang :: Driver/cl-response-file.c

This reverts r363985 (git commit d5f16d6cfccc4b0b13b6c01d16c673886d53e695)

This test can't use printf on Windows because the path contains
backslashes which must not be interpreted as escapes by printf.

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

5 years ago[clang-scan-deps] print the dependencies to stdout
Alex Lorenz [Fri, 21 Jun 2019 18:24:55 +0000 (18:24 +0000)]
[clang-scan-deps] print the dependencies to stdout
and remove the need to use -MD options in the CDB

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

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

5 years agoFix ARM buildbot.
Richard Smith [Fri, 21 Jun 2019 17:41:20 +0000 (17:41 +0000)]
Fix ARM buildbot.

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

5 years ago[OPENMP]Fix PR42068: Vla type is not captured.
Alexey Bataev [Fri, 21 Jun 2019 17:28:41 +0000 (17:28 +0000)]
[OPENMP]Fix PR42068: Vla type is not captured.

If the variably modified type is declared outside of the captured region
and then used in the cast expression along with array subscript
expression, the type is not captured and it leads to the compiler crash.

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

5 years agoEnsure that top-level QualType objects also have a "kind" field when dumping the...
Aaron Ballman [Fri, 21 Jun 2019 17:14:25 +0000 (17:14 +0000)]
Ensure that top-level QualType objects also have a "kind" field when dumping the AST to JSON.

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

5 years ago[OpenCL][PR41963] Add generic addr space to old atomics in C++ mode
Anastasia Stulova [Fri, 21 Jun 2019 16:19:16 +0000 (16:19 +0000)]
[OpenCL][PR41963] Add generic addr space to old atomics in C++ mode

Add overloads with generic address space pointer to old atomics.
This is currently only added for C++ compilation mode.

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

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

5 years agoPrint more type node information when dumping the AST to JSON.
Aaron Ballman [Fri, 21 Jun 2019 16:06:09 +0000 (16:06 +0000)]
Print more type node information when dumping the AST to JSON.

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

5 years ago[clang][NewPM] Add -fno-experimental-new-pass-manager to tests
Leonard Chan [Fri, 21 Jun 2019 16:03:06 +0000 (16:03 +0000)]
[clang][NewPM] Add -fno-experimental-new-pass-manager to tests

As per the discussion on D58375, we disable test that have optimizations under
the new PM. This patch adds -fno-experimental-new-pass-manager to RUNS that:

- Already run with optimizations (-O1 or higher) that were missed in D58375.
- Explicitly test new PM behavior along side some new PM RUNS, but are missing
  this flag if new PM is enabled by default.
- Specify -O without the number. Based on getOptimizationLevel(), it seems the
  default is 2, and the IR appears to be the same when changed to -O2, so
  update the test to explicitly say -O2 and provide -fno-experimental-new-pass-manager`.

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

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

5 years ago[OPENMP]Fix PR42159: do not capture threadprivate variables.
Alexey Bataev [Fri, 21 Jun 2019 15:08:30 +0000 (15:08 +0000)]
[OPENMP]Fix PR42159: do not capture threadprivate variables.

The threadprivate variables should not be captured in the outlined
regions, otherwise it leads to the compiler crash.

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

5 years agoAdd an automated note to files produced by gen_ast_dump_json_test.py.
Aaron Ballman [Fri, 21 Jun 2019 14:37:39 +0000 (14:37 +0000)]
Add an automated note to files produced by gen_ast_dump_json_test.py.

This also details what filters, if any, were used to generate the test output. Updates all the current JSON testing files to include the automated note.

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

5 years agoPrint information about various type nodes when dumping the AST to JSON.
Aaron Ballman [Fri, 21 Jun 2019 13:22:35 +0000 (13:22 +0000)]
Print information about various type nodes when dumping the AST to JSON.

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

5 years agoFix test/AST/ast-dump-records-json.cpp after ConstantExpr change in D63376
Fangrui Song [Fri, 21 Jun 2019 11:39:41 +0000 (11:39 +0000)]
Fix test/AST/ast-dump-records-json.cpp after ConstantExpr change in D63376

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

5 years ago[Sema] Fix diagnostic for addr spaces in reference binding
Anastasia Stulova [Fri, 21 Jun 2019 11:36:15 +0000 (11:36 +0000)]
[Sema] Fix diagnostic for addr spaces in reference binding

Extend reference binding behavior to account for address spaces.

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

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

5 years ago[Sema] Improved diagnostic for qualifiers in reference binding
Anastasia Stulova [Fri, 21 Jun 2019 10:50:02 +0000 (10:50 +0000)]
[Sema] Improved diagnostic for qualifiers in reference binding

Improved wording and also simplified by using printing
method from qualifiers.

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

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

5 years ago[cmake] Add llvm-dwarfdump to clang test dependencies
Sven van Haastregt [Fri, 21 Jun 2019 10:26:20 +0000 (10:26 +0000)]
[cmake] Add llvm-dwarfdump to clang test dependencies

Commit r363496 ("[Clang] Harmonize Split DWARF options with llc",
2019-06-15) introduced the use of llvm-dwarfdump in the clang tests,
so ensure the clang tests are dependent on llvm-dwarfdump.

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

5 years ago[OpenCL] Remove duplicate read_image declarations
Sven van Haastregt [Fri, 21 Jun 2019 10:26:10 +0000 (10:26 +0000)]
[OpenCL] Remove duplicate read_image declarations

Patch by Pierre Gondois.

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

5 years ago[RISC-V] Add -msave-restore and -mno-save-restore to clang driver
Sam Elliott [Fri, 21 Jun 2019 10:03:31 +0000 (10:03 +0000)]
[RISC-V] Add -msave-restore and -mno-save-restore to clang driver

Summary:
The GCC RISC-V toolchain accepts `-msave-restore` and `-mno-save-restore`
to control whether libcalls are used for saving and restoring the stack within
prologues and epilogues.

Clang currently errors if someone passes -msave-restore or -mno-save-restore.
This means that people need to change build configurations to use clang. This
patch adds these flags, so that clang invocations can now match gcc.

As the RISC-V backend does not currently have a `save-restore` target feature,
we emit a warning if someone requests `-msave-restore`. LLVM does not error if
we pass the (unimplemented) target features `+save-restore` or `-save-restore`.

Reviewers: asb, luismarques

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, cfe-commits

Tags: #clang

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

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

5 years ago[git-clang-format] recognize hxx as a C++ file
Miklos Vajna [Fri, 21 Jun 2019 09:49:38 +0000 (09:49 +0000)]
[git-clang-format] recognize hxx as a C++ file

clangd, clang-tidy, etc does that already, no reason why
git-clang-format should skip hxx files.

Reviewed By: ilya-biryukov

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

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

5 years ago[clang] Small improvments after Adding APValue to ConstantExpr
Gauthier Harnisch [Fri, 21 Jun 2019 08:26:21 +0000 (08:26 +0000)]
[clang] Small improvments after Adding APValue to ConstantExpr

Summary:
this patch has multiple small improvements related to the APValue in ConstantExpr.

changes:
 - APValue in ConstantExpr are now cleaned up using ASTContext::addDestruction instead of there own system.
 - ConstantExprBits Stores the ValueKind of the result beaing stored.
 - VerifyIntegerConstantExpression now stores the evaluated value in ConstantExpr.
 - the Constant Evaluator uses the stored value of ConstantExpr when available.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[CodeGen][test] Use FileCheck variable matchers for better test support
Jordan Rupprecht [Thu, 20 Jun 2019 22:35:52 +0000 (22:35 +0000)]
[CodeGen][test] Use FileCheck variable matchers for better test support

Summary: Depending on how clang is built, it may discard the IR names and use names like `%2` instead of `%result.ptr`, causing tests that rely on the IR name to fail. Using FileCheck matchers makes the test work regardless of how clang is built.

This test passes with both `-fno-discard-value-names` and `-fdiscard-value-names` to make sure it passes regardless of the build mode.

Reviewers: rnk, akhuang, aprantl, lebedev.ri

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] DeadStores: Update the crude suppression for files generated by IIG.
Artem Dergachev [Thu, 20 Jun 2019 22:29:40 +0000 (22:29 +0000)]
[analyzer] DeadStores: Update the crude suppression for files generated by IIG.

They changed the comments that we were looking for.

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

5 years ago[X86] Change LL to O in the definitions for the vp2intersect builtins.
Craig Topper [Thu, 20 Jun 2019 22:19:16 +0000 (22:19 +0000)]
[X86] Change LL to O in the definitions for the vp2intersect builtins.

This is needed to support OpenCL where long long is 128 bits.

This was done for the other builtins already, but I think
vp2intersect was in phabricator at the time.

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

5 years agoPrint information about various ObjC expression nodes when dumping the AST to JSON.
Aaron Ballman [Thu, 20 Jun 2019 21:45:31 +0000 (21:45 +0000)]
Print information about various ObjC expression nodes when dumping the AST to JSON.

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

5 years agoAMDGPU: Add DS GWS sema builtins
Matt Arsenault [Thu, 20 Jun 2019 21:33:57 +0000 (21:33 +0000)]
AMDGPU: Add DS GWS sema builtins

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

5 years ago[test][Driver] Fix Clang :: Driver/cl-response-file.c
Rainer Orth [Thu, 20 Jun 2019 21:33:09 +0000 (21:33 +0000)]
[test][Driver] Fix Clang :: Driver/cl-response-file.c

Clang :: Driver/cl-response-file.c currently FAILs on Solaris:

  Command Output (stderr):
  --
  /vol/llvm/src/clang/dist/test/Driver/cl-response-file.c:10:11: error: CHECK: expected string not found in input
  // CHECK: "-I" "{{.*}}\\Inputs\\cl-response-file\\" "-D" "FOO=2"
            ^

Looking at the generated response file reveals that this is no surprise:

  /I/vol/llvm/src/clang/dist/test/Driver\Inputs

with no newline at the end.  The echo command used to create it boils down to

  echo 'a\cb'

However, one cannot expect \c to be emitted literally: e.g. bash's builtin
echo has

  \c        suppress further output

I've tried various combinations of builtin echo, /usr/bin/echo, GNU echo if
different, the same for printf, and the backslash unescaped and quoted
(a\cb and a\\cb).  The only combination that worked reliably on Solaris,
Linux, and macOS was

  printf 'a\\cb'

so this is what this patch uses.  Tested on amd64-pc-solaris2.11 and
x86_64-pc-linux-gnu.

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

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

5 years agoRename CodeGenFunction::overlapFor* to getOverlapFor*.
Richard Smith [Thu, 20 Jun 2019 20:56:20 +0000 (20:56 +0000)]
Rename CodeGenFunction::overlapFor* to getOverlapFor*.

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

5 years agoP0840R2: support for [[no_unique_address]] attribute
Richard Smith [Thu, 20 Jun 2019 20:44:45 +0000 (20:44 +0000)]
P0840R2: support for [[no_unique_address]] attribute

Summary:
Add support for the C++2a [[no_unique_address]] attribute for targets using the Itanium C++ ABI.

This depends on D63371.

Reviewers: rjmccall, aaron.ballman

Subscribers: dschuff, aheejin, cfe-commits

Tags: #clang

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

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

5 years ago[clang-tidy] Fail gracefully upon empty database fields
Serge Guelton [Thu, 20 Jun 2019 20:25:59 +0000 (20:25 +0000)]
[clang-tidy] Fail gracefully upon empty database fields

Fix bz#42281

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

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

5 years agoFix passing structs and AVX vectors through sysv_abi
Reid Kleckner [Thu, 20 Jun 2019 20:07:20 +0000 (20:07 +0000)]
Fix passing structs and AVX vectors through sysv_abi

Do this the same way we did it for ms_abi in r324594.

Fixes PR36806.

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

5 years agoFix crash and rejects-valid when a later template parameter or default
Richard Smith [Thu, 20 Jun 2019 19:49:13 +0000 (19:49 +0000)]
Fix crash and rejects-valid when a later template parameter or default
template argument contains a backreference to a dependently-typed
earlier parameter.

In a case like:
  template<typename T, T A, decltype(A) = A> struct X {};
  template<typename U> auto Y = X<U, 0>();
we previously treated both references to `A` in the third parameter as
being of type `int` when checking the template-id in `Y`. That`s wrong;
the type of `A` in these contexts is the dependent type `U`.

When we encounter a non-type template argument that we can't convert to
the parameter type because of type-dependence, we now insert a dependent
conversion node so that the SubstNonTypeTemplateParmExpr for the
template argument will have the parameter's type rather than whatever
type the argument had.

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

5 years ago[clang][NewPM] Do not eliminate available_externally durng `-O2 -flto` runs
Leonard Chan [Thu, 20 Jun 2019 19:44:51 +0000 (19:44 +0000)]
[clang][NewPM] Do not eliminate available_externally durng `-O2 -flto` runs

This fixes CodeGen/available-externally-suppress.c when the new pass manager is
turned on by default. available_externally was not emitted during -O2 -flto
runs when it should still be retained for link time inlining purposes. This can
be fixed by checking that we aren't LTOPrelinking when adding the
EliminateAvailableExternallyPass.

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

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

5 years ago[clang][NewPM] Move EntryExitInstrumenterPass to the start of the pipeline
Leonard Chan [Thu, 20 Jun 2019 19:35:25 +0000 (19:35 +0000)]
[clang][NewPM] Move EntryExitInstrumenterPass to the start of the pipeline

This fixes CodeGen/x86_64-instrument-functions.c when running under the new
pass manager. The pass should go before any other pass to prevent
`__cyg_profile_func_enter/exit()` from not being emitted by inlined functions.

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

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

5 years agoPrint additional information about @encode expressions when dumping the AST to JSON.
Aaron Ballman [Thu, 20 Jun 2019 19:11:35 +0000 (19:11 +0000)]
Print additional information about @encode expressions when dumping the AST to JSON.

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