Commit Graph

78450 Commits

Author SHA1 Message Date
Alexandre Ganea 047e65db77 [DebugInfo] Don't emit checksums when compiling a preprocessed CPP
Fixes PR41215

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

llvm-svn: 361296
2019-05-21 19:40:28 +00:00
Yitzhak Mandelbaum f0d9cfa591 [LibTooling] Address post-commit feedback for r361152
Fixes a redundant dependency and moves another to its proper place.

Reviewers: thakis

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 361285
2019-05-21 18:48:58 +00:00
Alexey Bataev 6b21c4a4ee [OPENMP]Use the attributes for dso locality when building for device.
Currently, we ignore all dso locality attributes/info when building for
the device and thus all symblos are externally visible and can be
preemted at the runtime. It may lead to incorrect results. We need to
follow the same logic, compiler uses for static/pie builds.

llvm-svn: 361283
2019-05-21 18:20:08 +00:00
Louis Dionne e97b5f5cf3 [clang][Darwin] Refactor header search path logic into the driver
Summary:
This commit moves the logic for determining system, resource and C++
header search paths from CC1 to the driver. This refactor has already
been made for several platforms, but Darwin had been left behind.

This refactor tries to implement the previous search path logic with
perfect accuracy. In particular, the order of all include paths inside
CC1 and all paths that were skipped because nonexistent are conserved
after the refactor. This change was also tested against a code base
of significant size and revealed no problems.

Reviewers: jfb, arphaman

Subscribers: nemanjai, javed.absar, kbarton, christof, jkorous, dexonsmith, jsji, cfe-commits

Tags: #clang

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

llvm-svn: 361278
2019-05-21 17:48:04 +00:00
Chris Bieneman fb2a076511 [CMake] One more stab at fixing BUILD_SHARED_LIBS
If clang's libraries are build SHARED, we need to grab their `PRIVATE_LINK_LIBRARIES` properties and add those to clang_shared's interface.

llvm-svn: 361275
2019-05-21 17:30:59 +00:00
Aaron Ballman 31ca49be47 Do not use the incorrect attribute spelling list index when translating a no_sanitize_foo attribute into a no_sanitize("foo") attribute.
This fixes a crash when AST pretty printing declarations marked with no_sanitize_memory.

llvm-svn: 361274
2019-05-21 17:24:49 +00:00
Chris Bieneman dbc2a12c73 Fix BUILD_SHARED_LIBS for clang which broke in D61909
llvm_add_library ignores `BUILD_SHARED_LIBS` `STATIC` is explicitly specified. This restores the `BUILD_SHARED_LIBS` behavior to the clang build.

llvm-svn: 361271
2019-05-21 15:56:17 +00:00
Alexey Bataev 8c5555c39a [OPENMP][NVPTX]Mark more functions as always_inline for better
performance.

Internally generated functions must be marked as always_inlines in most
cases. Patch marks some extra reduction function + outlined parallel
functions as always_inline for better performance, but only if the
optimization is requested.

llvm-svn: 361269
2019-05-21 15:11:58 +00:00
Aaron Ballman 86abee8185 Add support for dumping AST comment nodes to JSON.
llvm-svn: 361265
2019-05-21 14:38:29 +00:00
Ilya Biryukov 6c0531222a [Syntax] Rename TokensTest to SyntaxTests. NFC
To be more consistent with conventions used in the codebase. The new
name will be a better fit when more bits of the syntax library land.

llvm-svn: 361264
2019-05-21 14:37:41 +00:00
Javed Absar 603a2bac05 [ARM][CMSE] Add commandline option and feature macro
Defines macro ARM_FEATURE_CMSE to 1 for v8-M targets and introduces
-mcmse option which for v8-M targets sets ARM_FEATURE_CMSE to 3.
A diagnostic is produced when the option is given on architectures
without support for Security Extensions.
Reviewed By: dmgreen, snidertm
Differential Revision: https://reviews.llvm.org/D59879

llvm-svn: 361261
2019-05-21 14:21:26 +00:00
Simon Pilgrim 45330fee4c [CodeGenModule] BlockByrefHelpers - add missing uninitialized variables to constructor. NFCI.
llvm-svn: 361242
2019-05-21 11:37:54 +00:00
Simon Pilgrim 823458f9b8 [CGBuiltin] dumpRecord - remove unused field offset. NFCI.
llvm-svn: 361238
2019-05-21 10:48:42 +00:00
Nikolai Kosjar 2eebf4d939 [libclang] visit c++14 lambda capture init expressions
Patch by Milian Wolff.

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

llvm-svn: 361234
2019-05-21 09:21:35 +00:00
Nikolai Kosjar 295c19e948 [Preamble] Reuse preamble even if an unsaved file does not exist
When a preamble is created an unsaved file not existing on disk is
already part of PrecompiledPreamble::FilesInPreamble. However, when
checking whether the preamble can be re-used, a failed stat of such an
unsaved file invalidated the preamble, which led to pointless and time
consuming preamble regenerations on subsequent reparses.

Do not require anymore that unsaved files should exist on disk.

This avoids costly preamble invalidations depending on timing issues for
the cases where the file on disk might be removed just to be regenerated
a bit later.

It also allows an IDE to provide in-memory files that might not exist on
disk, e.g. because the build system hasn't generated those yet.

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

llvm-svn: 361226
2019-05-21 07:26:59 +00:00
Nico Weber 4522e26696 Try to fix build with older gccs after r361152
Also merge the cmake change there to the gn build.

llvm-svn: 361209
2019-05-21 00:27:26 +00:00
Richard Smith f1b29723ce Give 'fixit-cxx0x.cpp' a more modern name.
llvm-svn: 361208
2019-05-20 23:37:18 +00:00
Leonard Chan 16beaae2a6 [Sema] Fix for build on some iOS programs.
Nullability attributes weren't being stripped for AttributedTypes that
were wrapped in a MacroQualifiedType. This fix adds a check for this
type and a test.

llvm-svn: 361205
2019-05-20 22:42:19 +00:00
Aaron Ballman 4aee1b5b0b Add more tests for AST JSON output; NFC.
This adds tests for dumping expressions in C. It also updates a comment to note an issue to be fixed with printing character literals discovered as part of this testing.

llvm-svn: 361193
2019-05-20 20:01:45 +00:00
Craig Topper 31cc510980 [X86] Check the alignment argument for the masked.load/store for the _mm_mask_store_ss/sd and _mm_mask(z)_load_ss/sd intrinsics.
llvm-svn: 361187
2019-05-20 18:48:31 +00:00
Chris Bieneman c1ad143f95 [CMake] Update DistributionExample for mono repo
This just updates the DistributionExamples from my 2016 Dev Meeting talk to work more seamlessly with the monorepo.

llvm-svn: 361184
2019-05-20 18:10:20 +00:00
Richard Smith e958506039 Rearrange and clean up how we disambiguate lambda-introducers from ObjC
message sends, designators, and attributes.

Instead of having the tentative parsing phase sometimes return an
indicator to say what diagnostic to produce if parsing fails and
sometimes ask the caller to run it again, consistently ask the caller to
try parsing again if tentative parsing would fail or is otherwise unable
to completely parse the lambda-introducer without producing an
irreversible semantic effect.

Mostly NFC, but we should recover marginally better in some error cases
(avoiding duplicate diagnostics).

llvm-svn: 361182
2019-05-20 18:01:54 +00:00
Aaron Ballman 4d05a974b7 Dump macro expansion information as needed when outputting the AST to JSON.
llvm-svn: 361172
2019-05-20 16:46:44 +00:00
Dmitri Gribenko 76e3a04951 Renamed `apply` to `select` to avoid ADL conflict with `std::apply`
Summary:
`std::apply` in C++14 and above is defined with two unrestricted arguments, and
it wins overload resolution in this case.

Reviewers: ilya-biryukov

Subscribers: cfe-commits, ymandel

Tags: #clang

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

llvm-svn: 361170
2019-05-20 16:30:49 +00:00
Craig Topper af7a188453 [Intrinsics] Merge lround.i32 and lround.i64 into a single intrinsic with overloaded result type. Make result type for llvm.llround overloaded instead of fixing to i64
We shouldn't really make assumptions about possible sizes for long and long long. And longer term we should probably support vectorizing these intrinsics. By making the result types not fixed we can support vectors as well.

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

llvm-svn: 361169
2019-05-20 16:27:09 +00:00
Paul Robinson d901936957 Fix test not to use UNSUPPORTED as a FileCheck prefix.
It was not causing a problem but it's not good practice.

llvm-svn: 361161
2019-05-20 14:57:18 +00:00
Yitzhak Mandelbaum ef29c6a63e [LibTooling] Fix build break in test after r361152.
r361152 broke gcc builds.

llvm-svn: 361160
2019-05-20 14:44:40 +00:00
Yitzhak Mandelbaum 27872b8d55 [LibTooling] Add RangeSelector library for defining source ranges based on bound AST nodes.
Summary:

The RangeSelector library defines a combinator language for specifying source
ranges based on bound ids for AST nodes.  The combinator approach follows the
design of the AST matchers.  The RangeSelectors defined here will be used in
both RewriteRule, for specifying source affected by edit, and in Stencil for
specifying source to use constructively in a replacement.

Reviewers: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 361152
2019-05-20 13:15:14 +00:00
Ilya Biryukov ddd5d5dbc8 [Syntax] Introduce TokenBuffer, start clangToolingSyntax library
Summary:
TokenBuffer stores the list of tokens for a file obtained after
preprocessing. This is a base building block for syntax trees,
see [1] for the full proposal on syntax trees.

This commits also starts a new sub-library of ClangTooling, which
would be the home for the syntax trees and syntax-tree-based refactoring
utilities.

[1]: https://lists.llvm.org/pipermail/cfe-dev/2019-February/061414.html

Reviewers: gribozavr, sammccall

Reviewed By: sammccall

Subscribers: mgrang, riccibruno, Eugene.Zelenko, mgorny, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 361148
2019-05-20 13:00:42 +00:00
Mikael Holmen 3b6b2e331f Fix compilation warning about unused variable [NFC]
Without the fix at least clang 3.6 complains with

../tools/clang/lib/AST/ExprConstant.cpp:90:24: error: unused variable 'TI' [-Werror,-Wunused-variable]
    if (TypeInfoLValue TI = B.dyn_cast<TypeInfoLValue>())
                       ^
1 error generated.

llvm-svn: 361145
2019-05-20 11:38:33 +00:00
Adam Balogh 33160c4424 [Analyzer] Refactor begin and end symbol creation
This patch refactors begin and end symbol creation by moving symbol
conjuration into the `create...` functions. This way the functions'
responsibilities are clearer and makes possible to add more functions
handling these symbols (e.g. functions for handling the container's
size) without code multiplication.

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

llvm-svn: 361141
2019-05-20 11:04:27 +00:00
Gabor Marton 1d51e3e6ee [ASTImporter] Enable disabled but passing tests
Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

llvm-svn: 361139
2019-05-20 10:38:14 +00:00
Nicolas Lesser e47ae69fa7 Fix buildbot: Use correct Consume*() for braces.
llvm-svn: 361120
2019-05-19 15:30:00 +00:00
Nicolas Lesser f53d172710 Added a better diagnostic when using the delete operator with lambdas
Summary:
This adds a new error for missing parentheses around lambdas in delete operators.

```
int main() {
  delete []() { return new int(); }();
}
```

This will result in:

```
test.cpp:2:3: error: '[]' after delete interpreted as 'delete[]'
  delete []() { return new int(); }();
  ^~~~~~~~~
test.cpp:2:9: note: add parentheses around the lambda
  delete []() { return new int(); }();
        ^
        (                          )
```

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: riccibruno, cfe-commits

Tags: #clang

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

llvm-svn: 361119
2019-05-19 15:07:58 +00:00
Stephen Kelly ad3314b146 Add a Visit overload for DynTypedNode to ASTNodeTraverser
Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361117
2019-05-19 13:03:48 +00:00
Dylan McKay 83338b1059 [AVR] Automatically link CRT and libgcc from the system avr-gcc
Summary:
This patch modifies the AVR toolchain so that if avr-gcc and avr-libc
are detected during compilation, the CRT, libgcc, libm, and libc anre
linked.

This matches avr-gcc's default behaviour, and the expected behaviour of
all C compilers - including the C runtime.

avr-gcc also needs a -mmcu specified in order to link runtime libraries.

The difference betwen this patch and avr-gcc is that this patch will
warn users whenever they compile without a runtime, as opposed to GCC,
which silently trims the runtime libs from the linker arguments when no
-mmcu is specified.

Reviewers: aaron.ballman, kparzysz, asb, hfinkel, brucehoult, TimNN

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361116
2019-05-19 09:54:14 +00:00
Craig Topper 3d7ecc4618 [X86] Remove semicolons at the end of intrinsics implemented as macros so they can be used as arguments to other intrinsics.
Also fix one intrinsic that was using variable names without underscores.

Fixes PR41932

llvm-svn: 361109
2019-05-19 01:01:52 +00:00
Kristof Umann f40c18b628 [analyzer] PR41753: Include complex integer types in NonLoc::isCompoundType
https://bugs.llvm.org/show_bug.cgi?id=41753

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

llvm-svn: 361099
2019-05-18 12:34:08 +00:00
Simon Pilgrim 30aa42e145 ScalarExprEmitter::EmitCompoundAssign - fix uninitialized variable warning. NFCI.
llvm-svn: 361098
2019-05-18 12:17:15 +00:00
Simon Pilgrim 3e95568dcf MIGChecker - assert we have a non-null LocationContext. NFCI.
Fixes scan-build warning.

llvm-svn: 361097
2019-05-18 11:42:19 +00:00
Simon Pilgrim 4c146ab8c4 ASTNodeImporter - fix uninitialized variable warnings. NFCI.
llvm-svn: 361096
2019-05-18 11:33:27 +00:00
Richard Smith a933030f84 [c++20] P1327R1: Support for typeid applied to objects of polymorphic
class type in constant evaluation.

This reinstates r360977, reverted in r360987, now that its rerequisite
patch is reinstated and fixed.

llvm-svn: 361067
2019-05-17 19:19:28 +00:00
Gheorghe-Teodor Bercea 144291e14c [OpenMP][bugfix] Add missing math functions variants for log and abs.
Summary: When including the random header in C++, some of the math functions it relies on are not present in the CUDA headers. We include this variants in this case.

Reviewers: jdoerfert, hfinkel, tra, caomhin

Reviewed By: tra

Subscribers: efriedma, guansong, cfe-commits

Tags: #clang

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

llvm-svn: 361066
2019-05-17 19:15:53 +00:00
Aaron Ballman bbfd8d1885 Add more tests for AST JSON output; NFC.
This adds tests for dumping records and statements.

llvm-svn: 361065
2019-05-17 19:14:01 +00:00
Nico Weber e78ac9cc72 Revert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"
It fails to build on some bots.

Also revert follow-up r361055.

llvm-svn: 361059
2019-05-17 18:31:24 +00:00
Nico Weber 762b3ef078 Attempt to fix test on Windows after r360998
llvm-svn: 361054
2019-05-17 17:33:54 +00:00
Dmitri Gribenko 04323c24a1 Added an assertion to constant evaluation enty points that prohibits dependent expressions
Summary:
Constant evaluator does not work on value-dependent or type-dependent
expressions.

Also fixed bugs uncovered by these assertions.

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361050
2019-05-17 17:16:53 +00:00
Kristof Umann 83cc1b35d1 [analyzer] Remove the default value arg from getChecker*Option
Since D57922, the config table contains every checker option, and it's default
value, so having it as an argument for getChecker*Option is redundant.

By the time any of the getChecker*Option function is called, we verified the
value in CheckerRegistry (after D57860), so we can confidently assert here, as
any irregularities detected at this point must be a programmer error. However,
in compatibility mode, verification won't happen, so the default value must be
restored.

This implies something else, other than adding removing one more potential point
of failure -- debug.ConfigDumper will always contain valid values for
checker/package options!

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

llvm-svn: 361042
2019-05-17 15:52:13 +00:00
Yitzhak Mandelbaum 8369a9beb7 [LibTooling] Add support to Transformer for composing rules as an ordered choice.
This revision updates `RewriteRule` to support multiple subrules that are
interpreted as an ordered-choice (apply the first one that matches). With this
feature, users can write the rules that appear later in the list of subrules
knowing that previous rules' patterns *have not matched*, freeing them from
reasoning about those cases in the current pattern.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361037
2019-05-17 14:23:33 +00:00
Stephen Kelly c8dcbed6e4 Extract ASTDumper to a header file
Summary:
This class has member APIs which are useful to clients.  Make it
possible to use those APIs without adding them to dump() member
functions.  Doing so does not scale.  The optional arguments to dump()
should be designed to be useful in a debugging context.

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 361034
2019-05-17 13:59:15 +00:00