Richard Smith [Mon, 8 Jul 2019 19:45:46 +0000 (19:45 +0000)]
Add missing declarations of explicit member specializations.
This should fix the build under -Wundefined-func-template and certain
versions of GCC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365377
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 8 Jul 2019 19:21:54 +0000 (19:21 +0000)]
[OPENMP]Improve error message for device unsupported types.
Provide more data to the user in the error message about unsupported
type for device compilation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365374
91177308-0d34-0410-b5e6-
96231b3b80d8
Amy Huang [Mon, 8 Jul 2019 17:35:28 +0000 (17:35 +0000)]
Replace temporary variable matches in test since r363952 causes an
extra temporary variable to be created.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365357
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Mon, 8 Jul 2019 17:25:02 +0000 (17:25 +0000)]
[Syntax] Introduce syntax trees
Summary:
A tooling-focused alternative to the AST. This commit focuses on the
memory-management strategy and the structure of the AST.
More to follow later:
- Operations to mutate the syntax trees and corresponding textual
replacements.
- Mapping between clang AST nodes and syntax tree nodes.
- More node types corresponding to the language constructs.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: llvm-commits, mgorny, cfe-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D61637
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365355
91177308-0d34-0410-b5e6-
96231b3b80d8
Brian Homerding [Mon, 8 Jul 2019 16:24:10 +0000 (16:24 +0000)]
Add nofree attribute to CodeGenOpenCL/convergent.cl test
The revision at https://reviews.llvm.org/rL365336 added inference of the nofree
attribute. This revision updates the test to reflect this.
Differential Revision: https://reviews.llvm.org/D49165
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365341
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 8 Jul 2019 15:45:24 +0000 (15:45 +0000)]
[OPENMP]Add -Wunintialized to the erroneous tests for future fix PR42392,
NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365334
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Mon, 8 Jul 2019 15:25:16 +0000 (15:25 +0000)]
[clangd] A code tweak to expand a macro
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61681
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365331
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Bradbury [Mon, 8 Jul 2019 15:07:12 +0000 (15:07 +0000)]
[RISCV][NFC] Make use of Triple::isRISCV
Use new helper introduced in rL365327.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365329
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Mon, 8 Jul 2019 12:49:13 +0000 (12:49 +0000)]
[ASTImporter] Fix import of lambda in function param
Summary:
The current import implementation fails to import the definition of a
lambda class if the lambda class is defined in a function param.
E.g., the lambda class below will be imported without any methods:
```
template <typename F>
void f(F L = [](){}) {}
```
Reviewers: a_sidorin, a.sidorin, shafik
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64073
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365315
91177308-0d34-0410-b5e6-
96231b3b80d8
Endre Fulop [Mon, 8 Jul 2019 12:37:10 +0000 (12:37 +0000)]
[analyzer] Add analyzer option to limit the number of imported TUs
Summary:
During CTU analysis of complex projects, the loaded AST-contents of
imported TUs can grow bigger than available system memory. This option
introduces a threshold on the number of TUs to be imported for a single
TU in order to prevent such cases.
Differential Revision: https://reviews.llvm.org/D59798
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365314
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Bradbury [Mon, 8 Jul 2019 09:38:06 +0000 (09:38 +0000)]
[RISCV] Specify registers used for exception handling
Implements the handling of __builtin_eh_return_regno().
Differential Revision: https://reviews.llvm.org/D63417
Patch by Edward Jones.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365305
91177308-0d34-0410-b5e6-
96231b3b80d8
Diogo N. Sampaio [Mon, 8 Jul 2019 08:47:47 +0000 (08:47 +0000)]
[AArch64] Fix scalar vuqadd intrinsics operands
Summary:
Change the vuqadd scalar instrinsics to have the second argument as unsigned values, not signed,
accordingly to https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics
So now the compiler correctly warns that a undefined negative float conversion is being done.
Reviewers: LukeCheeseman, john.brawn
Reviewed By: john.brawn
Subscribers: john.brawn, javed.absar, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64242
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365300
91177308-0d34-0410-b5e6-
96231b3b80d8
Diogo N. Sampaio [Mon, 8 Jul 2019 08:35:05 +0000 (08:35 +0000)]
[AArch64] Fix vsqadd scalar intrinsics operands
Summary:
Change the vsqadd scalar instrinsics to have the second argument as signed values, not unsigned,
accordingly to https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics
The existing unsigned argument can cause faulty code as negative float to unsigned conversion is
undefined, which llvm/clang optimizes away.
Reviewers: LukeCheeseman, john.brawn
Reviewed By: john.brawn
Subscribers: john.brawn, javed.absar, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64239
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365298
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sat, 6 Jul 2019 21:05:52 +0000 (21:05 +0000)]
Treat the range of representable values of floating-point types as [-inf, +inf] not as [-max, +max].
Summary:
Prior to r329065, we used [-max, max] as the range of representable
values because LLVM's `fptrunc` did not guarantee defined behavior when
truncating from a larger floating-point type to a smaller one. Now that
has been fixed, we can make clang follow normal IEEE 754 semantics in this
regard and take the larger range [-inf, +inf] as the range of representable
values.
In practice, this affects two parts of the frontend:
* the constant evaluator no longer treats floating-point evaluations
that result in +-inf as being undefined (because they no longer leave
the range of representable values of the type)
* UBSan no longer treats conversions to floating-point type that are
outside the [-max, +max] range as being undefined
In passing, also remove the float-divide-by-zero sanitizer from
-fsanitize=undefined, on the basis that while it's undefined per C++
rules (and we disallow it in constant expressions for that reason), it
is defined by Clang / LLVM / IEEE 754.
Reviewers: rnk, BillyONeal
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63793
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365272
91177308-0d34-0410-b5e6-
96231b3b80d8
Joel E. Denny [Sat, 6 Jul 2019 16:28:32 +0000 (16:28 +0000)]
[Rewrite] Try to fix buildbot link fail left by r365263
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/10272
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365264
91177308-0d34-0410-b5e6-
96231b3b80d8
Joel E. Denny [Sat, 6 Jul 2019 13:44:57 +0000 (13:44 +0000)]
[Rewrite] Try to fix buildbot link fail caused by r365258
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/10270
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365263
91177308-0d34-0410-b5e6-
96231b3b80d8
Joel E. Denny [Sat, 6 Jul 2019 02:55:06 +0000 (02:55 +0000)]
[Rewrite] Extend to further accept CharSourceRange
Some Rewrite functions are already overloaded to accept
CharSourceRange, and this extends others in the same manner. I'm
calling these in code that's not ready to upstream, but I figure they
might be useful to others in the meantime.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D61467
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365258
91177308-0d34-0410-b5e6-
96231b3b80d8
Mike Spertus [Fri, 5 Jul 2019 21:41:30 +0000 (21:41 +0000)]
Improve MSVC visualization of annot_template_id tokens
Now shows the actual annotated template. E.g.,
{annot_template_id (A<int, double>)}
Also a few miscellaneous fixes to visualizers of other types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365248
91177308-0d34-0410-b5e6-
96231b3b80d8
Bjorn Pettersson [Fri, 5 Jul 2019 20:22:40 +0000 (20:22 +0000)]
Bitstream reader: Fix undefined behavior seen after rL364464
Summary:
After rL364464 the following tests started to fail when
running the clang-doc tests with an ubsan instrumented
build of clang-doc:
Clang Tools :: clang-doc/single-file-public.cpp
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/BitcodeTest.emitEnumInfoBitcode
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/BitcodeTest.emitMethodInfoBitcode
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/BitcodeTest.emitRecordInfoBitcode
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/SerializeTest.emitInfoWithCommentBitcode
We need to check that the read value is in range for being
casted to the llvm::bitc::FixedAbbrevIDs enum, before the
cast in ClangDocBitcodeReader::skipUntilRecordOrBlock.
SerializedDiagnosticReader::skipUntilRecordOrBlock was updated
in the same way.
Reviewers: jfb
Reviewed By: jfb
Subscribers: Bigcheese, vsapsai, bruno, ilya-biryukov, dexonsmith, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64262
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365239
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Fri, 5 Jul 2019 15:12:31 +0000 (15:12 +0000)]
Add a comment explaining why a function exists
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365212
91177308-0d34-0410-b5e6-
96231b3b80d8
Hamza Sood [Fri, 5 Jul 2019 14:36:08 +0000 (14:36 +0000)]
NFC: Add an explicit return for safety and consistency
This case implicitly falls-through, which is fine now as it's at the end of the
function, but it seems like an accident waiting to happen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365210
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 14:22:10 +0000 (14:22 +0000)]
Removed the test case added in D63538 due to windows buildbot failures
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365209
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 14:00:08 +0000 (14:00 +0000)]
[analyzer] Add a debug analyzer config to place an event for each tracked condition
Differential Revision: https://reviews.llvm.org/D63642
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365208
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 13:29:54 +0000 (13:29 +0000)]
[analyzer] Track terminator conditions on which a tracked expression depends
This patch is a major part of my GSoC project, aimed to improve the bug
reports of the analyzer.
TL;DR: Help the analyzer understand that some conditions are important,
and should be explained better. If an CFGBlock is a control dependency
of a block where an expression value is tracked, explain the condition
expression better by tracking it.
if (A) // let's explain why we believe A to be true
10 / x; // division by zero
This is an experimental feature, and can be enabled by the
off-by-default analyzer configuration "track-conditions".
In detail:
This idea was inspired by the program slicing algorithm. Essentially,
two things are used to produce a program slice (a subset of the program
relevant to a (statement, variable) pair): data and control
dependencies. The bug path (the linear path in the ExplodedGraph that leads
from the beginning of the analysis to the error node) enables to
analyzer to argue about data dependencies with relative ease.
Control dependencies are a different slice of the cake entirely.
Just because we reached a branch during symbolic execution, it
doesn't mean that that particular branch has any effect on whether the
bug would've occured. This means that we can't simply rely on the bug
path to gather control dependencies.
In previous patches, LLVM's IDFCalculator, which works on a control flow
graph rather than the ExplodedGraph was generalized to solve this issue.
We use this information to heuristically guess that the value of a tracked
expression depends greatly on it's control dependencies, and start
tracking them as well.
After plenty of evaluations this was seen as great idea, but still
lacking refinements (we should have different descriptions about a
conditions value), hence it's off-by-default.
Differential Revision: https://reviews.llvm.org/D62883
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365207
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 12:17:44 +0000 (12:17 +0000)]
[analyzer][IDF] Add a control dependency calculator + a new debug checker
I intend to improve the analyzer's bug reports by tracking condition
expressions.
01 bool b = messyComputation();
02 int i = 0;
03 if (b) // control dependency of the bug site, let's explain why we assume val
04 // to be true
05 10 / i; // warn: division by zero
I'll detail this heuristic in the followup patch, strictly related to this one
however:
* Create the new ControlDependencyCalculator class that uses llvm::IDFCalculator
to (lazily) calculate control dependencies for Clang's CFG.
* A new debug checker debug.DumpControlDependencies is added for lit tests
* Add unittests
Differential Revision: https://reviews.llvm.org/D62619
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365197
91177308-0d34-0410-b5e6-
96231b3b80d8
Endre Fulop [Fri, 5 Jul 2019 12:00:52 +0000 (12:00 +0000)]
[NFC] Test commit access
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365189
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Fri, 5 Jul 2019 11:45:24 +0000 (11:45 +0000)]
Make joined instances of JoinedOrSeparate flags point to the unaliased args, like all other arg types do
This fixes an 8-year-old regression. r105763 made it so that aliases
always refer to the unaliased option – but it missed the "joined" branch
of JoinedOrSeparate flags. (r162231 then made the Args classes
non-virtual, and r169344 moved them from clang to llvm.)
Back then, there was no JoinedOrSeparate flag that was an alias, so it
wasn't observable. Now /U in CLCompatOptions is a JoinedOrSeparate alias
in clang, and warn_slash_u_filename incorrectly used the aliased arg id
(using the unaliased one isn't really a regression since that warning
checks if the undefined macro contains slash or backslash and only then
emits the warning – and no valid use will pass "-Ufoo/bar" or similar).
Also, lld has many JoinedOrSeparate aliases, and due to this bug it had
to explicitly call `getUnaliasedOption()` in a bunch of places, even
though that shouldn't be necessary by design. After this fix in Option,
these calls really don't have an effect any more, so remove them.
No intended behavior change.
(I accidentally fixed this bug while working on PR29106 but then
wondered why the warn_slash_u_filename broke. When I figured it out, I
thought it would make sense to land this in a separate commit.)
Differential Revision: https://reviews.llvm.org/D64156
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365186
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 11:14:57 +0000 (11:14 +0000)]
Fix a buildbot failure due to the AST's lifetime ending before the test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365181
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 10:16:36 +0000 (10:16 +0000)]
[analyzer][Dominators][NFC] Add unit tests
Differential Revision: https://reviews.llvm.org/D62611
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365179
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Fri, 5 Jul 2019 09:52:00 +0000 (09:52 +0000)]
[CFG] Add a new function to get the proper condition of a CFGBlock
getTerminatorCondition() returned a condition that may be outside of the
block, while the new function returns the proper one:
if (A && B && C) {}
Return C instead of A && B && C.
Differential Revision: https://reviews.llvm.org/D63538
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365177
91177308-0d34-0410-b5e6-
96231b3b80d8
Mikael Holmen [Fri, 5 Jul 2019 06:12:24 +0000 (06:12 +0000)]
Silence gcc warning "control reaches end of non-void function" [NFCI]
Without this fix gcc (7.4) complains with
/data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp: In member function 'std::__cxx11::string {anonymous}::CGObjCCommonMac::GetSectionName(llvm::StringRef, llvm::StringRef)':
/data/repo/master/clang/lib/CodeGen/CGObjCMac.cpp:4944:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
All values in the ObjectFormatType enum are currently handled in the switch
but gcc complains anyway.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365174
91177308-0d34-0410-b5e6-
96231b3b80d8
Hubert Tong [Thu, 4 Jul 2019 21:40:28 +0000 (21:40 +0000)]
[NFC] Make some ObjectFormatType switches covering
Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
are then added.
For `UnknownObjectFormat`, the action (`llvm_unreachable`) for the
`default` case is kept.
For the other unhandled cases, `report_fatal_error` is used instead.
Reviewers: sfertile, jasonliu, daltenty
Reviewed By: sfertile
Subscribers: wuzish, aheejin, jsji, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D63767
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365160
91177308-0d34-0410-b5e6-
96231b3b80d8
Vassil Vassilev [Thu, 4 Jul 2019 19:06:52 +0000 (19:06 +0000)]
[modules] Add PP callbacks for entering and leaving a submodule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365153
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Thu, 4 Jul 2019 11:39:00 +0000 (11:39 +0000)]
[CTU] Add support for virtual functions
Reviewers: Szelethus, xazax.hun
Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63920
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365133
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Thu, 4 Jul 2019 10:28:31 +0000 (10:28 +0000)]
Fix -Wdocumentation warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365126
91177308-0d34-0410-b5e6-
96231b3b80d8
Fangrui Song [Thu, 4 Jul 2019 04:44:42 +0000 (04:44 +0000)]
[PowerPC] Support constraint code "ww"
Summary:
"ww" and "ws" are both constraint codes for VSX vector registers that
hold scalar double data. "ww" is preferred for float while "ws" is
preferred for double.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D64119
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365106
91177308-0d34-0410-b5e6-
96231b3b80d8
Csaba Dabis [Thu, 4 Jul 2019 00:50:50 +0000 (00:50 +0000)]
[analyzer] ReturnValueChecker: Model the guaranteed boolean return value of function calls
Summary: It models the known LLVM methods paired with their class.
Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus
Reviewed By: NoQ
Subscribers: dschuff, aheejin, mgorny, szepet, rnkovacs, a.sidorin,
mikhail.ramalho, donat.nagy, dkrupp, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63915
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365103
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Wed, 3 Jul 2019 22:45:55 +0000 (22:45 +0000)]
cmake: Add CLANG_LINK_CLANG_DYLIB option
Summary:
Setting CLANG_LINK_CLANG_DYLIB=ON causes clang tools to link against
libclang_shared.so instead of the individual component libraries.
Reviewers: mgorny, beanz, smeenai, phosek, sylvestre.ledru
Subscribers: arphaman, cfe-commits, llvm-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63503
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365092
91177308-0d34-0410-b5e6-
96231b3b80d8
Francis Visoiu Mistrih [Wed, 3 Jul 2019 22:40:07 +0000 (22:40 +0000)]
[Bitcode] Move Bitstream to a separate library
This moves Bitcode/Bitstream*, Bitcode/BitCodes.h to Bitstream/.
This is needed to avoid a circular dependency when using the bitstream
code for parsing optimization remarks.
Since Bitcode uses Core for the IR part:
libLLVMRemarks -> Bitcode -> Core
and Core uses libLLVMRemarks to generate remarks (see
IR/RemarkStreamer.cpp):
Core -> libLLVMRemarks
we need to separate the Bitstream and Bitcode part.
For clang-doc, it seems that it doesn't need the whole bitcode layer, so
I updated the CMake to only use the bitstream part.
Differential Revision: https://reviews.llvm.org/D63899
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365091
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 3 Jul 2019 20:48:23 +0000 (20:48 +0000)]
[analyzer] exploded-graph-rewriter: Implement a black-and-white color scheme.
For accessibility!
Differential Revision: https://reviews.llvm.org/D64153
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365085
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Wed, 3 Jul 2019 18:01:32 +0000 (18:01 +0000)]
[clang-scan-deps] use `-Wno-error` when scanning for dependencies
Warnings can be promoted to errors.
But that shouldn't prevent us from getting the dependencies!
Differential Revision: https://reviews.llvm.org/D64149
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365065
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Wed, 3 Jul 2019 13:03:33 +0000 (13:03 +0000)]
Revert "[analyzer][CFG] Return the correct terminator condition"
This reverts commit
7a57118a6fcfa3770f984453543bbdfd0b233e84.
Causes a bunch of crashes, I need to time to evaluate this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365037
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Wed, 3 Jul 2019 12:53:19 +0000 (12:53 +0000)]
[analyzer][CFG] Return the correct terminator condition
For the following terminator statement:
if (A && B && C && D)
The built CFG is the following:
[B5 (ENTRY)]
Succs (1): B4
[B1]
1: 10
2: j
3: [B1.2] (ImplicitCastExpr, LValueToRValue, int)
4: [B1.1] / [B1.3]
5: int x = 10 / j;
Preds (1): B2
Succs (1): B0
[B2]
1: C
2: [B2.1] (ImplicitCastExpr, LValueToRValue, _Bool)
T: if [B4.4] && [B3.2] && [B2.2]
Preds (1): B3
Succs (2): B1 B0
[B3]
1: B
2: [B3.1] (ImplicitCastExpr, LValueToRValue, _Bool)
T: [B4.4] && [B3.2] && ...
Preds (1): B4
Succs (2): B2 B0
[B4]
1: 0
2: int j = 0;
3: A
4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
T: [B4.4] && ...
Preds (1): B5
Succs (2): B3 B0
[B0 (EXIT)]
Preds (4): B1 B2 B3 B4
However, even though the path of execution in B2 only depends on C's value,
CFGBlock::getCondition() would return the entire condition (A && B && C). For
B3, it would return A && B. I changed this the actual condition.
Differential Revision: https://reviews.llvm.org/D63538
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365036
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Wed, 3 Jul 2019 12:20:28 +0000 (12:20 +0000)]
Fix -Wcast-qual const warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365031
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Wed, 3 Jul 2019 12:06:10 +0000 (12:06 +0000)]
Make a buildbot using a buggy gcc happy
When specializing a template in a namespace, it has to be in a namespace
block, else gcc will get confused. Hopefully this fixes the issue.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365030
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Wed, 3 Jul 2019 11:54:47 +0000 (11:54 +0000)]
Specialize an anchor() function in the correct namespace
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365029
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Wed, 3 Jul 2019 11:39:12 +0000 (11:39 +0000)]
[analyzer][Dominator] Add post dominators to CFG + a new debug checker
Transform clang::DominatorTree to be able to also calculate post dominators.
* Tidy up the documentation
* Make it clang::DominatorTree template class (similarly to how
llvm::DominatorTreeBase works), rename it to clang::CFGDominatorTreeImpl
* Clang's dominator tree is now called clang::CFGDomTree
* Clang's brand new post dominator tree is called clang::CFGPostDomTree
* Add a lot of asserts to the dump() function
* Create a new checker to test the functionality
Differential Revision: https://reviews.llvm.org/D62551
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365028
91177308-0d34-0410-b5e6-
96231b3b80d8
Kristof Umann [Wed, 3 Jul 2019 11:14:42 +0000 (11:14 +0000)]
[Dominators] PR42041: Skip nullpointer successors
https://bugs.llvm.org/show_bug.cgi?id=42041
In Clang's CFG, we use nullpointers to represent unreachable nodes, for
example, in the included testfile, block B0 is unreachable from block
B1, resulting in a nullpointer dereference somewhere in
llvm::DominatorTreeBase<clang::CFGBlock, false>::recalculate.
This patch fixes this issue by specializing
llvm::DomTreeBuilder::SemiNCAInfo::ChildrenGetter::Get for
clang::CFG to not contain nullpointer successors.
Differential Revision: https://reviews.llvm.org/D62507
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365026
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Wed, 3 Jul 2019 10:26:28 +0000 (10:26 +0000)]
Fix MSVC "signed/unsigned mismatch" warning. NFCI.
Fixes PR42426.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365019
91177308-0d34-0410-b5e6-
96231b3b80d8
Ivan Donchevskii [Wed, 3 Jul 2019 10:21:50 +0000 (10:21 +0000)]
[clang-tidy] Fix the YAML created for checks like modernize-pass-by-value
Currently this check generates the replacement with the newline in the end.
The proper way to export it to YAML is to have two \n\n instead of one.
Without this fix clients should reinterpret the replacement as
"#include <utility> " instead of "#include <utility>\n"
Differential Revision: https://reviews.llvm.org/D63482
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365017
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Wed, 3 Jul 2019 09:54:25 +0000 (09:54 +0000)]
Fix MSVC "not all control paths return a value" warnings. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365012
91177308-0d34-0410-b5e6-
96231b3b80d8
Fangrui Song [Wed, 3 Jul 2019 08:13:17 +0000 (08:13 +0000)]
Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or llvm::partition_point. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365006
91177308-0d34-0410-b5e6-
96231b3b80d8
Kadir Cetinkaya [Wed, 3 Jul 2019 07:47:19 +0000 (07:47 +0000)]
[clang][HeaderSearch] Shorten paths for includes in mainfile's directory
Summary:
Currently HeaderSearch only looks at SearchDir's passed into it, but in
addition to those paths headers can be relative to including file's directory.
This patch makes sure that is taken into account.
Reviewers: gribozavr
Subscribers: jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63295
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365005
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 3 Jul 2019 01:26:41 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: Implement bug nodes and sink nodes.
Add a label to nodes that have a bug report attached or on which
the analysis was generally interrupted.
Fix printing has_report and implement printing is_sink in the graph dumper.
Differential Revision: https://reviews.llvm.org/D64110
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364992
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 3 Jul 2019 01:26:38 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Add more comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364991
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 3 Jul 2019 01:26:35 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: Collapse very long statement pretty-prints.
When printing various statements that include braces (compound
statements, lambda expressions, statement-expressions, etc.),
replace the code between braces with '...'.
Differential Revision: https://reviews.llvm.org/D64104
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364990
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 3 Jul 2019 01:26:32 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: Implement checker messages.
They are displayed as raw lines and diffed via difflib on a per-checker basis.
Differential Revision: https://reviews.llvm.org/D64100
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364989
91177308-0d34-0410-b5e6-
96231b3b80d8
Erik Pilkington [Tue, 2 Jul 2019 18:28:13 +0000 (18:28 +0000)]
[C++2a] Add __builtin_bit_cast, used to implement std::bit_cast
This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a
bit_cast from a value v to a type T. This expression can be evaluated at
compile time under specific circumstances.
The compile time evaluation currently doesn't support bit-fields, but I'm
planning on fixing this in a follow up (some of the logic for figuring this out
is in CodeGen). I'm also planning follow-ups for supporting some more esoteric
types that the constexpr evaluator supports, as well as extending
__builtin_memcpy constexpr evaluation to use the same infrastructure.
rdar://
44987528
Differential revision: https://reviews.llvm.org/D62825
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364954
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam McCall [Tue, 2 Jul 2019 15:53:14 +0000 (15:53 +0000)]
clang-format: Add new style option AlignConsecutiveMacros
This option behaves similarly to AlignConsecutiveDeclarations and
AlignConsecutiveAssignments, aligning the assignment of C/C++
preprocessor macros on consecutive lines.
I've worked in many projects (embedded, mostly) where header files full
of large, well-aligned "#define" blocks are a common pattern. We
normally avoid using clang-format on these files, since it ruins any
existing alignment in said blocks. This style option will align "simple"
PP macros (no parameters) and PP macros with parameter lists on
consecutive lines.
Related Bugzilla entry (thanks mcuddie):
https://llvm.org/bugs/show_bug.cgi?id=20637
Patch by Nick Renieris (VelocityRa)!
Differential Revision: https://reviews.llvm.org/D28462
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364938
91177308-0d34-0410-b5e6-
96231b3b80d8
Yitzhak Mandelbaum [Tue, 2 Jul 2019 13:11:04 +0000 (13:11 +0000)]
[LibTooling] Extend `RewriteRule` with support for adding includes.
Summary:
This revision allows users to specify the insertion of an included directive (at
the top of the file being rewritten) as part of a rewrite rule. These
directives are bundled with `RewriteRule` cases, so that different cases can
potentially result in different include actions.
Reviewers: ilya-biryukov, gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63892
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364917
91177308-0d34-0410-b5e6-
96231b3b80d8
Kadir Cetinkaya [Tue, 2 Jul 2019 10:45:53 +0000 (10:45 +0000)]
[clang][ArgumentAdjusters] Do not add fsyntax-only if already exists
Reviewers: hokein
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64063
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364904
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Tue, 2 Jul 2019 10:22:11 +0000 (10:22 +0000)]
clang-cl: Make /d1reportAllClassLayout actually work and improve test
See review thread for r301567.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364901
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexandros Lamprineas [Tue, 2 Jul 2019 09:45:24 +0000 (09:45 +0000)]
[clang][Driver][ARM] NFC: Remove unused function parameter
Removes a vector reference that was added by D62998, since the
preexisting function parameter is sufficient.
Differential Revision: https://reviews.llvm.org/D64044
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364895
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Tue, 2 Jul 2019 08:01:41 +0000 (08:01 +0000)]
[ASTImporter] Make headers self-contained
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364891
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Tue, 2 Jul 2019 07:36:39 +0000 (07:36 +0000)]
[ASTImporter] Structural eq: handle DependentScopeDeclRefExpr
Summary:
Structural equivalence did not handle dependent template args properly
when the arg contained a DependentScopeDeclRefExpr.
Reviewers: a_sidorin, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62329
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364889
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Tue, 2 Jul 2019 02:17:56 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Implement a dark color scheme.
Addresses a popular request. Activated via --dark.
Differential Revision: https://reviews.llvm.org/D64056
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364882
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Tue, 2 Jul 2019 02:17:53 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Improve program point dumps.
- Take advantage of the stmt_point_kind.
- Dump block IDs for BlockEntrance nodes.
- Don't dump huge compound statements on PurgeDeadSymbols nodes.
- Rename Edge to BlockEdge for consistency.
- Tweak colors.
Differential Revision: https://reviews.llvm.org/D64051
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364881
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Tue, 2 Jul 2019 02:17:50 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Add support for objects under construction.
This trait is Environment-like, so there was a chance to re-use a lot of code.
Differential Revision: https://reviews.llvm.org/D64047
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364880
91177308-0d34-0410-b5e6-
96231b3b80d8
Nathan Huckleberry [Mon, 1 Jul 2019 23:29:10 +0000 (23:29 +0000)]
[analyzer] Support kfree in MallocChecker
Summary:
kmalloc is freed with kfree in the linux kernel. kmalloc support was
added in r204832, but kfree was not. Adding kfree fixes incorrectly
detected memory leaks.
Reviewers: NoQ, nickdesaulniers, dcoughlin, Szelethus
Reviewed By: NoQ, Szelethus
Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64030
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364875
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:06:08 +0000 (23:06 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Add a forgotten test file.
This fell off of r364865.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364871
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:02:18 +0000 (23:02 +0000)]
[analyzer] Fix invalidation when returning into a ctor initializer.
Due to RVO the target region of a function that returns an object by
value isn't necessarily a temporary object region; it may be an
arbitrary memory region. In particular, it may be a field of a bigger
object.
Make sure we don't invalidate the bigger object when said function is
evaluated conservatively.
Differential Revision: https://reviews.llvm.org/D63968
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364870
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:02:14 +0000 (23:02 +0000)]
[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.
The NonnullGlobalConstants checker models the rule "it doesn't make sense
to make a constant global pointer and initialize it to null"; it makes sure
that whatever it's initialized with is known to be non-null.
Ironically, annotating the type of the pointer as _Nonnull breaks the checker.
Fix handling of the _Nonnull annotation so that it was instead one more reason
to believe that the value is non-null.
Differential Revision: https://reviews.llvm.org/D63956
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364869
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:02:10 +0000 (23:02 +0000)]
[analyzer] CStringChecker: Modernize to use CallDescriptions.
This patch uses the new CDF_MaybeBuiltin flag to handle C library functions.
It's mostly an NFC/refactoring pass, but it does fix a bug in handling memset()
when it expands to __builtin___memset_chk() because the latter has
one more argument and memset() handling code was trying to match
the exact number of arguments. Now the code is deduplicated and there's
less room for mistakes.
Differential Revision: https://reviews.llvm.org/D62557
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364868
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:02:07 +0000 (23:02 +0000)]
[analyzer] NFC: CallDescription: Implement describing C library functions.
When matching C standard library functions in the checker, it's easy to forget
that they are often implemented as macros that are expanded to builtins.
Such builtins would have a different name, so matching the callee identifier
would fail, or may sometimes have more arguments than expected, so matching
the exact number of arguments would fail, but this is fine as long as we have
all the arguments that we need in their respective places.
This patch adds a set of flags to the CallDescription class so that to handle
various special matching rules, and adds the first flag into this set,
which enables a more fuzzy matching for functions that
may be implemented as compiler builtins.
Differential Revision: https://reviews.llvm.org/D62556
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364867
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:02:03 +0000 (23:02 +0000)]
[analyzer] NFC: Add a convenient CallDescriptionMap class.
It encapsulates the procedure of figuring out whether a call event
corresponds to a function that's modeled by a checker.
Checker developers no longer need to worry about performance of
lookups into their own custom maps.
Add unittests - which finally test CallDescription itself as well.
Differential Revision: https://reviews.llvm.org/D62441
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364866
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:01:59 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Add support for dynamic types.
Slightly cleanup emission of horizontal lines and unhardcode the title
for generic maps.
Differential Revision: https://reviews.llvm.org/D64041
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364865
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 1 Jul 2019 23:01:55 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Implement program point tags.
Keep them on a separate line for more visibility.
Differential Revision: https://reviews.llvm.org/D63965
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364864
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Mon, 1 Jul 2019 21:57:31 +0000 (21:57 +0000)]
Fix breakage introduced by D60974
D60974 added tests which incorrectly assume that llvm-readelf is available. This is a bad assumption, it should instead declare the dependency explicitly in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364855
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Kornienko [Mon, 1 Jul 2019 18:55:10 +0000 (18:55 +0000)]
Fixed two issues in clang-tidy -help.
HeaderFilter -> HeaderFilterRegex
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364837
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 1 Jul 2019 17:46:52 +0000 (17:46 +0000)]
[OPENMP]Fix handling of lambda captures in target regions.
Previously, lambda captures were processed in the function called during
capturing the variables. It leads to the recursive functions calls and
may result in the compiler crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364820
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Mon, 1 Jul 2019 15:37:07 +0000 (15:37 +0000)]
[ASTImporter] Mark erroneous nodes in shared st
Summary:
Now we store the errors for the Decls in the "to" context too. For
that, however, we have to put these errors in a shared state (among all
the ASTImporter objects which handle the same "to" context but different
"from" contexts).
After a series of imports from different "from" TUs we have a "to" context
which may have erroneous nodes in it. (Remember, the AST is immutable so
there is no way to delete a node once we had created it and we realized
the error later.) All these erroneous nodes are marked in
ASTImporterSharedState::ImportErrors. Clients of the ASTImporter may
use this as an input. E.g. the static analyzer engine may not try to
analyze a function if that is marked as erroneous (it can be queried via
ASTImporterSharedState::getImportDeclErrorIfAny()).
Reviewers: a_sidorin, a.sidorin, shafik
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62376
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364785
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam Elliott [Mon, 1 Jul 2019 14:53:56 +0000 (14:53 +0000)]
[RISCV] Avoid save-restore target feature warning
Summary:
LLVM issues a warning if passed unknown target features. Neither I nor
@asb noticed this until after https://reviews.llvm.org/D63498 landed.
This patch stops passing the (unknown) "save-restore" target feature to
the LLVM backend, but continues to emit a warning if a driver asks for
`-msave-restore`. The default of assuming `-mno-save-restore` (and
emitting no warnings) remains.
Reviewers: asb
Reviewed By: asb
Subscribers: rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, cfe-commits, asb
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64008
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364777
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Mon, 1 Jul 2019 14:33:26 +0000 (14:33 +0000)]
[ASTImporter] Silence unused variable warning in Release builds. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364774
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Mon, 1 Jul 2019 14:19:53 +0000 (14:19 +0000)]
[ASTImporter] Mark erroneous nodes in from ctx
Summary:
During import of a specific Decl D, it may happen that some AST nodes
had already been created before we recognize an error. In this case we
signal back the error to the caller, but the "to" context remains
polluted with those nodes which had been created. Ideally, those nodes
should not had been created, but that time we did not know about the
error, the error happened later. Since the AST is immutable (most of
the cases we can't remove existing nodes) we choose to mark these nodes
as erroneous.
Here are the steps of the algorithm:
1) We keep track of the nodes which we visit during the import of D: See
ImportPathTy.
2) If a Decl is already imported and it is already on the import path
(we have a cycle) then we copy/store the relevant part of the import
path. We store these cycles for each Decl.
3) When we recognize an error during the import of D then we set up this
error to all Decls in the stored cycles for D and we clear the stored
cycles.
Reviewers: a_sidorin, a.sidorin, shafik
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D62375
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364771
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Mon, 1 Jul 2019 12:44:39 +0000 (12:44 +0000)]
[ASTImporter] Propagate error from ImportDeclContext
Summary:
During analysis of one project we failed to import one
CXXDestructorDecl. But since we did not propagate the error in
importDeclContext we had a CXXRecordDecl without a destructor. Then the
analyzer engine had a CallEvent where the nonexistent dtor was requested
(crash).
Solution is to propagate the errors we have during importing a
DeclContext.
Reviewers: a_sidorin, a.sidorin, shafik
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63603
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364752
91177308-0d34-0410-b5e6-
96231b3b80d8
Mike Spertus [Sun, 30 Jun 2019 22:04:25 +0000 (22:04 +0000)]
Various tweaks to MSVC natvis visualizers
Make more consistent use of na format.
Improve visualization of deduction guides.
Add visualizer for explicit specifier (including conditionally explicit)
Fix some typos
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364724
91177308-0d34-0410-b5e6-
96231b3b80d8
Fangrui Song [Sun, 30 Jun 2019 11:19:56 +0000 (11:19 +0000)]
Cleanup: llvm::bsearch -> llvm::partition_point after r364719
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364720
91177308-0d34-0410-b5e6-
96231b3b80d8
Fangrui Song [Sat, 29 Jun 2019 01:24:36 +0000 (01:24 +0000)]
[Driver] Fix style issues of --print-supported-cpus after D63105
Reviewed By: ziangwan
Differential Revision: https://reviews.llvm.org/D63822
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364704
91177308-0d34-0410-b5e6-
96231b3b80d8
Leonard Chan [Sat, 29 Jun 2019 00:10:22 +0000 (00:10 +0000)]
Revert "[clang][NewPM] Fix broken profile test"
This reverts commit
ab2c0ed01edfec9a9402d03bdf8633b34b73f3a7.
See https://reviews.llvm.org/D63155
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364692
91177308-0d34-0410-b5e6-
96231b3b80d8
Jan Korous [Fri, 28 Jun 2019 22:37:31 +0000 (22:37 +0000)]
[clang][test][NFC] Explicitly specify clang ABI in AST Dumper test
Clang <= 4 used the pre-C++11 rule about which structures can be passed in registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364690
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Fri, 28 Jun 2019 20:45:14 +0000 (20:45 +0000)]
[OPENMP]Improve analysis of implicit captures.
If the variable is used in the OpenMP region implicitly, we need to
check the data-sharing attributes for such variables and generate
implicit clauses for them. Patch improves analysis of such variables for
better handling of data-sharing rules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364683
91177308-0d34-0410-b5e6-
96231b3b80d8
Brad Smith [Fri, 28 Jun 2019 19:57:51 +0000 (19:57 +0000)]
Revert enabling frame pointer elimination on OpenBSD for now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364679
91177308-0d34-0410-b5e6-
96231b3b80d8
Volodymyr Sapsai [Fri, 28 Jun 2019 17:42:17 +0000 (17:42 +0000)]
[ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.
`Selector::getIdentifierInfoForSlot` returns NULL if a slot has no
corresponding identifier. Add a boolean to the hash and a NULL check.
rdar://problem/
51615164
Reviewers: rtrieu
Reviewed By: rtrieu
Subscribers: dexonsmith, cfe-commits, jkorous
Differential Revision: https://reviews.llvm.org/D63789
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364664
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Fri, 28 Jun 2019 16:16:00 +0000 (16:16 +0000)]
[OPENMP]Fix top DSA for static members.
Fixed handling of the data-sharing attributes for static members when
requesting top most attribute. Previously, it might return the incorrect
attributes for static members if they were overriden in the outer
constructs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364655
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Fri, 28 Jun 2019 15:16:37 +0000 (15:16 +0000)]
[OPENMP]Fix DSA for loop iteration variables in simd loops.
According to the OpenMP 5.0 standard, the loop iteration variable in the associated
for-loop of a simd construct with just one associated for-loop may be
listed in a private, lastprivate, or linear clause with a linear-step
that is the increment of the associated for-loop. Also, the loop
teration variables in the associated for-loops of a simd construct with
multiple associated for-loops may be listed in a private or lastprivate
clause.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364650
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Fri, 28 Jun 2019 15:08:03 +0000 (15:08 +0000)]
[Hexagon] driver uses out-of-date option name and binary name
Patch by A. Skrobov (t.yomitch).
Differential Revision: https://reviews.llvm.org/D62127
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364648
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Fri, 28 Jun 2019 14:59:25 +0000 (14:59 +0000)]
[OPENMP]Fix checks for DSA in simd constructs.
The errors for incorrectly specified data-sharing attributes for simd
constructs must be emitted only for the explicitly provided clauses, not
the predetermined ones.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364647
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Marton [Fri, 28 Jun 2019 08:08:51 +0000 (08:08 +0000)]
[CTU] Add missing statistics
Reviewers: xazax.hun
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63878
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364630
91177308-0d34-0410-b5e6-
96231b3b80d8
Nathan Huckleberry [Thu, 27 Jun 2019 22:46:40 +0000 (22:46 +0000)]
[analyzer] Fix clang-tidy crash on GCCAsmStmt
Summary:
Added entry in switch statement to recognize GCCAsmStmt
as a possible block terminator.
Handling to build CFG using GCCAsmStmt was already implemented.
Reviewers: nickdesaulniers, george.karpenkov, NoQ
Reviewed By: nickdesaulniers, NoQ
Subscribers: xbolva00, tmroeder, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63533
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364605
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Thu, 27 Jun 2019 21:16:19 +0000 (21:16 +0000)]
Pattern match struct types in test case.
This simplifies the test cases in a patch I'm planning to send later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364595
91177308-0d34-0410-b5e6-
96231b3b80d8