]> granicus.if.org Git - clang/log
clang
5 years ago[Preamble] Reuse preamble even if an unsaved file does not exist
Nikolai Kosjar [Tue, 21 May 2019 07:26:59 +0000 (07:26 +0000)]
[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

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

5 years agoTry to fix build with older gccs after r361152
Nico Weber [Tue, 21 May 2019 00:27:26 +0000 (00:27 +0000)]
Try to fix build with older gccs after r361152

Also merge the cmake change there to the gn build.

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

5 years agoGive 'fixit-cxx0x.cpp' a more modern name.
Richard Smith [Mon, 20 May 2019 23:37:18 +0000 (23:37 +0000)]
Give 'fixit-cxx0x.cpp' a more modern name.

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

5 years ago[Sema] Fix for build on some iOS programs.
Leonard Chan [Mon, 20 May 2019 22:42:19 +0000 (22:42 +0000)]
[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.

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

5 years agoAdd more tests for AST JSON output; NFC.
Aaron Ballman [Mon, 20 May 2019 20:01:45 +0000 (20:01 +0000)]
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.

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

5 years ago[X86] Check the alignment argument for the masked.load/store for the _mm_mask_store_s...
Craig Topper [Mon, 20 May 2019 18:48:31 +0000 (18:48 +0000)]
[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.

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

5 years ago[CMake] Update DistributionExample for mono repo
Chris Bieneman [Mon, 20 May 2019 18:10:20 +0000 (18:10 +0000)]
[CMake] Update DistributionExample for mono repo

This just updates the DistributionExamples from my 2016 Dev Meeting talk to work more seamlessly with the monorepo.

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

5 years agoRearrange and clean up how we disambiguate lambda-introducers from ObjC
Richard Smith [Mon, 20 May 2019 18:01:54 +0000 (18:01 +0000)]
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).

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

5 years agoDump macro expansion information as needed when outputting the AST to JSON.
Aaron Ballman [Mon, 20 May 2019 16:46:44 +0000 (16:46 +0000)]
Dump macro expansion information as needed when outputting the AST to JSON.

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

5 years agoRenamed `apply` to `select` to avoid ADL conflict with `std::apply`
Dmitri Gribenko [Mon, 20 May 2019 16:30:49 +0000 (16:30 +0000)]
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

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

5 years ago[Intrinsics] Merge lround.i32 and lround.i64 into a single intrinsic with overloaded...
Craig Topper [Mon, 20 May 2019 16:27:09 +0000 (16:27 +0000)]
[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

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

5 years agoFix test not to use UNSUPPORTED as a FileCheck prefix.
Paul Robinson [Mon, 20 May 2019 14:57:18 +0000 (14:57 +0000)]
Fix test not to use UNSUPPORTED as a FileCheck prefix.
It was not causing a problem but it's not good practice.

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

5 years ago[LibTooling] Fix build break in test after r361152.
Yitzhak Mandelbaum [Mon, 20 May 2019 14:44:40 +0000 (14:44 +0000)]
[LibTooling] Fix build break in test after r361152.

r361152 broke gcc builds.

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

5 years ago[LibTooling] Add RangeSelector library for defining source ranges based on bound...
Yitzhak Mandelbaum [Mon, 20 May 2019 13:15:14 +0000 (13:15 +0000)]
[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

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

5 years ago[Syntax] Introduce TokenBuffer, start clangToolingSyntax library
Ilya Biryukov [Mon, 20 May 2019 13:00:42 +0000 (13:00 +0000)]
[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

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

5 years agoFix compilation warning about unused variable [NFC]
Mikael Holmen [Mon, 20 May 2019 11:38:33 +0000 (11:38 +0000)]
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.

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

5 years ago[Analyzer] Refactor begin and end symbol creation
Adam Balogh [Mon, 20 May 2019 11:04:27 +0000 (11:04 +0000)]
[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

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

5 years ago[ASTImporter] Enable disabled but passing tests
Gabor Marton [Mon, 20 May 2019 10:38:14 +0000 (10:38 +0000)]
[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

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

5 years agoFix buildbot: Use correct Consume*() for braces.
Nicolas Lesser [Sun, 19 May 2019 15:30:00 +0000 (15:30 +0000)]
Fix buildbot: Use correct Consume*() for braces.

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

5 years agoAdded a better diagnostic when using the delete operator with lambdas
Nicolas Lesser [Sun, 19 May 2019 15:07:58 +0000 (15:07 +0000)]
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

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

5 years agoAdd a Visit overload for DynTypedNode to ASTNodeTraverser
Stephen Kelly [Sun, 19 May 2019 13:03:48 +0000 (13:03 +0000)]
Add a Visit overload for DynTypedNode to ASTNodeTraverser

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[AVR] Automatically link CRT and libgcc from the system avr-gcc
Dylan McKay [Sun, 19 May 2019 09:54:14 +0000 (09:54 +0000)]
[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

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

5 years ago[X86] Remove semicolons at the end of intrinsics implemented as macros so they can...
Craig Topper [Sun, 19 May 2019 01:01:52 +0000 (01:01 +0000)]
[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

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

5 years ago[analyzer] PR41753: Include complex integer types in NonLoc::isCompoundType
Kristof Umann [Sat, 18 May 2019 12:34:08 +0000 (12:34 +0000)]
[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

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

5 years agoScalarExprEmitter::EmitCompoundAssign - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Sat, 18 May 2019 12:17:15 +0000 (12:17 +0000)]
ScalarExprEmitter::EmitCompoundAssign - fix uninitialized variable warning. NFCI.

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

5 years agoMIGChecker - assert we have a non-null LocationContext. NFCI.
Simon Pilgrim [Sat, 18 May 2019 11:42:19 +0000 (11:42 +0000)]
MIGChecker - assert we have a non-null LocationContext. NFCI.

Fixes scan-build warning.

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

5 years agoASTNodeImporter - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sat, 18 May 2019 11:33:27 +0000 (11:33 +0000)]
ASTNodeImporter - fix uninitialized variable warnings. NFCI.

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

5 years ago[c++20] P1327R1: Support for typeid applied to objects of polymorphic
Richard Smith [Fri, 17 May 2019 19:19:28 +0000 (19:19 +0000)]
[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.

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

5 years ago[OpenMP][bugfix] Add missing math functions variants for log and abs.
Gheorghe-Teodor Bercea [Fri, 17 May 2019 19:15:53 +0000 (19:15 +0000)]
[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

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

5 years agoAdd more tests for AST JSON output; NFC.
Aaron Ballman [Fri, 17 May 2019 19:14:01 +0000 (19:14 +0000)]
Add more tests for AST JSON output; NFC.

This adds tests for dumping records and statements.

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

5 years agoRevert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"
Nico Weber [Fri, 17 May 2019 18:31:24 +0000 (18:31 +0000)]
Revert r361033 "Add a Visit overload for DynTypedNode to ASTNodeTraverser"

It fails to build on some bots.

Also revert follow-up r361055.

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

5 years agoAttempt to fix test on Windows after r360998
Nico Weber [Fri, 17 May 2019 17:33:54 +0000 (17:33 +0000)]
Attempt to fix test on Windows after r360998

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

5 years agoAdded an assertion to constant evaluation enty points that prohibits dependent expres...
Dmitri Gribenko [Fri, 17 May 2019 17:16:53 +0000 (17:16 +0000)]
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

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

5 years ago[analyzer] Remove the default value arg from getChecker*Option
Kristof Umann [Fri, 17 May 2019 15:52:13 +0000 (15:52 +0000)]
[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

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

5 years ago[LibTooling] Add support to Transformer for composing rules as an ordered choice.
Yitzhak Mandelbaum [Fri, 17 May 2019 14:23:33 +0000 (14:23 +0000)]
[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

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

5 years agoExtract ASTDumper to a header file
Stephen Kelly [Fri, 17 May 2019 13:59:15 +0000 (13:59 +0000)]
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

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

5 years agoAdd a Visit overload for DynTypedNode to ASTNodeTraverser
Stephen Kelly [Fri, 17 May 2019 13:55:28 +0000 (13:55 +0000)]
Add a Visit overload for DynTypedNode to ASTNodeTraverser

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFix Wdocumentation warnings. NFCI.
Simon Pilgrim [Fri, 17 May 2019 13:42:16 +0000 (13:42 +0000)]
Fix Wdocumentation warnings. NFCI.

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

5 years ago[analyzer] Validate checker option names and values
Kristof Umann [Fri, 17 May 2019 09:51:59 +0000 (09:51 +0000)]
[analyzer] Validate checker option names and values

Validate whether the option exists, and also whether the supplied value is of
the correct type. With this patch, invoking the analyzer should be, at least
in the frontend mode, a lot safer.

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

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

5 years ago[Lex] Allow to consume tokens while preprocessing
Ilya Biryukov [Fri, 17 May 2019 09:32:05 +0000 (09:32 +0000)]
[Lex] Allow to consume tokens while preprocessing

Summary:
By adding a hook to consume all tokens produced by the preprocessor.
The intention of this change is to make it possible to consume the
expanded tokens without re-runnig the preprocessor with minimal changes
to the preprocessor and minimal performance penalty when preprocessing
without recording the tokens.

The added hook is very low-level and reconstructing the expanded token
stream requires more work in the client code, the actual algorithm to
collect the tokens using this hook can be found in the follow-up change.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: eraman, nemanjai, kbarton, jsji, riccibruno, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Insert checker options into AnalyzerOption::ConfigTable
Kristof Umann [Fri, 17 May 2019 09:29:44 +0000 (09:29 +0000)]
[analyzer] Insert checker options into AnalyzerOption::ConfigTable

The more entries we have in AnalyzerOptions::ConfigTable, the more helpful
debug.ConfigDumper is. With this patch, I'm pretty confident that it'll now emit
the entire state of the analyzer, minus the frontend flags.

It would be nice to reserve the config table specifically to checker options
only, as storing the regular analyzer configs is kinda redundant.

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

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

5 years ago[NFC] Fix line endings in OpenCL tests
Sven van Haastregt [Fri, 17 May 2019 09:25:38 +0000 (09:25 +0000)]
[NFC] Fix line endings in OpenCL tests

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

5 years agoSuppress false-positive GCC -Wreturn-type warning.
Richard Smith [Fri, 17 May 2019 08:06:49 +0000 (08:06 +0000)]
Suppress false-positive GCC -Wreturn-type warning.

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

5 years agoFix crash if, during evaluation of __builtin_object_size, we try to load
Richard Smith [Fri, 17 May 2019 08:01:34 +0000 (08:01 +0000)]
Fix crash if, during evaluation of __builtin_object_size, we try to load
through an invalid base.

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

5 years agoFix alignment check to check the alignment of the intended type.
Richard Smith [Fri, 17 May 2019 07:28:41 +0000 (07:28 +0000)]
Fix alignment check to check the alignment of the intended type.

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

5 years ago[ClangFormat] Editor integrations inherit default style from clang-format binary
Sam McCall [Fri, 17 May 2019 07:22:55 +0000 (07:22 +0000)]
[ClangFormat] Editor integrations inherit default style from clang-format binary

Summary:
This allows downstream customizations to the default style to work without
needing to also modify the editor integrations.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

5 years agoRefactor constant evaluation of typeid(T) to track a symbolic type_info
Richard Smith [Fri, 17 May 2019 07:06:46 +0000 (07:06 +0000)]
Refactor constant evaluation of typeid(T) to track a symbolic type_info
object rather than tracking the originating expression.

This is groundwork for supporting polymorphic typeid expressions. (Note
that this somewhat regresses our support for DR1968, but it turns out
that that never actually worked anyway, at least in non-trivial cases.)

This reinstates r360974, reverted in r360988, with a fix for a
static_assert failure on 32-bit builds: force Type base class to have
8-byte alignment like the rest of Clang's AST nodes.

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

5 years ago[Clang][Docs] Document __FILE_NAME__. NFC
Kristina Brooks [Fri, 17 May 2019 06:46:12 +0000 (06:46 +0000)]
[Clang][Docs] Document __FILE_NAME__. NFC

Document the `__FILE_NAME__` preprocessor extension.

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

5 years ago[Analysis] Only run plugins tests if plugins are actually enabled
Petr Hosek [Fri, 17 May 2019 06:07:37 +0000 (06:07 +0000)]
[Analysis] Only run plugins tests if plugins are actually enabled

When plugins aren't enabled, don't try to run plugins tests. Don't
enable plugins unconditionally based on the platform, instead check
if LLVM shared library is actually being built which may not be the
case for every host configuration, even if the host itself supports
plugins.

This addresses test failures introduced by r360891/D59464.

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

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

5 years agoRevert Refactor constant evaluation of typeid(T) to track a symbolic type_info object...
Chris Bieneman [Fri, 17 May 2019 05:46:03 +0000 (05:46 +0000)]
Revert Refactor constant evaluation of typeid(T) to track a symbolic type_info object rather than tracking the originating expression.

This reverts r360974 (git commit 7ee4307bd4450022c3c8777f43a40cc4f0ccc009)

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

5 years agoRevert [c++20] P1327R1: Support for typeid applied to objects of polymorphic class...
Chris Bieneman [Fri, 17 May 2019 05:45:57 +0000 (05:45 +0000)]
Revert [c++20] P1327R1: Support for typeid applied to objects of polymorphic class type in constant evaluation.

This reverts r360977 (git commit f51dc8d2f98f4029247552bc45ef53628ab3b6b9)

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

5 years agoRe-land: Add Clang shared library with C++ exports
Chris Bieneman [Fri, 17 May 2019 04:20:01 +0000 (04:20 +0000)]
Re-land: Add Clang shared library with C++ exports

Summary:
This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two.

This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries.

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

5 years ago[ELF] Implement Dependent Libraries Feature
Ben Dunbobbin [Fri, 17 May 2019 03:44:15 +0000 (03:44 +0000)]
[ELF] Implement Dependent Libraries Feature

This patch implements a limited form of autolinking primarily designed to allow
either the --dependent-library compiler option, or "comment lib" pragmas (
https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=vs-2017) in
C/C++ e.g. #pragma comment(lib, "foo"), to cause an ELF linker to automatically
add the specified library to the link when processing the input file generated
by the compiler.

Currently this extension is unique to LLVM and LLD. However, care has been taken
to design this feature so that it could be supported by other ELF linkers.

The design goals were to provide:

- A simple linking model for developers to reason about.
- The ability to to override autolinking from the linker command line.
- Source code compatibility, where possible, with "comment lib" pragmas in other
  environments (MSVC in particular).

Dependent library support is implemented differently for ELF platforms than on
the other platforms. Primarily this difference is that on ELF we pass the
dependent library specifiers directly to the linker without manipulating them.
This is in contrast to other platforms where they are mapped to a specific
linker option by the compiler. This difference is a result of the greater
variety of ELF linkers and the fact that ELF linkers tend to handle libraries in
a more complicated fashion than on other platforms. This forces us to defer
handling the specifiers to the linker.

In order to achieve a level of source code compatibility with other platforms
we have restricted this feature to work with libraries that meet the following
"reasonable" requirements:

1. There are no competing defined symbols in a given set of libraries, or
   if they exist, the program owner doesn't care which is linked to their
   program.
2. There may be circular dependencies between libraries.

The binary representation is a mergeable string section (SHF_MERGE,
SHF_STRINGS), called .deplibs, with custom type SHT_LLVM_DEPENDENT_LIBRARIES
(0x6fff4c04). The compiler forms this section by concatenating the arguments of
the "comment lib" pragmas and --dependent-library options in the order they are
encountered. Partial (-r, -Ur) links are handled by concatenating .deplibs
sections with the normal mergeable string section rules. As an example, #pragma
comment(lib, "foo") would result in:

.section ".deplibs","MS",@llvm_dependent_libraries,1
         .asciz "foo"

For LTO, equivalent information to the contents of a the .deplibs section can be
retrieved by the LLD for bitcode input files.

LLD processes the dependent library specifiers in the following way:

1. Dependent libraries which are found from the specifiers in .deplibs sections
   of relocatable object files are added when the linker decides to include that
   file (which could itself be in a library) in the link. Dependent libraries
   behave as if they were appended to the command line after all other options. As
   a consequence the set of dependent libraries are searched last to resolve
   symbols.
2. It is an error if a file cannot be found for a given specifier.
3. Any command line options in effect at the end of the command line parsing apply
   to the dependent libraries, e.g. --whole-archive.
4. The linker tries to add a library or relocatable object file from each of the
   strings in a .deplibs section by; first, handling the string as if it was
   specified on the command line; second, by looking for the string in each of the
   library search paths in turn; third, by looking for a lib<string>.a or
   lib<string>.so (depending on the current mode of the linker) in each of the
   library search paths.
5. A new command line option --no-dependent-libraries tells LLD to ignore the
   dependent libraries.

Rationale for the above points:

1. Adding the dependent libraries last makes the process simple to understand
   from a developers perspective. All linkers are able to implement this scheme.
2. Error-ing for libraries that are not found seems like better behavior than
   failing the link during symbol resolution.
3. It seems useful for the user to be able to apply command line options which
   will affect all of the dependent libraries. There is a potential problem of
   surprise for developers, who might not realize that these options would apply
   to these "invisible" input files; however, despite the potential for surprise,
   this is easy for developers to reason about and gives developers the control
   that they may require.
4. This algorithm takes into account all of the different ways that ELF linkers
   find input files. The different search methods are tried by the linker in most
   obvious to least obvious order.
5. I considered adding finer grained control over which dependent libraries were
   ignored (e.g. MSVC has /nodefaultlib:<library>); however, I concluded that this
   is not necessary: if finer control is required developers can fall back to using
   the command line directly.

RFC thread: http://lists.llvm.org/pipermail/llvm-dev/2019-March/131004.html.

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

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

5 years ago[c++20] P1327R1: Support for typeid applied to objects of polymorphic
Richard Smith [Fri, 17 May 2019 02:16:45 +0000 (02:16 +0000)]
[c++20] P1327R1: Support for typeid applied to objects of polymorphic
class type in constant evaluation.

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

5 years agoRefactor constant evaluation of typeid(T) to track a symbolic type_info
Richard Smith [Fri, 17 May 2019 01:46:05 +0000 (01:46 +0000)]
Refactor constant evaluation of typeid(T) to track a symbolic type_info
object rather than tracking the originating expression.

This is groundwork for supporting polymorphic typeid expressions. (Note
that this somewhat regresses our support for DR1968, but it turns out
that that never actually worked anyway, at least in non-trivial cases.)

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

5 years agoRevert r360946 "Add Clang shared library with C++ exports"
Nico Weber [Fri, 17 May 2019 01:42:37 +0000 (01:42 +0000)]
Revert r360946 "Add Clang shared library with C++ exports"

It breaks LLVM_ENABLE_PIC=OFF builds, and it's not clear
if the object library approach doesn't impact the normal
clang binary.

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

5 years agoRemove unneeded alignment spec from builtin_FUNCTION.cpp test
Eric Fiselier [Thu, 16 May 2019 23:07:45 +0000 (23:07 +0000)]
Remove unneeded alignment spec from builtin_FUNCTION.cpp test

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

5 years agoFix failing source location test on Windows
Eric Fiselier [Thu, 16 May 2019 22:21:42 +0000 (22:21 +0000)]
Fix failing source location test on Windows

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

5 years agoAdd Clang shared library with C++ exports
Chris Bieneman [Thu, 16 May 2019 22:06:07 +0000 (22:06 +0000)]
Add Clang shared library with C++ exports

Summary:
This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two.

This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries.

Reviewers: tstellar, winksaville

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years agoFix PCC test failures for source location builtins
Eric Fiselier [Thu, 16 May 2019 21:51:39 +0000 (21:51 +0000)]
Fix PCC test failures for source location builtins

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

5 years ago[clang/test] Add missing dependency on llvm-cxxfilt.
David L. Jones [Thu, 16 May 2019 21:13:59 +0000 (21:13 +0000)]
[clang/test] Add missing dependency on llvm-cxxfilt.

This tool is needed by clang/test/CodeGen/Output/ppc-mmintrin.c.

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

5 years agoReland "[Clang][PP] Add the __FILE_NAME__ builtin macro"
Kristina Brooks [Thu, 16 May 2019 21:13:49 +0000 (21:13 +0000)]
Reland "[Clang][PP] Add the __FILE_NAME__ builtin macro"

This relands commit rL360833 which caused issues on Win32
bots due to path handling/normalization differences. Now
this uses `sys::path::filename` which should handle
additional edge cases on Win32.

Original commit:

"[Clang][PP] Add the __FILE_NAME__ builtin macro"

This patch adds the __FILE_NAME__ macro that expands to the
last component of the path, similar to __FILE__ except with
a guarantee that only the last path component (without the
separator) will be rendered.

I intend to follow through with discussion of this with WG14
as a potential inclusion in the C standard or failing that,
try to discuss this with GCC developers since this extension
is desired by GCC and Clang users/developers alike.

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

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

5 years agoImplement __builtin_LINE() et. al. to support source location capture.
Eric Fiselier [Thu, 16 May 2019 21:04:15 +0000 (21:04 +0000)]
Implement __builtin_LINE() et. al. to support source location capture.

Summary:
This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation).

With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible.

Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong

Reviewed By: rsmith

Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits

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

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

5 years ago[X86] Stop implicitly enabling avx512vl when avx512bf16 is enabled.
Craig Topper [Thu, 16 May 2019 18:28:17 +0000 (18:28 +0000)]
[X86] Stop implicitly enabling avx512vl when avx512bf16 is enabled.

Previously we were doing this so that the 256 bit selectw builtin could be used in the implementation of the 512->256 bit conversion intrinsic.

After this commit we now use a masked convert builtin that will emit the intrinsic call and the 256-bit select from custom code in CGBuiltin. Then the header only needs to call that one intrinsic.

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

5 years agoUpdate comments on enums
Stephen Kelly [Thu, 16 May 2019 18:02:36 +0000 (18:02 +0000)]
Update comments on enums

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

5 years agoMove TraversalKind enum to ast_type_traits
Stephen Kelly [Thu, 16 May 2019 17:57:38 +0000 (17:57 +0000)]
Move TraversalKind enum to ast_type_traits

Summary:
Make it usable outside of ASTMatchFinder.  This will make it possible to
use this enum to control whether certain implicit nodes are skipped
while AST dumping for example.

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[X86] Update doxygen comments for AVX512BF16 to not refer to masks as 'immediates...
Craig Topper [Thu, 16 May 2019 17:34:35 +0000 (17:34 +0000)]
[X86] Update doxygen comments for AVX512BF16 to not refer to masks as 'immediates'. Refer to parameter names instead of 'src', 'src1', 'src2'. NFC

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

5 years ago[CodeComplete] Complete enumerators when preferred type is an enum
Ilya Biryukov [Thu, 16 May 2019 16:06:57 +0000 (16:06 +0000)]
[CodeComplete] Complete enumerators when preferred type is an enum

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Add a test plugin for checker option handling
Kristof Umann [Thu, 16 May 2019 15:55:07 +0000 (15:55 +0000)]
[analyzer] Add a test plugin for checker option handling

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

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

5 years agoftime-trace as a CoreOption
Alexandre Ganea [Thu, 16 May 2019 15:14:01 +0000 (15:14 +0000)]
ftime-trace as a CoreOption

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

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

5 years agoAdd AIX Version Macros
Xing Xue [Thu, 16 May 2019 14:22:37 +0000 (14:22 +0000)]
Add AIX Version Macros

Summary:
- This patch checks the AIX version and defines the appropriate macros.
- Follow up to a comment on D59048.

Author: andusy

Reviewers: hubert.reinterpretcast, jasonliu, sfertile, xingxue

Reviewed By: sfertile

Subscribers: jsji, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Handle lround/llround builtins
Adhemerval Zanella [Thu, 16 May 2019 13:43:25 +0000 (13:43 +0000)]
[clang] Handle lround/llround builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lround
and llround.  It currently only optimize for AArch64 backend.

Reviewed By: efriedma

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

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

5 years agoRecommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>
Fangrui Song [Thu, 16 May 2019 13:24:04 +0000 (13:24 +0000)]
Recommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>

r360876 didn't fix 2 call sites in clang.

Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.

Follow-up of D61781.

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

5 years agoReland "[analyzer] Add an example plugin for checker dependency handling"
Kristof Umann [Thu, 16 May 2019 13:22:04 +0000 (13:22 +0000)]
Reland "[analyzer] Add an example plugin for checker dependency handling"

Buildbots complained that they couldn't find the newly added plugins.

The solution was to move the check-clang cmake target closer to the bottom of
the file, after the new dependencies are added.

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

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

5 years agoFix isInSystemMacro in presence of macro and pasted token
Serge Guelton [Thu, 16 May 2019 12:40:00 +0000 (12:40 +0000)]
Fix isInSystemMacro in presence of macro and pasted token

When a warning is raised from the expansion of a system macro that
involves pasted token, there was still situations were they were not
skipped, as showcased by this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1472437

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

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

5 years ago[builtin] Fixed definitions of builtins that rely on the int/long long type is 32...
Karl-Johan Karlsson [Thu, 16 May 2019 07:18:02 +0000 (07:18 +0000)]
[builtin] Fixed definitions of builtins that rely on the int/long long type is 32/64 bits

Summary:
The definition of the builtins __builtin_bswap32, __builtin_bitreverse32, __builtin_rotateleft32 and __builtin_rotateright32 rely on that the int type is 32 bits wide on the target.
The defintions of the builtins __builtin_bswap64, __builtin_bitreverse64, __builtin_rotateleft64, and __builtin_rotateright64 rely on that the long long type is 64 bits wide.

On targets where this is not the case (e.g. AVR) clang will generate faulty code (wrong llvm assembler intrinsics).

This patch add support for using 'Z' (the int32_t type) in Bultins.def. The builtins above are changed to be based on the int32_t type instead of the int type, and the int64_t type instead of the long long type.

The AVR backend (experimental) have a native int type that is only 16 bits wide. The supplied testcase will therefore fail if running the testcase on trunk as clang will convert e.g. __builtin_bitreverse32 into llvm.bitreverse.i16 on AVR.

Reviewers: dylanmckay, spatel, rsmith, efriedma

Reviewed By: efriedma

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

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

5 years agoRevert r360833 until I can work out the issue with Win32 bots
Kristina Brooks [Thu, 16 May 2019 03:30:08 +0000 (03:30 +0000)]
Revert r360833 until I can work out the issue with Win32 bots

This reverts "r360833: [Clang][PP] Add the __FILE_NAME__ builtin macro."

The tests are failing on Windows bots, reverting the patchset until I can
work out why.

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

5 years agoFix assumption about Win32 paths in r360833
Kristina Brooks [Thu, 16 May 2019 02:46:12 +0000 (02:46 +0000)]
Fix assumption about Win32 paths in r360833

Attempt to fix Windows buildbots due to differences in
path handling (caused by r360833).

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

5 years agoFix regression in r360311 caused by reversed bool arguments.
Richard Smith [Thu, 16 May 2019 02:06:16 +0000 (02:06 +0000)]
Fix regression in r360311 caused by reversed bool arguments.

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

5 years ago[Clang][PP] Add the __FILE_NAME__ builtin macro.
Kristina Brooks [Thu, 16 May 2019 00:52:41 +0000 (00:52 +0000)]
[Clang][PP] Add the __FILE_NAME__ builtin macro.

This patch adds the `__FILE_NAME__` macro that expands to the
last component of the path, similar to `__FILE__` except with
a guarantee that only the last path component (without the
separator) will be rendered.

I intend to follow through with discussion of this with WG14
as a potential inclusion in the C standard or failing that,
try to discuss this with GCC developers since this extension
is desired by GCC and Clang users/developers alike.

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

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

5 years agoMake tentative parsing to detect template-argument-lists less aggressive
Richard Smith [Wed, 15 May 2019 23:36:14 +0000 (23:36 +0000)]
Make tentative parsing to detect template-argument-lists less aggressive
(and less wrong).

It's not correct to assume that X<something, Type> is always a
template-id; there are a few cases where the comma takes us into a
non-expression syntactic context in which 'Type' might be permissible.
Stop doing that.

This slightly regresses our error recovery on the cases where the
construct is intended to be a template-id. We typically do still manage
to diagnose a missing 'template' keyword, but we realize this too late
to properly recover from the error.

This fixes a regression introduced by r360308.

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

5 years ago[clang-format] Fixed self assignment
David Bolvansky [Wed, 15 May 2019 20:29:33 +0000 (20:29 +0000)]
[clang-format] Fixed self assignment

Reviewers: MyDeveloperDay, RKSimon

Reviewed By: MyDeveloperDay

Subscribers: RKSimon, cfe-commits

Tags: #clang

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

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

5 years ago[OpenMP][Bugfix] Move double and float versions of abs under c++ macro
Gheorghe-Teodor Bercea [Wed, 15 May 2019 20:28:23 +0000 (20:28 +0000)]
[OpenMP][Bugfix] Move double and float versions of abs under c++ macro

Summary:
This is a fix for the reported bug:

[[ https://bugs.llvm.org/show_bug.cgi?id=41861 | 41861 ]]

abs functions need to be moved under the c++ macro to avoid conflicts with included headers.

Reviewers: tra, jdoerfert, hfinkel, ABataev, caomhin

Reviewed By: jdoerfert

Subscribers: guansong, cfe-commits

Tags: #clang

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

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

5 years ago[c++20] For P1327R1: support dynamic_cast in constant expression
Richard Smith [Wed, 15 May 2019 20:22:21 +0000 (20:22 +0000)]
[c++20] For P1327R1: support dynamic_cast in constant expression
evaluation.

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

5 years agoRevert "[analyzer] Add a test for plugins using checker dependencies"
Kristof Umann [Wed, 15 May 2019 20:19:51 +0000 (20:19 +0000)]
Revert "[analyzer] Add a test for plugins using checker dependencies"

Buildbots don't seem to find the new plugin.

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

5 years ago[OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions
Gheorghe-Teodor Bercea [Wed, 15 May 2019 20:18:21 +0000 (20:18 +0000)]
[OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions

Summary: In OpenMP device offloading we must ensure that unde C++ 17, the inclusion of cstdlib will works correctly.

Reviewers: ABataev, tra, jdoerfert, hfinkel, caomhin

Reviewed By: jdoerfert

Subscribers: Hahnfeld, guansong, cfe-commits

Tags: #clang

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

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

5 years ago[CodeGenObjC] invoke objc_autorelease, objc_retain when necessary
Erik Pilkington [Wed, 15 May 2019 20:15:01 +0000 (20:15 +0000)]
[CodeGenObjC] invoke objc_autorelease, objc_retain when necessary

Any of these methods can be overridden, so we need to invoke these functions.

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

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

5 years ago[analyzer] Add a test for plugins using checker dependencies
Kristof Umann [Wed, 15 May 2019 19:47:26 +0000 (19:47 +0000)]
[analyzer] Add a test for plugins using checker dependencies

Also, I moved the existing analyzer plugin to test/ as well, in order not to
give the illusion that the analyzer supports plugins -- it's capable of handling
them, but does not _support_ them.

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

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

5 years ago[analyzer] RetainCount: Fix os_returns_retained_on_zero with weird return types.
Artem Dergachev [Wed, 15 May 2019 18:41:32 +0000 (18:41 +0000)]
[analyzer] RetainCount: Fix os_returns_retained_on_zero with weird return types.

The checker was crashing when it was trying to assume a structure
to be null or non-null so that to evaluate the effect of the annotation.

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

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

5 years agoTest commit
Kevin Petit [Wed, 15 May 2019 16:39:28 +0000 (16:39 +0000)]
Test commit

Remove stray space.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360783 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Use llvm::Expected and Error in the importer API
Gabor Marton [Wed, 15 May 2019 10:29:48 +0000 (10:29 +0000)]
[ASTImporter] Use llvm::Expected and Error in the importer API

Summary:
This is the final phase of the refactoring towards using llvm::Expected
and llvm::Error in the ASTImporter API.
This involves the following:
- remove old Import functions which returned with a pointer,
- use the Import_New functions (which return with Err or Expected) everywhere
  and handle their return value
- rename Import_New functions to Import
This affects both Clang and LLDB.

Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin

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

Tags: #clang, #lldb

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

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

5 years ago[analyzer] MIGChecker: Fix redundant semicolon.
Artem Dergachev [Wed, 15 May 2019 01:36:41 +0000 (01:36 +0000)]
[analyzer] MIGChecker: Fix redundant semicolon.

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

5 years ago[analyzer] MIGChecker: Add support for os_ref_retain().
Artem Dergachev [Wed, 15 May 2019 01:19:19 +0000 (01:19 +0000)]
[analyzer] MIGChecker: Add support for os_ref_retain().

Suppress MIG checker false positives that occur when the programmer increments
the reference count before calling a MIG destructor, and the MIG destructor
literally boils down to decrementing the reference count.

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

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

5 years agoFix bots by adding target triple to test.
Leonard Chan [Tue, 14 May 2019 22:37:34 +0000 (22:37 +0000)]
Fix bots by adding target triple to test.

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

5 years ago[NewPM] Port HWASan and Kernel HWASan
Leonard Chan [Tue, 14 May 2019 21:17:21 +0000 (21:17 +0000)]
[NewPM] Port HWASan and Kernel HWASan

Port hardware assisted address sanitizer to new PM following the same guidelines as msan and tsan.

Changes:
- Separate HWAddressSanitizer into a pass class and a sanitizer class.
- Create new PM wrapper pass for the sanitizer class.
- Use the getOrINsert pattern for some module level initialization declarations.
- Also enable kernel-kwasan in new PM
- Update llvm tests and add clang test.

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

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

5 years agoFix ASTMerge/namespace/test.cpp after r360701
Reid Kleckner [Tue, 14 May 2019 20:01:03 +0000 (20:01 +0000)]
Fix ASTMerge/namespace/test.cpp after r360701

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

5 years agoTemporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compress...
Eric Christopher [Tue, 14 May 2019 19:40:42 +0000 (19:40 +0000)]
Temporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)"

This affects users of older (pre 2.26) binutils in such a way that they can't necessarily
work around it as it doesn't support the compress option on the command line. Reverting
to unblock them and we can revisit whether to make this change now or fix how we want
to express the option.

This reverts commit bdb21337e6e1732c9895966449c33c408336d295/r360403.

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

5 years agoUpdate ASTMerge FileCheck test expectations
Reid Kleckner [Tue, 14 May 2019 19:02:39 +0000 (19:02 +0000)]
Update ASTMerge FileCheck test expectations

I belive many of these diagnostics changed from errors to warnings in
r357394. I've simply mechanically updated the tests, but whoever owns
this code should probably audit for unintented behavior changes. I
wasn't able to find a flag to make these warnings errors again.

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

5 years agoRestore test files accidentally deleted in r354839
Reid Kleckner [Tue, 14 May 2019 18:51:07 +0000 (18:51 +0000)]
Restore test files accidentally deleted in r354839

I think there must be a bug in git-llvm causing parent directories to be
deleted when the diff deletes files in a subdirectory. Perhaps it is
Windows-only.

There has been a behavior change, so some of these tests now fail. I
have marked them XFAIL and will fix them in a follow-up to separate the
changes.

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

5 years ago[Sema] CodeSynthesisContext - add missing variable initialization to constructor...
Simon Pilgrim [Tue, 14 May 2019 14:58:47 +0000 (14:58 +0000)]
[Sema] CodeSynthesisContext - add missing variable initialization to constructor. NFCI.

SavedInNonInstantiationSFINAEContext isn't used outside of specific contexts but this fixes cppcheck and scan-build warnings.

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