Joel E. Denny [Tue, 13 Mar 2018 22:18:29 +0000 (22:18 +0000)]
[Attr] Merge two dependent tests from different directories
Suggested at: https://reviews.llvm.org/D43248
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327456
91177308-0d34-0410-b5e6-
96231b3b80d8
Sjoerd Meijer [Tue, 13 Mar 2018 22:11:06 +0000 (22:11 +0000)]
[ARM] ACLE FP16 feature test macros
This is a partial recommit of r327189 that was reverted
due to test issues. I.e., this recommits minimal functional
change, the FP16 feature test macros, and adds tests that
were missing in the original commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327455
91177308-0d34-0410-b5e6-
96231b3b80d8
Eugene Zelenko [Tue, 13 Mar 2018 21:32:01 +0000 (21:32 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327453
91177308-0d34-0410-b5e6-
96231b3b80d8
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 20:50:12 +0000 (20:50 +0000)]
Revert revision 327438.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327447
91177308-0d34-0410-b5e6-
96231b3b80d8
Gheorghe-Teodor Bercea [Tue, 13 Mar 2018 19:39:19 +0000 (19:39 +0000)]
[OpenMP] Add flag for linking runtime bitcode library
Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode.
Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel
Reviewed By: ABataev, grokos
Subscribers: jholewinski, guansong, cfe-commits
Differential Revision: https://reviews.llvm.org/D43197
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327438
91177308-0d34-0410-b5e6-
96231b3b80d8
Sjoerd Meijer [Tue, 13 Mar 2018 19:38:56 +0000 (19:38 +0000)]
This reverts "r327189 - [ARM] Add ARMv8.2-A FP16 vector intrinsic"
This is causing problems in testing, and PR36683 was raised.
Reverting it until we have sorted out how to pass f16 vectors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327437
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Tue, 13 Mar 2018 18:58:25 +0000 (18:58 +0000)]
Serialize the NonTrivialToPrimitive* flags I added in r326307.
rdar://problem/
38421774
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327434
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Tue, 13 Mar 2018 17:27:01 +0000 (17:27 +0000)]
[analyzer] Fix the matcher for GCDAntipattern to look for "signal" call in all parameters
rdar://
38405904
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327426
91177308-0d34-0410-b5e6-
96231b3b80d8
Joel E. Denny [Tue, 13 Mar 2018 14:51:22 +0000 (14:51 +0000)]
Reland "[Attr] Fix parameter indexing for several attributes"
Relands r326602 (reverted in r326862) with new test and fix for
PR36620.
Differential Revision: https://reviews.llvm.org/D43248
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327405
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Tue, 13 Mar 2018 13:30:43 +0000 (13:30 +0000)]
[Hexagon] Clang side of r327302 in LLVM
Add option -m[no-]packets to control generation of instruction packets
(enabled by default).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327393
91177308-0d34-0410-b5e6-
96231b3b80d8
Pavel Labath [Tue, 13 Mar 2018 11:28:27 +0000 (11:28 +0000)]
clang-import-test: fix build with clang-3.8
clang-3.8 complains that constructor for '...' must explicitly
initialize the const object. Newer clangs and gcc seem to be fine with
this, but explicitly initializing the variable does not hurt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327383
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Yung [Tue, 13 Mar 2018 00:41:44 +0000 (00:41 +0000)]
Add missing "env" so that test added in r327322 passes on Windows bots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327354
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 12 Mar 2018 23:52:36 +0000 (23:52 +0000)]
[CFG] [analyzer] Don't add construction context to a return-by-reference call.
Call expressions that return objects by an lvalue reference or an rvalue
reference have a value type in the AST but wear an auxiliary flag of being an
lvalue or an xvalue respectively.
Use the helper method for obtaining the actual return type of the function.
Fixes a crash.
Differential Revision: https://reviews.llvm.org/D44273
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327352
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 12 Mar 2018 23:36:12 +0000 (23:36 +0000)]
[analyzer] Support temporaries conjured by conservatively evaluated functions.
Properly perform destruction and lifetime extension of such temporaries.
C++ object-type return values of conservatively evaluated functions are now
represented as compound values of well-defined temporary object regions. The
function creates a region that represents the temporary object and will later
be used for destruction or materialization, invalidates it, and returns the
invalidated compound value of the object.
Differential Revision: https://reviews.llvm.org/D44131
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327348
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 12 Mar 2018 23:27:52 +0000 (23:27 +0000)]
[analyzer] NFC: Move the code for setting temp object lifetime into method.
Differential Revision: https://reviews.llvm.org/D44129
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327347
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 12 Mar 2018 23:22:35 +0000 (23:22 +0000)]
[analyzer] Destroy and lifetime-extend inlined function return values properly.
This patch uses the newly added CFGCXXRecordTypedCall element at the call site
of the caller to construct the return value within the callee directly into the
caller's stack frame. This way it is also capable of populating the temporary
destructor and lifetime extension maps for the temporary, which allows
temporary destructors and lifetime extension to work correctly.
This patch does not affect temporaries that were returned from conservatively
evaluated functions.
Differential Revision: https://reviews.llvm.org/D44124
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327345
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Mon, 12 Mar 2018 23:12:40 +0000 (23:12 +0000)]
[CFG] [analyzer] Add construction context to C++ return-by-value call elements.
This patch adds a new CFGStmt sub-class, CFGCXXRecordTypedCall, which replaces
the regular CFGStmt for the respective CallExpr whenever the CFG has additional
information to provide regarding the lifetime of the returned value.
This additional call site information is represented by a ConstructionContext
(which was previously used for CFGConstructor elements) that provides references
to CXXBindTemporaryExpr and MaterializeTemporaryExpr that surround the call.
This corresponds to the common C++ calling convention solution of providing
the target address for constructing the return value as an auxiliary implicit
argument during function call.
One of the use cases for such extra context at the call site would be to perform
any sort of inter-procedural analysis over the CFG that involves functions
returning objects by value. In this case the elidable constructor at the return
site would construct the object explained by the context at the call site, and
its lifetime would also be managed by the caller, not the callee.
The extra context would also be useful for properly handling the return-value
temporary at the call site, even if the callee is not being analyzed
inter-procedurally.
Differential Revision: https://reviews.llvm.org/D44120
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327343
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Mon, 12 Mar 2018 21:43:02 +0000 (21:43 +0000)]
Re-land "[Sema] Make getCurFunction() return null outside function parsing"
This relands r326965.
There was a null dereference in typo correction that was triggered in
Sema/diagnose_if.c. We are not always in a function scope when doing
typo correction. The fix is to add a null check.
LLVM's optimizer made it hard to find this bug. I wrote it up in a
not-very-well-editted blog post here:
http://qinsb.blogspot.com/2018/03/ub-will-delete-your-null-checks.html
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327334
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Mon, 12 Mar 2018 19:36:29 +0000 (19:36 +0000)]
[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing
This ensures that diagnostics are not remapped to incorrect preamble locations after
the second reparse with a remapped header file occurs.
rdar://
37502480
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327322
91177308-0d34-0410-b5e6-
96231b3b80d8
Vedant Kumar [Mon, 12 Mar 2018 19:18:51 +0000 (19:18 +0000)]
Check that ubsan is the only supported sanitizer on OpenBSD
Patch by David Carlier!
Differential Revision: https://reviews.llvm.org/D44069
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327317
91177308-0d34-0410-b5e6-
96231b3b80d8
Jan Korous [Mon, 12 Mar 2018 18:33:55 +0000 (18:33 +0000)]
[Driver] Add text description of --help-hidden so it is shown in help
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327313
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Mon, 12 Mar 2018 18:27:36 +0000 (18:27 +0000)]
[analyzer] Move the GCDAsyncSemaphoreChecker to optin.performance
rdar://
38383753
Differential Revision: https://reviews.llvm.org/D44228
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327309
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Mon, 12 Mar 2018 17:05:06 +0000 (17:05 +0000)]
Revert "[ObjC] Allow declaring __weak pointer fields in C structs in
ARC."
This reverts commit r327206 as there were test failures caused by this
patch.
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
20180312/221427.html
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327294
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Mon, 12 Mar 2018 15:42:40 +0000 (15:42 +0000)]
[clang-format] Improve detection of Objective-C block types
Summary:
Previously, clang-format would detect the following as an
Objective-C block type:
FOO(^);
when it actually must be a C or C++ macro dealing with an XOR
statement or an XOR operator overload.
According to the Clang Block Language Spec:
https://clang.llvm.org/docs/BlockLanguageSpec.html
block types are of the form:
int (^)(char, float)
and block variables of block type are of the form:
void (^blockReturningVoidWithVoidArgument)(void);
int (^blockReturningIntWithIntAndCharArguments)(int, char);
void (^arrayOfTenBlocksReturningVoidWithIntArgument[10])(int);
This tightens up the detection so we don't unnecessarily detect
C macros which pass in the XOR operator.
Depends On D43904
Test Plan: New tests added. Ran tests with:
make -j12 FormatTests &&
./tools/clang/unittests/Format/FormatTests
Reviewers: krasimir, jolesiak, djasper
Reviewed By: djasper
Subscribers: djasper, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D43906
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327285
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Mon, 12 Mar 2018 15:42:38 +0000 (15:42 +0000)]
[clang-format] Don't detect C++11 attribute specifiers as ObjC
Summary:
Previously, clang-format would detect C++11 and C++17 attribute
specifiers like the following as Objective-C method invocations:
[[noreturn]];
[[clang::fallthrough]];
[[noreturn, deprecated("so sorry")]];
[[using gsl: suppress("type")]];
To fix this, I ported part of the logic from
tools/clang/lib/Parse/ParseTentative.cpp into TokenAnnotator.cpp so we
can explicitly parse and identify C++11 attribute specifiers.
This allows the guessLanguage() and getStyle() APIs to correctly
guess files containing the C++11 attribute specifiers as C++,
not Objective-C.
Test Plan: New tests added. Ran tests with:
make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: krasimir, jolesiak, djasper
Reviewed By: djasper
Subscribers: aaron.ballman, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D43902
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327284
91177308-0d34-0410-b5e6-
96231b3b80d8
Maxim Ostapenko [Mon, 12 Mar 2018 13:44:19 +0000 (13:44 +0000)]
[analyzer] Trying to fix Windows buildbots after r327258
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327270
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Mon, 12 Mar 2018 13:09:13 +0000 (13:09 +0000)]
Update the supported C language standards in the user manual.
Remove mention of -std=c94 (it is spelled iso9899:1994, not c94) and add mention of -std=c17 and -std=gnu17.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327264
91177308-0d34-0410-b5e6-
96231b3b80d8
Maxim Ostapenko [Mon, 12 Mar 2018 13:07:54 +0000 (13:07 +0000)]
[analyzer] Trying to fix buildbots after r327258
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327263
91177308-0d34-0410-b5e6-
96231b3b80d8
Maxim Ostapenko [Mon, 12 Mar 2018 12:26:15 +0000 (12:26 +0000)]
[analyzer] Add scope information to CFG
This patch adds two new CFG elements CFGScopeBegin and CFGScopeEnd that indicate
when a local scope begins and ends respectively. We use first VarDecl declared
in a scope to uniquely identify it and add CFGScopeBegin and CFGScopeEnd elements
into corresponding basic blocks.
Differential Revision: https://reviews.llvm.org/D16403
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327258
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Mon, 12 Mar 2018 10:32:18 +0000 (10:32 +0000)]
clang-format: Properly handle implicit string concatenation in text protos
Three issues to fix:
- char_constants weren't properly treated as string literals
- Prevening the break after "label: " does not make sense in concunction
with AlwaysBreakBeforeMultilineStrings. It leads to situations where
clang-format just cannot find a viable format (it must break and yet
it must not break).
- AlwaysBreakBeforeMultilineStrings should not be on for LK_TextProto in
Google style.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327255
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Mon, 12 Mar 2018 10:11:30 +0000 (10:11 +0000)]
Don't re-format raw string literal contents when formatting is disable
Not entirely sure this is the best place to put this check, but it fixes
the immediate issue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327253
91177308-0d34-0410-b5e6-
96231b3b80d8
Petr Hosek [Mon, 12 Mar 2018 00:23:37 +0000 (00:23 +0000)]
[Driver] Update the comment about incompatible sanitizers
Differential Revision: https://reviews.llvm.org/D44371
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327249
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Sat, 10 Mar 2018 23:06:31 +0000 (23:06 +0000)]
[CodeGen] Eagerly emit lifetime.end markers for calls
In C, we'll wait until the end of the scope to clean up aggregate
temporaries used for returns from calls. This means in cases like:
{
// Assuming that `Bar` is large enough to warrant indirect returns
struct Bar b = {};
b = foo(&b);
b = foo(&b);
b = foo(&b);
b = foo(&b);
}
...We'll allocate space for 5 Bars on the stack (`b`, and 4
temporaries). This becomes painful in things like large switch
statements.
If cleaning up sooner is trivial, we should do it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327229
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Sat, 10 Mar 2018 06:36:08 +0000 (06:36 +0000)]
[ObjC] Allow declaring __weak pointer fields in C structs in ARC.
This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.
rdar://problem/
33599681
Differential Revision: https://reviews.llvm.org/D44095
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327206
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Sat, 10 Mar 2018 05:55:21 +0000 (05:55 +0000)]
[Driver] Pass Default=false to hasFlag.
I forgot to do this in r326530.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327204
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sat, 10 Mar 2018 01:47:22 +0000 (01:47 +0000)]
Revert r326946. It caused stack overflows by significantly increasing the size of a CallArgList.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327195
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Sat, 10 Mar 2018 01:11:17 +0000 (01:11 +0000)]
[CodeGen] Try to not call a dtor after lifetime.end
If CodeGenFunction::EmitCall is:
- asked to emit a call with an indirectly returned value,
- given an invalid return value slot, and
- told the return value of the function it's calling is unused
then it'll make its own temporary, and add lifetime markers so that the
temporary's lifetime ends immediately after the call.
The early lifetime.end becomes problematic when we need to run a
destructor on the result of the function.
Instead of unconditionally saying that results of all calls are used
here (which would be correct, but would also cause us to never emit
lifetime markers for these temporaries), we just build our own temporary
to pass in when a dtor has to be run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327192
91177308-0d34-0410-b5e6-
96231b3b80d8
Abderrazek Zaafrani [Fri, 9 Mar 2018 23:39:34 +0000 (23:39 +0000)]
[ARM] Add ARMv8.2-A FP16 vector intrinsic
Add the fp16 neon vector intrinsic for ARM as described in the ARM ACLE document.
Reviews in https://reviews.llvm.org/D43650
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327189
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Fri, 9 Mar 2018 23:00:29 +0000 (23:00 +0000)]
test: repair windows build after SVN r327105
Thanks to Nico Weber for pointing out the failure. Add an explicit
target for the test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327183
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Fri, 9 Mar 2018 19:37:28 +0000 (19:37 +0000)]
Fix Clang test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327166
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Fri, 9 Mar 2018 19:35:16 +0000 (19:35 +0000)]
Don't use -pie in relocatable link.
Summary:
Android, in particular, got PIE enabled by default in r316606. It resulted in
relocatable links passing both -r and -pie to the linker, which is not allowed.
Reviewers: srhines
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44229
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327165
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Fri, 9 Mar 2018 15:20:30 +0000 (15:20 +0000)]
[OPENMP] Fix the address of the original variable in task reductions.
If initialization of the task reductions requires pointer to original
variable, which is stored in the threadprivate storage, we used the
address of this pointer instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327136
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Fri, 9 Mar 2018 14:43:29 +0000 (14:43 +0000)]
[SemaOverload] Fixed crash on code completion
Summary:
The relevant failing assertion message is:
../tools/clang/lib/Sema/SemaInit.cpp:8411: PerformCopyInitialization(): Assertion `InitE && "No initialization expression?"' failed.
See the added test case for a repro.
Reviewers: bkramer, sammccall, ioeric, hokein
Reviewed By: sammccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44300
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327134
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Fri, 9 Mar 2018 07:06:42 +0000 (07:06 +0000)]
CodeGen: simplify and validate exception personalities
Simplify the dispatching for the personality routines. This really had
no test coverage previously, so add test coverage for the various cases.
This turns out to be pretty complicated as the various languages and
models interact to change personalities around.
You really should feel bad for the compiler if you are using exceptions.
There is no reason for this type of cruelty.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327105
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Fri, 9 Mar 2018 02:00:01 +0000 (02:00 +0000)]
PR36645: Go looking for an appropriate array bound when constant-evaluating a
name of an array object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327099
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Fri, 9 Mar 2018 01:47:24 +0000 (01:47 +0000)]
[analyzer] MmapWriteExecChecker: Add support for mprotect().
mprotect() allows setting memory access flags similarly to mmap(),
causing similar security issues if these flags are needlessly broad.
Patch by David Carlier!
Differential Revision: https://reviews.llvm.org/D44250
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327098
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Fri, 9 Mar 2018 01:39:59 +0000 (01:39 +0000)]
[CFG] [analyzer] Add construction context for implicit constructor conversions.
Implicit constructor conversions such as A a = B() are represented by
surrounding the constructor for B() with an ImplicitCastExpr of
CK_ConstructorConversion kind, similarly to how explicit constructor conversions
are surrounded by a CXXFunctionalCastExpr. Support this syntax pattern when
extracting the construction context for the implicit constructor that
performs the conversion.
Differential Revision: https://reviews.llvm.org/D44051
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327096
91177308-0d34-0410-b5e6-
96231b3b80d8
Douglas Yung [Fri, 9 Mar 2018 00:38:51 +0000 (00:38 +0000)]
[DOXYGEN] Fix doxygen and content issues in mmintrin.h
- Fix instruction mappings/listings for various intrinsics
This patch was made by Craig Flores
Differential Revision: https://reviews.llvm.org/D41517
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327090
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Thu, 8 Mar 2018 23:11:46 +0000 (23:11 +0000)]
Add a debug info testcase for the trvial_abi attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327078
91177308-0d34-0410-b5e6-
96231b3b80d8
Eugene Zelenko [Thu, 8 Mar 2018 22:45:13 +0000 (22:45 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327074
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Thu, 8 Mar 2018 15:24:08 +0000 (15:24 +0000)]
[OPENMP] Emit sizes/init ptrs etc. data for task reductions before
using.
We may emit the code in wrong order because of incorrect implementation
of the runtime functions for task reductions. Threadprivate storages may
be initialized after real initialization of the reduction items. Patch
fixes this problem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327008
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Thu, 8 Mar 2018 11:29:27 +0000 (11:29 +0000)]
[clang-format] Use NestedBlockIndent as a 0 column in formatted raw strings
Summary:
This makes the formatter of raw string literals use NestedBlockIndent for
determining the 0 column of the content inside. This makes the formatting use
less horizonal space and fixes a case where two newlines before and after the
raw string prefix were selected instead of a single newline after it:
Before:
```
aaaa = ffff(
R"pb(
key: value)pb");
```
After:
```
aaaa = ffff(R"pb(
key: value)pb");
```
Reviewers: djasper, sammccall
Reviewed By: sammccall
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44141
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326996
91177308-0d34-0410-b5e6-
96231b3b80d8
Stephan Bergmann [Thu, 8 Mar 2018 07:34:40 +0000 (07:34 +0000)]
Propagate DLLAttr to friend re-declarations of member functions
...that have already been constructed (e.g., in inner classes) while parsing the
class definition. They would otherwise lack any DLLAttr inherited from the
class, which are only set here (called from Sema::CheckCompletedClass) after the
class definition has been parsed completely.
Differential revision: https://reviews.llvm.org/D16632
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326990
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Thu, 8 Mar 2018 05:32:30 +0000 (05:32 +0000)]
[CodeGen] Emit lifetime.ends in both EH and non-EH blocks
Before this, we'd only emit lifetime.ends for these temps in
non-exceptional paths. This potentially made our stack larger than it
needed to be for any code that follows an EH cleanup. e.g. in
```
struct Foo { char cs[32]; };
void escape(void *);
struct Bar { ~Bar() { char cs[64]; escape(cs); } };
Foo getFoo();
void baz() {
Bar b;
getFoo();
}
```
baz() would require 96 bytes of stack, since the temporary from getFoo()
only had a lifetime.end on the non-exceptional path.
This also makes us keep hold of the Value* returned by
EmitLifetimeStart, so we don't have to remake it later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326988
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Thu, 8 Mar 2018 02:53:39 +0000 (02:53 +0000)]
[analyzer] Correctly model iteration through "nil" objects
Previously, iteration through nil objects which resulted from
objc-messages being set to nil were modeled incorrectly.
There are a couple of notes about this patch:
In principle, ExprEngineObjC might be left untouched IFF osx.loops
checker is enabled.
I however think that we should not do something
completely incorrect depending on what checkers are left on.
We should evaluate and potentially remove altogether the isConsumedExpr
performance heuristic, as it seems very fragile.
rdar://
22205149
Differential Revision: https://reviews.llvm.org/D44178
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326982
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Thu, 8 Mar 2018 02:15:12 +0000 (02:15 +0000)]
Fix an unused variable warning; NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326980
91177308-0d34-0410-b5e6-
96231b3b80d8
Eugene Zelenko [Thu, 8 Mar 2018 01:37:39 +0000 (01:37 +0000)]
[Documentation] Fix Release notes problems introduced in r326889. Add highlighting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326979
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 8 Mar 2018 01:12:22 +0000 (01:12 +0000)]
Revert "[Sema] Make getCurFunction() return null outside function parsing"
This reverts r326965. It seems to have caused repeating test failures in
clang/test/Sema/diagnose_if.c on some buildbots.
I cannot reproduce the problem, and it's not immediately obvious what
the problem is, so let's revert to green.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326974
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 8 Mar 2018 01:07:33 +0000 (01:07 +0000)]
When substituting previously-checked template arguments into a template
template parameter that is an expanded parameter pack, only substitute into the
current slice, not the entire pack.
This reduces the checking of N template template arguments for an expanded
parameter pack containing N parameters from quadratic time to linear time in
the length of the pack. This is important because one (and possibly the only?)
general technique for splitting a template parameter pack in linear time
depends on doing this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326973
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 8 Mar 2018 00:55:09 +0000 (00:55 +0000)]
[MS] Pass CVRU qualifiers properly in Itanium mangler
We already have a mangling for the __unaligned qualifier, we just have
to call Qualifiers::getFromCVRUMask instead of getFromCVRMask.
PR36638
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326971
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Thu, 8 Mar 2018 00:22:04 +0000 (00:22 +0000)]
Fix a doc typo; NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326968
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Thu, 8 Mar 2018 00:14:34 +0000 (00:14 +0000)]
[Sema] Make getCurFunction() return null outside function parsing
Summary:
Before this patch, Sema pre-allocated a FunctionScopeInfo and kept it in
the first, always present element of the FunctionScopes stack. This
meant that Sema::getCurFunction would return a pointer to this
pre-allocated object when parsing code outside a function body. This is
pretty much always a bug, so this patch moves the pre-allocated object
into a separate unique_ptr. This should make bugs like PR36536 a lot
more obvious.
As you can see from this patch, there were a number of places that
unconditionally assumed they were always called inside a function.
However, there are also many places that null checked the result of
getCurFunction(), so I think this is a reasonable direction.
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44039
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326965
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 7 Mar 2018 23:26:02 +0000 (23:26 +0000)]
[MS] Accept __unaligned as a qualifier on member function pointers
We need to treat __unaligned like the other 'cvr' qualifiers when it
appears at the end of a function prototype. We weren't doing that in
some tentative parsing.
Fixes PR36638.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326962
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 7 Mar 2018 23:18:06 +0000 (23:18 +0000)]
Set dso_local on tls init functions.
We copy the visibility, so copying the dso_local flag seems the
natural thing to do.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326961
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Wed, 7 Mar 2018 23:15:20 +0000 (23:15 +0000)]
[ms] Emit vtordisp initializers in a deterministic order.
No effective behavior change, just for cleanliness.
Analysis and typing by me, actual patch mostly by Reid.
Fixes PR36159.
https://reviews.llvm.org/D44223
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326960
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 7 Mar 2018 22:48:35 +0000 (22:48 +0000)]
Avoid including ScopeInfo.h from Sema.h
Summary:
This provides no measurable build speedup, but it reinstates an
optimization from r112038 that was lost in r179618. It requires moving
CapturedScopeInfo::Capture out to clang::sema, which might be too
general since we have plenty of other Capture records in BlockDecl and
other AST nodes.
Reviewers: rjmccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44221
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326957
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Wed, 7 Mar 2018 22:20:39 +0000 (22:20 +0000)]
[analyzer] [PointerArithChecker] do not warn on indexes into vector types
rdar://
35041502
Differential Revision: https://reviews.llvm.org/D44172
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326952
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Wed, 7 Mar 2018 22:20:35 +0000 (22:20 +0000)]
[analyzer] Don't crash with assertion failure on structured bindings
Proper modeling still remains to be done.
Note that BindingDecl#getHoldingVar() is almost always null, and this
should probably be handled by dealing with DecompositionDecl beforehand.
rdar://
36852163
Differential Revision: https://reviews.llvm.org/D44183
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326951
91177308-0d34-0410-b5e6-
96231b3b80d8
Gheorghe-Teodor Bercea [Wed, 7 Mar 2018 21:59:50 +0000 (21:59 +0000)]
[OpenMP] Remove implicit data sharing code gen that aims to use device shared memory
Summary: Remove this scheme for now since it will be covered by another more generic scheme using global memory. This code will be worked into an optimization for the generic data sharing scheme. Removing this completely and then adding it via future patches will make all future data sharing patches cleaner.
Reviewers: ABataev, carlo.bertolli, caomhin
Reviewed By: ABataev
Subscribers: jholewinski, guansong, cfe-commits
Differential Revision: https://reviews.llvm.org/D43625
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326948
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaxun Liu [Wed, 7 Mar 2018 21:45:40 +0000 (21:45 +0000)]
CodeGen: Fix address space of indirect function argument
The indirect function argument is in alloca address space in LLVM IR. However,
during Clang codegen for C++, the address space of indirect function argument
should match its address space in the source code, i.e., default addr space, even
for indirect argument. This is because destructor of the indirect argument may
be called in the caller function, and address of the indirect argument may be
taken, in either case the indirect function argument is expected to be in default
addr space, not the alloca address space.
Therefore, the indirect function argument should be mapped to the temp var
casted to default address space. The caller will cast it to alloca addr space
when passing it to the callee. In the callee, the argument is also casted to the
default address space and used.
CallArg is refactored to facilitate this fix.
Differential Revision: https://reviews.llvm.org/D34367
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326946
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Wed, 7 Mar 2018 21:30:38 +0000 (21:30 +0000)]
[clang-format] Break consecutive string literals in text protos
Summary:
This patch fixes a bug where consecutive string literals in text protos were
put on the same line.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44204
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326945
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthew Voss [Wed, 7 Mar 2018 20:48:16 +0000 (20:48 +0000)]
Correct the alignment for the PS4 target
https://reviews.llvm.org/D44218
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326942
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaxun Liu [Wed, 7 Mar 2018 19:32:58 +0000 (19:32 +0000)]
[OpenCL] Remove block invoke function from emitted block literal struct
OpenCL runtime tracks the invoke function emitted for
any block expression. Due to restrictions on blocks in
OpenCL (v2.0 s6.12.5), it is always possible to know the
block invoke function when emitting call of block expression
or __enqueue_kernel builtin functions. Since __enqueu_kernel
already has an argument for the invoke function, it is redundant
to have invoke function member in the llvm block literal structure.
This patch removes invoke function from the llvm block literal
structure. It also removes the bitcast of block invoke function
to the generic block literal type which is useless for OpenCL.
This will save some space for the kernel argument, and also
eliminate some store instructions.
Differential Revision: https://reviews.llvm.org/D43783
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326937
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Wed, 7 Mar 2018 19:27:32 +0000 (19:27 +0000)]
[analyzer] [NFC] Minor refactoring of NonNullParamChecker
Differential Revision: https://reviews.llvm.org/D43917
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326935
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 7 Mar 2018 18:55:10 +0000 (18:55 +0000)]
Push a function scope when parsing function bodies without a declaration
Summary:
This is PR36536.
There are a few ways to reach Sema::ActOnStartOfFunctionDef with a null
Decl. Currently, the parser continues on to attempt to parse the
statements in the function body without pushing a function scope or
declaration context. However, lots of statement parsing logic relies on
getCurFunction() returning something reasonable. It turns out that
getCurFunction() will never return null today because of an optimization
where Sema pre-allocates one FunctionScopeInfo and reuses it when
possible. This goes wrong when something inside the function body causes
us to push another function scope, such as requiring an implicit
definition of a special member function. Reusing the state clears it
out, which will lead to bugs. In PR36536, we found that the SwitchStack
gets unbalanced, because we push a switch, clear out the stack, and then
try to pop a switch that isn't there.
As a follow-up, I plan to move the pre-allocated FunctionScopeInfo out
of the FunctionScopes stack. This means the FunctionScopes stack will
often be empty, and callers of getCurFunction() will need to check for
null.
Reviewers: thakis
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43980
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326926
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Wed, 7 Mar 2018 18:17:06 +0000 (18:17 +0000)]
[OPENMP] Fix lifetime of the loop counters.
We may emit incorrect lifetime info during codegen for loop counters in
OpenMP constructs because of automatic scope cleanup when we needed
temporarily locations for private loop counters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326922
91177308-0d34-0410-b5e6-
96231b3b80d8
Yuka Takahashi [Wed, 7 Mar 2018 11:34:02 +0000 (11:34 +0000)]
Add Clang ReleaseNotes that --autocomplete breaks backward compatibily
Summary:
--autocomplete flag now handles all the flags passed to shell, and this
implementation breaks backward compatibily before Clang 6.0.
Reviewers: teemperor, v.g.vassilev
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D44191
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326889
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Wed, 7 Mar 2018 05:02:27 +0000 (05:02 +0000)]
Remove a placeholder
...Running tests in the wrong directory will often make them seem to
pass. Oops. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326873
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Wed, 7 Mar 2018 04:52:34 +0000 (04:52 +0000)]
Reland r326766 (with a slightly modified test)
The original revert was done in r326869, since reverting r326602 broke
the test added by this.
The new test should be less dependent on r326602.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326872
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Wed, 7 Mar 2018 03:00:25 +0000 (03:00 +0000)]
Revert 326766 too, after r326862 the test fails and I don't know how to fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326869
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Wed, 7 Mar 2018 02:54:01 +0000 (02:54 +0000)]
[analyzer] Fix the checker for the performance anti-pattern to accept messages
send to ObjC objects.
Differential Revision: https://reviews.llvm.org/D44170
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326868
91177308-0d34-0410-b5e6-
96231b3b80d8
Petr Hosek [Wed, 7 Mar 2018 02:49:58 +0000 (02:49 +0000)]
[Driver] Enable SafeStack by default on Fuchsia
This is already used throughout the entire system, so make it a default.
Differential Revision: https://reviews.llvm.org/D44065
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326867
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Wed, 7 Mar 2018 02:32:44 +0000 (02:32 +0000)]
[ASTMatcher] Extend hasAnyArgument to ObjCMessageExpr
Currently hasArgument works with both ObjC messages and function calls,
but not hasAnyArgument.
This patch fixes that discrepancy, as it's often more convenient to use
hasAnyArgument.
On a more general note, it would be great to have a common superclass
for objc-call and function call, and a matcher matching that, but that's
probably a job for another commit.
Differential Revision: https://reviews.llvm.org/D44169
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326865
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Wed, 7 Mar 2018 02:22:41 +0000 (02:22 +0000)]
Revert r326602, it caused PR36620.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326862
91177308-0d34-0410-b5e6-
96231b3b80d8
Petr Hosek [Wed, 7 Mar 2018 01:27:03 +0000 (01:27 +0000)]
[Driver] Automatically disable incompatible default sanitizers
When a sanitizer incompatible with one of the default sanitizers
is explicitly enabled, automatically disable all the conflicting
default sanitizers.
Differential Revision: https://reviews.llvm.org/D44064
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326860
91177308-0d34-0410-b5e6-
96231b3b80d8
Eugene Zelenko [Wed, 7 Mar 2018 00:17:48 +0000 (00:17 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326856
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Tue, 6 Mar 2018 23:09:01 +0000 (23:09 +0000)]
Fix a typo from r326844; NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326845
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Tue, 6 Mar 2018 23:07:00 +0000 (23:07 +0000)]
[CodeGen] Don't emit lifetime.end without lifetime.start
EmitLifetimeStart returns a non-null `size` pointer if it actually
emits a lifetime.start. Later in this function, we use `tempSize`'s
nullness to determine whether or not we should emit a lifetime.end.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326844
91177308-0d34-0410-b5e6-
96231b3b80d8
Michal Gorny [Tue, 6 Mar 2018 21:26:28 +0000 (21:26 +0000)]
[FrontEnd] Allow overriding the default C/C++ -std via CMake vars
Provide two new CMake cache variables -- CLANG_DEFAULT_STD_C
and CLANG_DEFAULT_STD_CXX -- that can be used to override the default
C/ObjC and C++/ObjC++ standards appropriately. They can be set to one of
the identifiers from LangStandards.def, or left unset (the default) to
respect the current platform default.
This option is mostly intended for compiler vendors that may wish
to adjust the defaults their compilers are using. For example, Gentoo
planned to use it to set clang and gcc to matching standards, so that
we could maintain as much compatibility between different compilers
as possible.
The code relies on explicit identifiers rather than the string aliases
for simplicity. This saves us from the necessity of parsing aliases at
build-time or adding additional processing at runtime. For the latter
case, it also adds trivial value check -- if incorrect value is passed,
the code simply fails to compile through referencing an undefined
constant.
If the variable is used to redefine the default standard, the explicit
value overrides the special case for PS4. It is done this way mostly
following other kinds of variables where 'platform defaults' are
redefined.
Differential Revision: https://reviews.llvm.org/D34365
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326836
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Tue, 6 Mar 2018 18:59:43 +0000 (18:59 +0000)]
[OPENMP] Fix generation of the unique names for task reduction
variables.
If the task has reduction construct and this construct for some variable
requires unique threadprivate storage, we may generate different names
for variables used in taskgroup task_reduction clause and in task
in_reduction clause. Patch fixes this problem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326827
91177308-0d34-0410-b5e6-
96231b3b80d8
Nicolai Haehnle [Tue, 6 Mar 2018 17:55:00 +0000 (17:55 +0000)]
TableGen: Give up on exact fixits for diagnostic groups
With recent changes in the TableGen frontend, we no longer have usable
location information for anonymous defs.
Fixes test breakage caused by r326788.
The normal, non-error TableGen output is not affected by this change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326822
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Tue, 6 Mar 2018 17:21:42 +0000 (17:21 +0000)]
[clang-format] Improve detection of ObjC for-in statements
Summary:
Previously, clang-format would detect the following as an
Objective-C for-in statement:
for (int x = in.value(); ...) {}
because the logic only decided a for-loop was definitely *not*
an Objective-C for-in loop after it saw a semicolon or a colon.
To fix this, I delayed the decision of whether this was a for-in
statement until after we found the matching right-paren, at which
point we know if we've seen a semicolon or not.
Test Plan: New tests added. Ran tests with:
make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: krasimir, jolesiak
Reviewed By: jolesiak
Subscribers: djasper, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D43904
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326815
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Tue, 6 Mar 2018 16:06:44 +0000 (16:06 +0000)]
[X86] Fix typo in cpuid.h, bit_AVX51SER->bit_AVX512ER.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326807
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Tue, 6 Mar 2018 13:56:28 +0000 (13:56 +0000)]
[clang-format] fix handling of consecutive unary operators
Summary:
Code that used to be formatted as `if (! + object) {` is now formatted as `if (!+object) {`
(we have a particular object in our codebase where unary `operator+` is overloaded to return the underlying value, which in this case is a `bool`)
We still preserve the TypeScript behavior where `!` is a trailing non-null operator. (This is already tested by an existing unit test in `FormatTestJS.cpp`)
It doesn't appear like handling of consecutive unary operators are tested in general, so I added another test for completeness
Patch contributed by @kevinl!
Reviewers: krasimir
Reviewed By: krasimir
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43312
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326792
91177308-0d34-0410-b5e6-
96231b3b80d8
Henry Wong [Tue, 6 Mar 2018 13:38:42 +0000 (13:38 +0000)]
[analyzer] CStringChecker.cpp: Remove the duplicated check about null dereference on dest-buffer or src-buffer.
Summary: `CheckBufferAccess()` calls `CheckNonNull()`, so there are some calls to `CheckNonNull()` that are useless.
Reviewers: dcoughlin, NoQ, xazax.hun, cfe-commits, george.karpenkov
Reviewed By: NoQ
Subscribers: szepet, rnkovacs, MTC, a.sidorin
Differential Revision: https://reviews.llvm.org/D44075
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326782
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Tue, 6 Mar 2018 13:24:01 +0000 (13:24 +0000)]
[clang-format] Fix documentation for SpaceAfterCStyleCast option
Patch contributed by @EricMarti!
Summary: I noticed that the example for SpaceAfterCStyleCast does not match its description. I fixed the example after testing it out.
Reviewers: rsmith, krasimir
Reviewed By: krasimir
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43731
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326781
91177308-0d34-0410-b5e6-
96231b3b80d8
Henry Wong [Tue, 6 Mar 2018 12:29:09 +0000 (12:29 +0000)]
[Analyzer] More accurate modeling about the increment operator of the operand with type bool.
Summary:
There is a problem with analyzer that a wrong value is given when modeling the increment operator of the operand with type bool. After `rL307604` is applied, a unsigned overflow may occur.
Example:
```
void func() {
bool b = true;
// unsigned overflow occur, 2 -> 0 U1b
b++;
}
```
The use of an operand of type bool with the ++ operators is deprecated but valid untill C++17. And if the operand of the increment operator is of type bool, it is set to true.
This patch includes two parts:
- If the operand of the increment operator is of type bool or type _Bool, set to true.
- Modify `BasicValueFactory::getTruthValue()`, use `getIntWidth()` instead `getTypeSize()` and use `unsigned` instead `signed`.
Reviewers: alexshap, NoQ, dcoughlin, george.karpenkov
Reviewed By: NoQ
Subscribers: xazax.hun, szepet, a.sidorin, cfe-commits, MTC
Differential Revision: https://reviews.llvm.org/D43741
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326776
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Kornienko [Tue, 6 Mar 2018 10:40:11 +0000 (10:40 +0000)]
Move test/gcdasyncsemaphorechecker_test.m to a subdirectory
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326772
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Tue, 6 Mar 2018 07:45:11 +0000 (07:45 +0000)]
Fix an unused variable warning; NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326767
91177308-0d34-0410-b5e6-
96231b3b80d8
George Burgess IV [Tue, 6 Mar 2018 07:42:36 +0000 (07:42 +0000)]
[ExprConstant] Look through ExprWithCleanups for `allocsize`
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326766
91177308-0d34-0410-b5e6-
96231b3b80d8