Commit Graph

79046 Commits

Author SHA1 Message Date
Jan Korous caf4cee6fe [clang][test][NFC] Explicitly specify clang ABI in AST Dumper test
Clang <= 4 used the pre-C++11 rule about which structures can be passed in registers.

llvm-svn: 364690
2019-06-28 22:37:31 +00:00
Alexey Bataev 1242d8f333 [OPENMP]Improve analysis of implicit captures.
If the variable is used in the OpenMP region implicitly, we need to
check the data-sharing attributes for such variables and generate
implicit clauses for them. Patch improves analysis of such variables for
better handling of data-sharing rules.

llvm-svn: 364683
2019-06-28 20:45:14 +00:00
Brad Smith 642fe780ab Revert enabling frame pointer elimination on OpenBSD for now.
llvm-svn: 364679
2019-06-28 19:57:51 +00:00
Volodymyr Sapsai 5f8b9092ff [ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.
`Selector::getIdentifierInfoForSlot` returns NULL if a slot has no
corresponding identifier. Add a boolean to the hash and a NULL check.

rdar://problem/51615164

Reviewers: rtrieu

Reviewed By: rtrieu

Subscribers: dexonsmith, cfe-commits, jkorous

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

llvm-svn: 364664
2019-06-28 17:42:17 +00:00
Alexey Bataev 73f9d9aa64 [OPENMP]Fix top DSA for static members.
Fixed handling of the data-sharing attributes for static members when
requesting top most attribute. Previously, it might return the incorrect
attributes for static members if they were overriden in the outer
constructs.

llvm-svn: 364655
2019-06-28 16:16:00 +00:00
Alexey Bataev b7c31ff4a2 [OPENMP]Fix DSA for loop iteration variables in simd loops.
According to the OpenMP 5.0 standard, the loop iteration variable in the associated
for-loop of a simd construct with just one associated for-loop may be
listed in a private, lastprivate, or linear clause with a linear-step
that is the increment of the associated for-loop. Also, the loop
teration variables in the associated for-loops of a simd construct with
multiple associated for-loops may be listed in a private or lastprivate
clause.

llvm-svn: 364650
2019-06-28 15:16:37 +00:00
Krzysztof Parzyszek 40b88e07e2 [Hexagon] driver uses out-of-date option name and binary name
Patch by A. Skrobov (t.yomitch).

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

llvm-svn: 364648
2019-06-28 15:08:03 +00:00
Alexey Bataev 405f8fc812 [OPENMP]Fix checks for DSA in simd constructs.
The errors for incorrectly specified data-sharing attributes for simd
constructs must be emitted only for the explicitly provided clauses, not
the predetermined ones.

llvm-svn: 364647
2019-06-28 14:59:25 +00:00
Gabor Marton 8ab8a60a1e [CTU] Add missing statistics
Reviewers: xazax.hun

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

Tags: #clang

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

llvm-svn: 364630
2019-06-28 08:08:51 +00:00
Nathan Huckleberry 13fde7a89a [analyzer] Fix clang-tidy crash on GCCAsmStmt
Summary:
Added entry in switch statement to recognize GCCAsmStmt
as a possible block terminator.

Handling to build CFG using GCCAsmStmt was already implemented.

Reviewers: nickdesaulniers, george.karpenkov, NoQ

Reviewed By: nickdesaulniers, NoQ

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

Tags: #clang

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

llvm-svn: 364605
2019-06-27 22:46:40 +00:00
Akira Hatanaka 3b56e390dd Pattern match struct types in test case.
This simplifies the test cases in a patch I'm planning to send later.

llvm-svn: 364595
2019-06-27 21:16:19 +00:00
Alexey Bataev f288cf9dfa [OPENMP]Generate correctly implicit flags for mapped data.
Implicit flag must not be emitted for explicitly specified firstprivate
variables, but for implicitly captured sizes of the VLAs.

llvm-svn: 364575
2019-06-27 18:53:07 +00:00
Djordje Todorovic 0f65168566 [clang] Add DISuprogram and DIE for a func decl
Attach a unique DISubprogram to a function declaration that will be
used for call site debug info.

([7/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/D60714

llvm-svn: 364502
2019-06-27 06:44:44 +00:00
Vitaly Buka f35a3456ea [NFC] Return early for types with size zero
llvm-svn: 364495
2019-06-27 02:08:15 +00:00
Vitaly Buka 96ff25ad65 [NFC] Remove unneeded local variables
llvm-svn: 364492
2019-06-27 01:34:21 +00:00
Erik Pilkington d7999cbc6e [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

llvm-svn: 364489
2019-06-26 23:39:23 +00:00
Aaron Puchert 4561161345 Fix formatting after r364479
The reflowing obscurs the functional changes, so here is a separate
commit.

llvm-svn: 364480
2019-06-26 21:39:19 +00:00
Aaron Puchert b207baeb28 [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

llvm-svn: 364479
2019-06-26 21:36:35 +00:00
Reid Kleckner e6f2ff2c8d 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.

llvm-svn: 364476
2019-06-26 21:16:51 +00:00
Alex Lorenz d5f7196feb [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

llvm-svn: 364474
2019-06-26 21:11:51 +00:00
Guanzhong Chen 9aad997a5a [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

llvm-svn: 364468
2019-06-26 20:16:14 +00:00
JF Bastien 0e82895826 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

llvm-svn: 364464
2019-06-26 19:50:12 +00:00
Xing Xue 600941e34f 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

llvm-svn: 364462
2019-06-26 19:27:16 +00:00
Nico Weber 908b697e78 Make AddLastArg() variadic and use it more. No behavior change.
llvm-svn: 364453
2019-06-26 17:51:47 +00:00
Michael Liao 5c94dd76d7 Make CodeGen depend on ASTMatchers
- Shared library builds are broken due to the missing dependency.

llvm-svn: 364428
2019-06-26 14:13:43 +00:00
Djordje Todorovic ed05d49aad [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

llvm-svn: 364424
2019-06-26 13:32:02 +00:00
Sven van Haastregt 1006a068c6 [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

llvm-svn: 364423
2019-06-26 13:31:24 +00:00
Djordje Todorovic e17a52ebee [clang] Fix test failures after the rL364399
llvm-svn: 364402
2019-06-26 10:23:25 +00:00
Djordje Todorovic 639d36b34e [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

llvm-svn: 364399
2019-06-26 09:38:09 +00:00
Kadir Cetinkaya 0a43d1fa71 [clang][Tooling] Fix windows build-bots after rL364386
llvm-svn: 364396
2019-06-26 08:39:42 +00:00
Kadir Cetinkaya c3a7302397 [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

llvm-svn: 364386
2019-06-26 07:39:03 +00:00
Yaxun Liu c3dfe9082b [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

llvm-svn: 364381
2019-06-26 03:47:37 +00:00
Yaxun Liu d325eb3b56 Fix build failure due to missing break
llvm-svn: 364380
2019-06-26 03:33:03 +00:00
Artem Dergachev 628f36ff70 [analyzer] exploded-graph-rewriter: Prettier location context dumps.
Make them span wider.

llvm-svn: 364365
2019-06-26 00:14:49 +00:00
Ziang Wan de94ac9357 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=?.

llvm-svn: 364362
2019-06-25 23:57:14 +00:00
Rumeet Dhindsa a1d688dfdd Revert Devirtualize destructor of final class.
This reverts r364100 (git commit 405c2b1622)

llvm-svn: 364359
2019-06-25 22:58:25 +00:00
Saleem Abdulrasool c32d307a49 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.

llvm-svn: 364352
2019-06-25 21:43:34 +00:00
Richard Smith dcd7eb710b Remove redundant expression evaluation context when substituting into a
template argument.

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

llvm-svn: 364347
2019-06-25 20:40:27 +00:00
Richard Smith 30519a68d5 Add regression test for PR41576 (which is already fixed in trunk,
perhaps by r361300).

llvm-svn: 364340
2019-06-25 18:42:53 +00:00
Simon Tatham e8de8ba6a6 [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

llvm-svn: 364331
2019-06-25 16:49:32 +00:00
Alexey Bataev a90fc6617f [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.

llvm-svn: 364327
2019-06-25 16:00:43 +00:00
Haojian Wu 7276a446ce [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

llvm-svn: 364283
2019-06-25 08:43:17 +00:00
Gabor Marton 303c9861e9 [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

llvm-svn: 364279
2019-06-25 08:00:51 +00:00
Csaba Dabis 0cdd13c05a [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

llvm-svn: 364271
2019-06-25 03:17:55 +00:00
Csaba Dabis c55170c031 [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

llvm-svn: 364270
2019-06-25 03:08:32 +00:00
Artem Dergachev 14f4de9bb9 [analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.
'|' is a special character in graphviz, so it needs to be properly
escaped and unescaped.

llvm-svn: 364269
2019-06-25 02:16:56 +00:00
Artem Dergachev beb85ad66d [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

llvm-svn: 364268
2019-06-25 02:16:53 +00:00
Artem Dergachev b9c94f946f [analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.
Differential Revision: https://reviews.llvm.org/D63684

llvm-svn: 364267
2019-06-25 02:16:50 +00:00
Artem Dergachev c48be7fc1c [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

llvm-svn: 364266
2019-06-25 02:16:47 +00:00
Richard Smith 7939ba08ab [cxx2a] P1236R1: the validity of a left shift does not depend on the
value of the LHS operand.

llvm-svn: 364265
2019-06-25 01:45:26 +00:00