Commit Graph

79332 Commits

Author SHA1 Message Date
Csaba Dabis 68983321cc [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

llvm-svn: 366391
2019-07-18 00:03:55 +00:00
Peter Collingbourne 3b82b92c6b 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

llvm-svn: 366379
2019-07-17 21:45:19 +00:00
Sunil Srivastava 85d667fcb6 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.

llvm-svn: 366368
2019-07-17 20:41:26 +00:00
Alexey Bataev 48f5a43bcc [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.

llvm-svn: 366357
2019-07-17 18:03:39 +00:00
Momchil Velikov 0e2b74a2b0 Revert [AArch64] Add support for Transactional Memory Extension (TME)
This reverts r366322 (git commit 4b8da3a503)

llvm-svn: 366355
2019-07-17 17:43:32 +00:00
Anastasia Stulova 79f4e4770b [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

llvm-svn: 366351
2019-07-17 17:21:31 +00:00
Mike Rice 552c2c09d3 [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

llvm-svn: 366336
2019-07-17 15:18:45 +00:00
Gabor Marton ae512b83d5 [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

llvm-svn: 366332
2019-07-17 14:40:09 +00:00
Gabor Marton aefcf5100a [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

llvm-svn: 366325
2019-07-17 13:47:46 +00:00
Momchil Velikov 4b8da3a503 [AArch64] Add support for Transactional Memory Extension (TME)
TME is a future architecture technology, documented in

https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools
https://developer.arm.com/docs/ddi0601/a

More about the future architectures:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/new-technologies-for-the-arm-a-profile-architecture

This patch adds support for the TME instructions TSTART, TTEST, TCOMMIT, and
TCANCEL and the target feature/arch extension "tme".

It also implements TME builtin functions, defined in ACLE Q2 2019
(https://developer.arm.com/docs/101028/latest)

Patch by Javed Absar and Momchil Velikov

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

llvm-svn: 366322
2019-07-17 13:23:27 +00:00
Momchil Velikov e14cfe2d2e [AArch64] Consistent types and naming for AArch64 target features (NFC)
Differential Revision: https://reviews.llvm.org/D64415

Committed as obvious.

llvm-svn: 366315
2019-07-17 11:24:37 +00:00
Marco Antognini 9eb95903da [OpenCL][Sema] Minor refactoring and constraint checking
Summary:
Simplify code a bit and add assertion to address post-landing comments
from D64083.

Subscribers: yaxunl, Anastasia, cfe-commits

Tags: #clang

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

llvm-svn: 366306
2019-07-17 08:52:09 +00:00
Rainer Orth 9662721572 [Driver] Enable __cxa_atexit on Solaris
Starting with Solaris 11.4 (which is now the required minimal version), Solaris does
support __cxa_atexit.  This patch reflects that.

One might consider removing the affected tests altogether instead of inverting them,
as is done on other targets.

Besides, this lets two ASan tests PASS:

  AddressSanitizer-i386-sunos :: TestCases/init-order-atexit.cc
  AddressSanitizer-i386-sunos-dynamic :: TestCases/init-order-atexit.cc

Tested on x86_64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

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

llvm-svn: 366305
2019-07-17 08:37:00 +00:00
Matt Arsenault e56865d40c AMDGPU: Add some missing builtins
llvm-svn: 366286
2019-07-17 00:01:03 +00:00
Reid Kleckner 9304e59c01 Fix OpenCLCXX test on 32-bit Windows where thiscall is present
llvm-svn: 366284
2019-07-16 23:44:33 +00:00
Reid Kleckner 2ecca781a1 Fix darwin-ld.c if dsymutil.exe exists on PATH
llvm-svn: 366282
2019-07-16 23:38:05 +00:00
George Burgess IV fdeed837ed Fix a typo in target features
There was a slight typo in r364352 that ended up causing our backend to
complain on some x86 Android builds. This CL fixes that.

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

llvm-svn: 366276
2019-07-16 22:32:17 +00:00
Guanzhong Chen 42bba4b852 [WebAssembly] Implement thread-local storage (local-exec model)
Summary:
Thread local variables are placed inside a `.tdata` segment. Their symbols are
offsets from the start of the segment. The address of a thread local variable
is computed as `__tls_base` + the offset from the start of the segment.

`.tdata` segment is a passive segment and `memory.init` is used once per thread
to initialize the thread local storage.

`__tls_base` is a wasm global. Since each thread has its own wasm instance,
it is effectively thread local. Currently, `__tls_base` must be initialized
at thread startup, and so cannot be used with dynamic libraries.

`__tls_base` is to be initialized with a new linker-synthesized function,
`__wasm_init_tls`, which takes as an argument a block of memory to use as the
storage for thread locals. It then initializes the block of memory and sets
`__tls_base`. As `__wasm_init_tls` will handle the memory initialization,
the memory does not have to be zeroed.

To help allocating memory for thread-local storage, a new compiler intrinsic
is introduced: `__builtin_wasm_tls_size()`. This instrinsic function returns
the size of the thread-local storage for the current function.

The expected usage is to run something like the following upon thread startup:

    __wasm_init_tls(malloc(__builtin_wasm_tls_size()));

Reviewers: tlively, aheejin, kripken, sbc100

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

Tags: #clang, #llvm

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

llvm-svn: 366272
2019-07-16 22:00:45 +00:00
Ben Hamilton f4c2d57f76 [clang-format] Don't detect call to ObjC class method as C++11 attribute specifier
Summary:
Previously, clang-format detected something like the following as a C++11 attribute specifier.

  @[[NSArray class]]

instead of an array with an Objective-C method call inside. In general, when the attribute specifier checking runs, if it sees 2 identifiers in a row, it decides that the square brackets represent an Objective-C method call. However, here, `class` is tokenized as a keyword instead of an identifier, so this check fails.

To fix this, the attribute specifier first checks whether the first square bracket has an "@" before it. If it does, then that square bracket is not the start of a attribute specifier because it is an Objective-C array literal. (The assumption is that @[[.*]] is not valid C/C++.)

Contributed by rkgibson2.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: aaron.ballman, cfe-commits

Tags: #clang

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

llvm-svn: 366267
2019-07-16 21:29:40 +00:00
Yonghong Song 4754814c5a fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic
The original commit is r366076. It is temporarily reverted (r366155)
due to test failure. This resubmit makes test more robust by accepting
regex instead of hardcoded names/references in several places.

This is a followup patch for https://reviews.llvm.org/D61809.
Handle unnamed bitfield properly and add more test cases.

Fixed the unnamed bitfield issue. The unnamed bitfield is ignored
by debug info, so we need to ignore such a struct/union member
when we try to get the member index in the debug info.

D61809 contains two test cases but not enough as it does
not checking generated IRs in the fine grain level, and also
it does not have semantics checking tests.
This patch added unit tests for both code gen and semantics checking for
the new intrinsic.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 366231
2019-07-16 17:24:33 +00:00
Neil Hickey 8ece3b6719 [OpenCL] Fixing sampler initialisations for C++ mode.
Allow conversions between integer and sampler type.

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

llvm-svn: 366212
2019-07-16 14:57:32 +00:00
Alexey Bataev 655cb4a2d7 [OPENMP]Add support for analysis of if clauses.
Summary:
Added support for analysis of if clauses in the OpenMP directives to be
able to check for the use of uninitialized variables.

Reviewers: NoQ

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

Tags: clang

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

llvm-svn: 366211
2019-07-16 14:51:46 +00:00
Rainer Orth a5dc9c9835 [Driver] Don't pass --dynamic-linker to ld on Solaris
I noticed that clang currently passes --dynamic-linker to ld.  This has been the case
since Solaris 11 support was added initially back in 2012 by David Chisnall (r150580).
I couldn't find any patch submission, let alone a justification, for this, and it seems
completely useless: --dynamic-linker is a gld compatibility form of the option, the
native option being -I.  First of all, however, the dynamic linker passed is simply the
default, so there's no reason at all to specify it in the first place.

This patch removes passing the option and adjusts the affected testcase accordingly.

Tested on x86_64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

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

llvm-svn: 366202
2019-07-16 11:06:43 +00:00
Sam McCall 0afffab0d1 [SemaTemplate] Fix uncorrected typos after pack expansion
Summary:
This case is particularly important for clangd, as it is triggered after
inserting the snippet for variadic functions.

Reviewers: kadircet, ilya-biryukov

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 366200
2019-07-16 10:30:21 +00:00
Kyrylo Tkachov eb72138340 [AArch64] Implement __jcvt intrinsic from Armv8.3-A
The jcvt intrinsic defined in ACLE [1] is available when ARM_FEATURE_JCVT is defined.

This change introduces the AArch64 intrinsic, wires it up to the instruction and a new clang builtin function.
The __ARM_FEATURE_JCVT macro is now defined when an Armv8.3-A or higher target is used.
I've implemented the target detection logic in Clang so that this feature is enabled for architectures from armv8.3-a onwards (so -march=armv8.4-a also enables this, for example).

make check-all didn't show any new failures.

[1] https://developer.arm.com/docs/101028/latest/data-processing-intrinsics

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

llvm-svn: 366197
2019-07-16 09:27:39 +00:00
Serge Guelton a307752627 [clang-scan-view] Force utf-8 when handling report (python2 only)
Original patch by random human <random.bored.human@gmail.com>

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

llvm-svn: 366194
2019-07-16 08:56:47 +00:00
Stephan Bergmann e215996a29 Finish "Adapt -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO"
i.e., recent 5745eccef54ddd3caca278d1d292a88b2281528b:

* Bump the function_type_mismatch handler version, as its signature has changed.

* The function_type_mismatch handler can return successfully now, so
  SanitizerKind::Function must be AlwaysRecoverable (like for
  SanitizerKind::Vptr).

* But the minimal runtime would still unconditionally treat a call to the
  function_type_mismatch handler as failure, so disallow -fsanitize=function in
  combination with -fsanitize-minimal-runtime (like it was already done for
  -fsanitize=vptr).

* Add tests.

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

llvm-svn: 366186
2019-07-16 06:23:27 +00:00
Rui Ueyama 49a3ad21d6 Fix parameter name comments using clang-tidy. NFC.
This patch applies clang-tidy's bugprone-argument-comment tool
to LLVM, clang and lld source trees. Here is how I created this
patch:

$ git clone https://github.com/llvm/llvm-project.git
$ cd llvm-project
$ mkdir build
$ cd build
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \
    -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \
    -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \
    -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm
$ ninja
$ parallel clang-tidy -checks='-*,bugprone-argument-comment' \
    -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \
    ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h}

llvm-svn: 366177
2019-07-16 04:46:31 +00:00
Ali Tamur e7e8789a63 Revert "[OPENMP]Add support for analysis of if clauses."
This reverts commit rL366068.
The patch broke 86 tests under clang/test/OpenMP/ when run with address sanitizer.

llvm-svn: 366169
2019-07-16 03:20:15 +00:00
Nathan Lanza 49e14cefbe Change a lit test to permit vendor specific clang version
A test manually checks for the string `__VERSION__ "Clang`. This needs
to permit vendor specific variants.

llvm-svn: 366166
2019-07-16 02:05:52 +00:00
Bob Haarman 492ce8cc8b reland "add -fthinlto-index= option to clang-cl"
Summary:
This is a reland of r366146, adding in the previously missing '--'
flag that prevents filenames from being interpreted as flags.

Original description:
This adds a -fthinlto-index= option to clang-cl, which allows it to
be used to drive ThinLTO backend passes. This allows clang-cl to be
used for distributed ThinLTO.

Tags: #clang
llvm-svn: 366165
2019-07-16 01:35:49 +00:00
Peter Wu fa52e00c85 [Sema] Suppress additional warnings for C's zero initializer
Summary:
D28148 relaxed some checks for assigning { 0 } to a structure for all C
standards, but it failed to handle structures with non-integer
subobjects. Relax -Wmissing-braces checks for such structures, and add
some additional tests.

This fixes PR39931.

Patch By: al3xtjames

Reviewed By: Lekensteyn

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

llvm-svn: 366163
2019-07-16 01:13:36 +00:00
Nathan Lanza 50f0c82453 Allow for vendor prefixes in a list test
Summary:
Preprocessor/init.c contains a line that explicitly checks for the
string

__VERSION__ "Clang{{.*}}

It's valid to have a toolchain configured to emit a vendor prefix
before the word Clang. e.g.

__VERSION__ "Vendor Clang{{.*}}

Subscribers: fedor.sergeev, cfe-commits

Tags: #clang

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

llvm-svn: 366159
2019-07-16 00:57:50 +00:00
Eric Christopher bf20b2ace6 Temporarily revert "add -fthinlto-index= option to clang-cl"
This is causing testsuite failures on (at least) darwin release+asserts.

This reverts commit r366146.

llvm-svn: 366157
2019-07-16 00:02:40 +00:00
Eric Christopher fdcbd5fa48 Temporarily Revert "fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic"
The commit had tests that would only work with names in the IR.

This reverts commit r366076.

llvm-svn: 366155
2019-07-15 23:49:31 +00:00
Leonard Chan bb147aabc6 Revert "[NewPM] Port Sancov"
This reverts commit 5652f35817.

llvm-svn: 366153
2019-07-15 23:18:31 +00:00
Jan Korous 60a0d49e77 [DirectoryWatcher][linux] Fix for older kernels
IN_EXCL_UNLINK exists since Linux 2.6.36

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

llvm-svn: 366152
2019-07-15 23:14:00 +00:00
Bob Haarman 199f8721e6 add -fthinlto-index= option to clang-cl
Summary:
This adds a -fthinlto-index= option to clang-cl, which allows it to
be used to drive ThinLTO backend passes. This allows clang-cl to be
used for distributed ThinLTO.

Reviewers: tejohnson, pcc, rnk

Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366146
2019-07-15 22:50:04 +00:00
Tom Stellard 4422cc4f1a [OpenCL] Make TableGen'd builtin tables and helper functions static
Reviewers: Pierre, Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits

Tags: #clang

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

llvm-svn: 366143
2019-07-15 22:34:19 +00:00
Lang Hames 853813293a [clang-fuzzer] Remove 'setUseOrcMCJITReplacement(false)' call.
The default value for this option (UseMCJITReplacement) is already false, and
OrcMCJITReplacement is going to have deprecation warnings attached in LLVM 9.0.
Removing this call removes a spurious warning.

llvm-svn: 366141
2019-07-15 22:27:57 +00:00
Jan Korous c5e7a3d710 [DirectoryWatcher][test] Relax test assumptions
Workaround for FSEvents sometimes sending notifications for events that happened
before DirectoryWatcher was created.

This caused tests to be flaky on green dragon.

llvm-svn: 366138
2019-07-15 22:11:51 +00:00
Jan Korous 5076038bb0 [DirectoryWatcher][NFC][test] Add typedef for enum
llvm-svn: 366137
2019-07-15 22:11:28 +00:00
Bob Haarman 794346460a [clang] allow -fthinlto-index= without -x ir
Summary:
Previously, passing -fthinlto-index= to clang required that bitcode
files be explicitly marked by -x ir. This change makes us detect files
with object file extensions as bitcode files when -fthinlto-index= is
present, so that explicitly marking them is no longer necessary.
Explicitly specifying -x ir is still accepted and continues to be part
of the test case to ensure we continue to support it.

Reviewers: tejohnson, rnk, pcc

Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 366127
2019-07-15 20:51:44 +00:00
Evgeniy Stepanov c5e7f56249 ARM MTE stack sanitizer.
Add "memtag" sanitizer that detects and mitigates stack memory issues
using armv8.5 Memory Tagging Extension.

It is similar in principle to HWASan, which is a software implementation
of the same idea, but there are enough differencies to warrant a new
sanitizer type IMHO. It is also expected to have very different
performance properties.

The new sanitizer does not have a runtime library (it may grow one
later, along with a "debugging" mode). Similar to SafeStack and
StackProtector, the instrumentation pass (in a follow up change) will be
inserted in all cases, but will only affect functions marked with the
new sanitize_memtag attribute.

Reviewers: pcc, hctim, vitalybuka, ostannard

Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 366123
2019-07-15 20:02:23 +00:00
Sylvestre Ledru 56799837a4 Update __VERSION__ to remove the hardcoded 4.2.1 version
Summary:
Just like in https://reviews.llvm.org/D56803
for -dumpversion

Reviewers: rnk

Reviewed By: rnk

Subscribers: dexonsmith, lebedev.ri, hubert.reinterpretcast, xbolva00, fedor.sergeev, cfe-commits

Tags: #clang

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

llvm-svn: 366091
2019-07-15 17:47:22 +00:00
Nico Weber a2dcbd3643 Use a unique_ptr instead of manual memory management for LineTable
llvm-svn: 366088
2019-07-15 17:27:46 +00:00
Nico Weber 05489f0952 Use a unique_ptr instead of manual memory management for CustomDiagInfo
llvm-svn: 366085
2019-07-15 17:20:34 +00:00
Nico Weber 0e5f915757 Use unique_ptr instead of manual delete in one place. No behavior change.
llvm-svn: 366084
2019-07-15 17:12:08 +00:00
Yonghong Song e5086481b6 fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic
This is a followup patch for https://reviews.llvm.org/D61809.
Handle unnamed bitfield properly and add more test cases.

Fixed the unnamed bitfield issue. The unnamed bitfield is ignored
by debug info, so we need to ignore such a struct/union member
when we try to get the member index in the debug info.

D61809 contains two test cases but not enough as it does
not checking generated IRs in the fine grain level, and also
it does not have semantics checking tests.
This patch added unit tests for both code gen and semantics checking for
the new intrinsic.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 366076
2019-07-15 15:42:41 +00:00
Alexey Bataev 63d00b19e5 [OPENMP]Add support for analysis of if clauses.
Summary:
Added support for analysis of if clauses in the OpenMP directives to be
able to check for the use of uninitialized variables.

Reviewers: NoQ

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

Tags: #clang

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

llvm-svn: 366068
2019-07-15 14:46:23 +00:00