Alex Bradbury [Sat, 3 Feb 2018 11:56:11 +0000 (11:56 +0000)]
[RISCV] Create a LinuxTargetInfo when targeting Linux
Previously, RISCV32TargetInfo or RISCV64TargetInfo were created
unconditionally. Use LinuxTargetInfo<RISCV??TargetInfo> to ensure that the
proper OS-specific defines are present.
This patch only adds logic to instantiate LinuxTargetInfo and leaves a TODO,
as I'm reluctant to add logic for other targets (e.g. FreeBSD, RTEMS) until
I've produced and tested at least one binary for that OS+target combo.
Thanks to @mgrang to reporting the issue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324170
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Sat, 3 Feb 2018 03:57:32 +0000 (03:57 +0000)]
Revert r324166 "[analyzer] Add a checker for mmap()...".
Due to Buildbot failures - most likely that's because target triples were not
specified in the tests, even though the checker behaves differently with
different target triples.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324167
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Sat, 3 Feb 2018 02:33:42 +0000 (02:33 +0000)]
[analyzer] Add a checker for mmap()s which are both writable and executable.
This is a security check which is disabled by default but will be enabled
whenever the user consciously enables the security package. If mmap()ed memory
is both writable and executable, it makes it easier for the attacker to execute
arbitrary code when contents of this memory are compromised. Some applications
require such mmap()s though, such as different sorts of JIT.
Patch by David Carlier!
Differential Revision: https://reviews.llvm.org/D42645
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324166
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Sat, 3 Feb 2018 01:06:21 +0000 (01:06 +0000)]
[hwasan] Add a paragraph on stack instrumentation.
Reviewers: kcc
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42874
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324163
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Sat, 3 Feb 2018 00:55:21 +0000 (00:55 +0000)]
[analyzer] Do not infer nullability inside function-like macros, even when macro is explicitly returning NULL
We already suppress such reports for inlined functions, we should then
get the same behavior for macros.
The underlying reason is that the same macro, can be called from many
different contexts, and nullability can only be expected in _some_ of
them.
Assuming that the macro can return null in _all_ of them sometimes leads
to a large number of false positives.
E.g. consider the test case for the dynamic cast implementation in
macro: in such cases, the bug report is unwanted.
Tracked in rdar://
36304776
Differential Revision: https://reviews.llvm.org/D42404
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324161
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Sat, 3 Feb 2018 00:44:57 +0000 (00:44 +0000)]
Fix crash when trying to pack-expand a GNU statement expression.
We could in principle support such pack expansion, using techniques similar to
what we do for pack expansion of lambdas, but it's not clear it's worthwhile.
For now at least, cleanly reject these cases rather than crashing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324160
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Fri, 2 Feb 2018 22:24:54 +0000 (22:24 +0000)]
Add missing direct-init / parameter-declaration-clause disambiguation when
parsing a trailing-return-type of a (function pointer) variable declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324151
91177308-0d34-0410-b5e6-
96231b3b80d8
James Dennett [Fri, 2 Feb 2018 21:38:22 +0000 (21:38 +0000)]
More documentation cleanup for Decl.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324142
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Fri, 2 Feb 2018 20:30:39 +0000 (20:30 +0000)]
Make __has_unique_object_representations reject empty union types.
Summary:
Clang incorrectly reports empty unions as having a unique object representation. However, this is not correct since `sizeof(EmptyUnion) == 1` AKA it has 8 bits of padding. Therefore it should be treated the same as an empty struct and report `false`.
@erichkeane also suggested this fix should be merged into the 6.0 release branch, so the initial release of `__has_unique_object_representations` is as bug-free as possible.
Reviewers: erichkeane, rsmith, aaron.ballman, majnemer
Reviewed By: erichkeane
Subscribers: cfe-commits, erichkeane
Differential Revision: https://reviews.llvm.org/D42863
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324134
91177308-0d34-0410-b5e6-
96231b3b80d8
James Dennett [Fri, 2 Feb 2018 20:22:29 +0000 (20:22 +0000)]
Documentation cleanup, no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324133
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Morehouse [Fri, 2 Feb 2018 20:22:20 +0000 (20:22 +0000)]
[clang-proto-to-cxx] Accept protobufs with missing fields.
libprotobuf-mutator accepts protobufs with missing fields, which means
clang-proto-fuzzer does as well. clang-proto-to-cxx should match this
behavior.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324132
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Fri, 2 Feb 2018 20:15:14 +0000 (20:15 +0000)]
[clang-format] New format param ObjCBinPackProtocolList
Summary:
This is an alternative approach to D42014 after some
investigation by stephanemoore@ and myself.
Previously, the format parameter `BinPackParameters` controlled both
C function parameter list bin-packing and Objective-C protocol conformance
list bin-packing.
We found in the Google style, some teams were changing
`BinPackParameters` from its default (`true`) to `false` so they could
lay out Objective-C protocol conformance list items one-per-line
instead of bin-packing them into as few lines as possible.
To allow teams to use one-per-line Objective-C protocol lists without
changing bin-packing for other areas like C function parameter lists,
this diff introduces a new LibFormat parameter
`ObjCBinPackProtocolList` to control the behavior just for ObjC
protocol conformance lists.
The new parameter is an enum which defaults to `Auto` to keep the
previous behavior (delegating to `BinPackParameters`).
Depends On D42649
Test Plan: New tests added. make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewers: jolesiak, stephanemoore, djasper
Reviewed By: stephanemoore
Subscribers: Wizard, hokein, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D42650
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324131
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Fri, 2 Feb 2018 19:58:34 +0000 (19:58 +0000)]
Emit label names according to -discard-value-names.
Summary:
Previously, Clang only emitted label names in assert builds.
However there is a CC1 option -discard-value-names that should have been used to control emission instead.
This patch removes the NDEBUG preprocessor block and instead allows LLVM to handle removing the names in accordance with the option.
Reviewers: erichkeane, aaron.ballman, majnemer
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42829
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324127
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Fri, 2 Feb 2018 18:27:14 +0000 (18:27 +0000)]
[analyzer] [tests] Fix crash in SATestBuild.py
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324114
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Liu [Fri, 2 Feb 2018 18:19:22 +0000 (18:19 +0000)]
[Tooling] Returns non-zero status code when files are skipped.
Reviewers: hokein, bkramer
Reviewed By: bkramer
Subscribers: bkramer, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D42361
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324113
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 2 Feb 2018 17:29:22 +0000 (17:29 +0000)]
Revert "Start setting dso_local in clang."
This reverts commit r324107.
I will have to test it on OS X.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324108
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 2 Feb 2018 17:17:39 +0000 (17:17 +0000)]
Start setting dso_local in clang.
This starts adding dso_local to clang.
The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go
away. My objective for now is to move enough of it to clang to remove
the need for the TargetMachine one to handle PIE copy relocations and
-fno-plt. With that it should then be easy to implement a
-fno-copy-reloc in clang.
This patch just adds the cases where we assume a symbol to be local
based on the file being compiled for an executable or a shared
library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324107
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaxun Liu [Fri, 2 Feb 2018 16:08:24 +0000 (16:08 +0000)]
[AMDGPU] Switch to the new addr space mapping by default
This requires corresponding llvm change.
Differential Revision: https://reviews.llvm.org/D40956
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324102
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Fri, 2 Feb 2018 15:53:35 +0000 (15:53 +0000)]
[CodeGen][va_args] Correct Vector Struct va-arg 'in_reg' code gen
When trying to track down a different bug, we discovered
that calling __builtin_va_arg on a vec3f type caused
the SROA pass to issue a warning that there was an illegal
access.
Further research showed that the vec3f type is
alloca'ed as size '12', but the _builtin_va_arg code
on x86_64 was always loading this out of registers as
{double, double}. Thus, the 2nd store into the vec3f
was storing in bytes 12-15!
This patch alters the original implementation which always
assumed {double, double} to use the actual coerced type
instead, so the LLVM-IR generated is a load/GEP/store of
a <2 x float> and a float, rather than a double and a double.
Tests were added for all combinations I could think of that
would fit in 2 FP registers, and all work exactly as expected.
Differential Revision: https://reviews.llvm.org/D42811
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324098
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam McCall [Fri, 2 Feb 2018 14:13:37 +0000 (14:13 +0000)]
[Index] fix USR generation for namespace{extern{X}}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324093
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam McCall [Fri, 2 Feb 2018 13:34:47 +0000 (13:34 +0000)]
[AST] namespace ns { extern "C" { int X; }} prints as "ns::X", not as "X"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324081
91177308-0d34-0410-b5e6-
96231b3b80d8
Ilya Biryukov [Fri, 2 Feb 2018 08:40:08 +0000 (08:40 +0000)]
[Sema] Add implicit members even for invalid CXXRecordDecls
Summary:
It should be safe, since other code paths are already generating
implicit members even in invalid CXXRecordDecls (e.g. lookup).
If we don't generate implicit members on CXXRecordDecl's completion,
they will be generated by next lookup of constructors. This causes a
crash when the following conditions are met:
- a CXXRecordDecl is invalid,
- it is provided via ExternalASTSource (e.g. from PCH),
- it has inherited constructors (they create ShadowDecls),
- lookup of its constructors was not run before ASTWriter serialized
it.
This may require the ShadowDecls created for inherited constructors to
be removed from the class, but that's no longer possible since class is
provided by ExternalASTSource.
See provided lit test for an example.
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42810
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324062
91177308-0d34-0410-b5e6-
96231b3b80d8
Martin Storsjo [Fri, 2 Feb 2018 06:22:35 +0000 (06:22 +0000)]
[MinGW] Emit typeinfo locally for dllimported classes without key functions
This fixes building Qt as shared libraries with clang in MinGW
mode; previously subclasses of the QObjectData class (in other
DLLs than the base DLL) failed to find the typeinfo symbols
(that neither were emitted in the base DLL nor in the DLL
containing the subclass).
If the virtual destructor in the newly added testcase wouldn't
be pure (or if there'd be another non-pure virtual method),
it'd be a key function and things would work out even before this
change. Make sure to locally emit the typeinfo for these classes
as well.
This matches what GCC does in this specific testcase.
This fixes the root issue that spawned PR35146. (The difference
to GCC that is initially described in that bug still is present
though.)
Differential Revision: https://reviews.llvm.org/D42641
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324059
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Fri, 2 Feb 2018 02:23:37 +0000 (02:23 +0000)]
[analyzer] Fix transitions in check::PreStmt<MemberExpr> checker callback.
No in-tree checkers use this callback so far, hence no tests. But better fix
this now than remember to fix this when the checkers actually appear.
Patch by Henry Wong!
Differential Revision: https://reviews.llvm.org/D42785
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324053
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Fri, 2 Feb 2018 02:19:43 +0000 (02:19 +0000)]
[analyzer] Expose return statement from CallExit program point
If the return statement is stored, we might as well allow querying
against it.
Also fix the bug where the return statement is not stored
if there is no return value.
This change un-merges two ExplodedNodes during call exit when the state
is otherwise identical - the CallExitBegin node itself and the "Bind
Return Value"-tagged node.
And expose the return statement through
getStatement helper function.
Differential Revision: https://reviews.llvm.org/D42130
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324052
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Fri, 2 Feb 2018 02:14:33 +0000 (02:14 +0000)]
Remove the change which accidentally crept in into the cherry-pick
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324050
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Fri, 2 Feb 2018 02:01:55 +0000 (02:01 +0000)]
[analyzer] Expose exploration strategy through analyzer options.
Differential Revision: https://reviews.llvm.org/D42774
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324049
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Fri, 2 Feb 2018 01:44:07 +0000 (01:44 +0000)]
[analyzer] Fix yet-another-crash in body-farming std::call_once
Crash occurs when parameters to the callback and to std::call_once
mismatch, and C++ is supposed to auto-construct an argument.
Filed by Alexander Kornienko in
https://bugs.llvm.org/show_bug.cgi?id=36149
rdar://
37034403
Differential Revision: https://reviews.llvm.org/D42777
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324046
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Thu, 1 Feb 2018 23:47:54 +0000 (23:47 +0000)]
[coroutines] Fix application of NRVO to Coroutine "Gro" or return object.
Summary:
Fix NRVO for Gro variable.
Previously, we only marked the GRO declaration as an NRVO variable
when its QualType and the function return's QualType matched exactly
(using operator==). However, this was incorrect for two reasons:
1. We were marking non-class types, such as ints, as being NRVO variables.
2. We failed to handle cases where the canonical types were the same, but the actual `QualType` objects were different. For example, if one was represented by a typedef. (Example: https://godbolt.org/g/3UFgsL)
This patch fixes these bugs by marking the Gro variable as supporting NRVO only
when `BuildReturnStmt` marks the Gro variable as a coroutine candidate.
Reviewers: rsmith, GorNishanov, nicholas
Reviewed By: GorNishanov
Subscribers: majnemer, cfe-commits
Differential Revision: https://reviews.llvm.org/D42343
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324037
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Thu, 1 Feb 2018 22:40:01 +0000 (22:40 +0000)]
[analyzer] [tests] [NFC] Remove dead code from CmpRuns
Indeed, "CHANGE" is not a thing yet, and we should probably not carry
around dead code which does not do anything apart from confusing the
reader.
Differential Revision: https://reviews.llvm.org/D42819
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324027
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Thu, 1 Feb 2018 22:25:18 +0000 (22:25 +0000)]
[analyzer] [tests] Add an option to show the histogram of path differences between the analyzer runs
Differential Revision: https://reviews.llvm.org/D42778
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324021
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Thu, 1 Feb 2018 22:17:05 +0000 (22:17 +0000)]
[analyzer] Don't communicate evaluation failures through memregion hierarchy.
We use CXXTempObjectRegion exclusively as a bailout value for construction
targets when we are unable to find the correct construction region.
Sometimes it works correctly, but rather accidentally than intentionally.
Now that we want to increase the amount of situations where it works correctly,
the first step is to introduce a different way of communicating our failure
to find the correct construction region. EvalCallOptions are introduced
for this purpose.
For now EvalCallOptions are communicating two kinds of problems:
- We have been completely unable to find the correct construction site.
- We have found the construction site correctly, and there's more than one of
them (i.e. array construction which we currently don't support).
Accidentally find and fix a test in which the new approach to communicating
failures produces better results.
Differential Revision: https://reviews.llvm.org/D42457
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324018
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 1 Feb 2018 20:01:49 +0000 (20:01 +0000)]
PR36157: When injecting an implicit function declaration in C89, find the right
DeclContext rather than injecting it wherever we happen to be.
This avoids creating functions whose DeclContext is a struct or similar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323998
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Thu, 1 Feb 2018 18:10:20 +0000 (18:10 +0000)]
Mark fallthrough with LLVM_FALLTHROUGH
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323986
91177308-0d34-0410-b5e6-
96231b3b80d8
Sander de Smalen [Thu, 1 Feb 2018 12:27:13 +0000 (12:27 +0000)]
Reverting patch rL323952 due to build errors that I
haven't encountered in local builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323956
91177308-0d34-0410-b5e6-
96231b3b80d8
Sander de Smalen [Thu, 1 Feb 2018 11:25:10 +0000 (11:25 +0000)]
[DebugInfo] Enable debug information for C99 VLA types
Summary:
This patch enables debugging of C99 VLA types by generating more precise
LLVM Debug metadata, using the extended DISubrange 'count' field that
takes a DIVariable.
This should implement:
Bug 30553: Debug info generated for arrays is not what GDB expects (not as good as GCC's)
https://bugs.llvm.org/show_bug.cgi?id=30553
Reviewers: echristo, aprantl, dexonsmith, clayborg, pcc, kristof.beyls, dblaikie
Reviewed By: aprantl
Subscribers: jholewinski, schweitz, davide, fhahn, JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D41698
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323952
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Thu, 1 Feb 2018 03:04:15 +0000 (03:04 +0000)]
[CodeGen] Fix an assertion failure in CGRecordLowering.
This patch fixes a bug in CGRecordLowering::accumulateBitFields where it
unconditionally starts a new run and emits a storage field when it sees
a zero-sized bitfield, which causes an assertion in insertPadding to
fail when -fno-bitfield-type-align is used.
It shouldn't emit new storage if UseZeroLengthBitfieldAlignment and
UseBitFieldTypeAlignment are both false.
rdar://problem/
36762205
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323943
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Thu, 1 Feb 2018 02:38:42 +0000 (02:38 +0000)]
[analyzer] [tests] Show the number of removed/added bug reports
Differential Revision: https://reviews.llvm.org/D42718
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323941
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Thu, 1 Feb 2018 00:28:36 +0000 (00:28 +0000)]
PR36181: Teach CodeGen to properly ignore requests to emit dependent entities.
Previously, friend function definitions within class templates slipped through
the gaps and caused the MS mangler to assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323935
91177308-0d34-0410-b5e6-
96231b3b80d8
Alex Lorenz [Wed, 31 Jan 2018 21:59:02 +0000 (21:59 +0000)]
[PR32482] Fix bitfield layout for -mms-bitfield and pragma pack
The patch ensures that a new storage unit is created when the new bitfield's
size is wider than the available bits.
rdar://
36343145
Differential Revision: https://reviews.llvm.org/D42660
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323921
91177308-0d34-0410-b5e6-
96231b3b80d8
Mark Zeren [Wed, 31 Jan 2018 20:05:50 +0000 (20:05 +0000)]
[clang-format] Align preprocessor comments with #
Summary:
r312125, which introduced preprocessor indentation, shipped with a known
issue where "indentation of comments immediately before indented
preprocessor lines is toggled on each run". For example these two forms
toggle:
#ifndef HEADER_H
#define HEADER_H
#if 1
// comment
# define A 0
#endif
#endif
#ifndef HEADER_H
#define HEADER_H
#if 1
// comment
# define A 0
#endif
#endif
This happens because we check vertical alignment against the '#' yet
indent to the level of the 'define'. This patch resolves this issue by
aligning against the '#'.
Reviewers: krasimir, klimek, djasper
Reviewed By: krasimir
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42408
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323904
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Wed, 31 Jan 2018 19:52:58 +0000 (19:52 +0000)]
Clarify that optimization levels -O2 and above are recommended for use of PGO.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323902
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam Clegg [Wed, 31 Jan 2018 18:55:22 +0000 (18:55 +0000)]
[WebAssembly] Don't pass -ffunction-section/-fdata-sections
llvm currently forces both of these to true to passing them
is redundant.
Differential Revision: https://reviews.llvm.org/D37831
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323897
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniil Fukalov [Wed, 31 Jan 2018 18:49:49 +0000 (18:49 +0000)]
Revert "[AMDGPU] Add ds_fadd, ds_fmin, ds_fmax builtins functions"
This reverts https://reviews.llvm.org/rL323890
This reverts commit
251524ebd8c346a936f0e74b09d609d49fbaae4a.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323896
91177308-0d34-0410-b5e6-
96231b3b80d8
Ana Pazos [Wed, 31 Jan 2018 18:11:09 +0000 (18:11 +0000)]
Revert "Revert rC322769: [RISCV] Propagate -mabi and -march values to GNU assembler."
Summary: Bringing back the code change and simplified test cases to test 32/64 bit targets.
Reviewers: asb, yroux, inouehrs, mgrang
Reviewed By: yroux, inouehrs
Subscribers: cfe-commits, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD
Differential Revision: https://reviews.llvm.org/D42666
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323894
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniil Fukalov [Wed, 31 Jan 2018 16:55:09 +0000 (16:55 +0000)]
[AMDGPU] Add ds_fadd, ds_fmin, ds_fmax builtins functions
Reviewed by arsenm
Differential Revision: https://reviews.llvm.org/D42578
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323890
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonathan Roelofs [Wed, 31 Jan 2018 12:06:15 +0000 (12:06 +0000)]
Fix typo. NFC
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323864
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Wed, 31 Jan 2018 10:14:10 +0000 (10:14 +0000)]
[clang-format] Adds space around braces in text protos
Summary:
This patch modifies the text proto Google style to add spaces around braces.
I investigated using something different than Cpp11BracedListStyle, but it turns out it's what we want and also the java and js styles also depend on that.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D42685
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323860
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonas Hahnfeld [Wed, 31 Jan 2018 08:26:51 +0000 (08:26 +0000)]
[CUDA] Detect installation in PATH
If the CUDA toolkit is not installed to its default locations
in /usr/local/cuda, the user is forced to specify --cuda-path.
This is tedious and the driver can be smarter if well-known tools
(like ptxas) can already be found in the PATH environment variable.
Add option --cuda-path-ignore-env if the user wants to ignore
set environment variables. Also use it in the tests to make sure
the driver always finds the same CUDA installation, regardless
of the user's environment.
Differential Revision: https://reviews.llvm.org/D42642
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323848
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Tue, 30 Jan 2018 22:58:06 +0000 (22:58 +0000)]
[analyzer] Extend SuppressInlineDefensiveChecksVisitor to all macros, including non-function-like ones
No reason to treat function-like macros differently here.
Tracked in rdar://
29907377
Differential Revision: https://reviews.llvm.org/D42444
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323827
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Tue, 30 Jan 2018 20:19:34 +0000 (20:19 +0000)]
Revert "CodeGen: annotate ObjC ARC functions with ABI constraints"
This reverts commit r294872.
Although this patch is correct, it caused the objc_autoreleaseRValue/objc_retainAutoreleasedReturnValue
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323814
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Tue, 30 Jan 2018 00:32:25 +0000 (00:32 +0000)]
Revert "[coroutines] Fix application of NRVO to Coroutine "Gro" or return object."
This reverts commit r323712. It's causing some test failures on certain machines.
Not sure why, will investigate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323717
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Belevich [Tue, 30 Jan 2018 00:00:12 +0000 (00:00 +0000)]
[CUDA] Added partial support for CUDA-9.1
Clang can use CUDA-9.1 now, though new APIs (are not implemented yet.
The major change is that headers in CUDA-9.1 went through substantial
changes that started in CUDA-9.0 which required substantial changes
in the cuda compatibility headers provided by clang.
There are two major issues:
* CUDA SDK no longer provides declarations for libdevice functions.
* A lot of device-side functions have become nvcc's builtins and
CUDA headers no longer contain their implementations.
This patch changes the way CUDA headers are handled if we compile
with CUDA 9.x. Both 9.0 and 9.1 are affected.
* Clang provides its own declarations of libdevice functions.
* For CUDA-9.x clang now provides implementation of device-side
'standard library' functions using libdevice.
This patch should not affect compilation with CUDA-8. There may be
some observable differences for CUDA-9.0, though they are not expected
to affect functionality.
Tested: CUDA test-suite tests for all supported combinations of:
CUDA: 7.0,7.5,8.0,9.0,9.1
GPU: sm_20, sm_35, sm_60, sm_70
Differential Revision: https://reviews.llvm.org/D42513
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323713
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Fiselier [Mon, 29 Jan 2018 23:52:57 +0000 (23:52 +0000)]
[coroutines] Fix application of NRVO to Coroutine "Gro" or return object.
Summary:
Fix NRVO for Gro variable.
Previously, we only marked the GRO declaration as an NRVO variable
when its QualType and the function return's QualType matched exactly
(using operator==). However, this was incorrect for two reasons:
1. We were marking non-class types, such as ints, as being NRVO variables.
2. We failed to handle cases where the canonical types were the same, but the actual `QualType` objects were different. For example, if one was represented by a typedef. (Example: https://godbolt.org/g/3UFgsL)
This patch fixes these bugs by marking the Gro variable as supporting NRVO only
when `BuildReturnStmt` marks the Gro variable as a coroutine candidate.
Reviewers: rsmith, GorNishanov, nicholas
Reviewed By: GorNishanov
Subscribers: majnemer, cfe-commits
Differential Revision: https://reviews.llvm.org/D42343
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323712
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Mon, 29 Jan 2018 21:45:07 +0000 (21:45 +0000)]
[analyzer] Use stable filenames in analyzer testing infrastructure
Makes finding the right file in test results easier.
Differential Revision: https://reviews.llvm.org/D42445
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323697
91177308-0d34-0410-b5e6-
96231b3b80d8
George Karpenkov [Mon, 29 Jan 2018 21:44:49 +0000 (21:44 +0000)]
[analyzer] [NFC] Remove unused method visitItemsInWorkList
Differential Revision: https://reviews.llvm.org/D42562
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323696
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Mon, 29 Jan 2018 20:01:49 +0000 (20:01 +0000)]
[clang-format] Add more tests for ObjC protocol list formatting behavior
Summary:
The existing unit tests in FormatTestObjC.cpp didn't fully cover
all the cases for protocol confirmance list formatting.
This extends the unit tests to more cases of protocol
conformance list formatting, especially how the behavior changes
when `BinPackParameters` changes from `true` (the default) to `false`.
Test Plan: make -j12 FormatTests && \
./tools/clang/unittests/Format/FormatTests --gtest_filter=FormatTestObjC.\*
Reviewers: krasimir, jolesiak, stephanemoore
Reviewed By: krasimir
Subscribers: benhamilton, klimek, cfe-commits, hokein, Wizard
Differential Revision: https://reviews.llvm.org/D42649
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323684
91177308-0d34-0410-b5e6-
96231b3b80d8
Erich Keane [Mon, 29 Jan 2018 19:33:20 +0000 (19:33 +0000)]
[NFC] Fixup comment with function name, actually incorrect name!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323679
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Mon, 29 Jan 2018 19:28:05 +0000 (19:28 +0000)]
[clang-format] Disable some text proto delimiters and functions for google style
Summary:
This disables some of the most commonly used text proto delimiters and functions
for google style until we resolve several style options for that style.
In particular, wheter there should be a space surrounding braces ``msg { sub { key : value } }``
and the extent of packing of submessages on a same line.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D42651
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323678
91177308-0d34-0410-b5e6-
96231b3b80d8
Ben Hamilton [Mon, 29 Jan 2018 17:36:43 +0000 (17:36 +0000)]
[clang-format] Fix bug where -dump-config failed on ObjC header
Summary:
`clang-format -dump-config path/to/file.h` never passed
anything for the Code parameter to clang::format::getStyle().
This meant the logic to guess Objective-C from the contents
of a .h file never worked, because LibFormat didn't have the
code to work with.
With this fix, we now correctly read in the contents of the
file if possible with -dump-config.
I had to update the lit config for test/Format/ because
the default config ignores .h files.
Test Plan: make -j12 check-clang
Reviewers: jolesiak, krasimir
Reviewed By: jolesiak, krasimir
Subscribers: Wizard, klimek, cfe-commits, djasper
Differential Revision: https://reviews.llvm.org/D42395
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323668
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonathan Roelofs [Mon, 29 Jan 2018 16:49:34 +0000 (16:49 +0000)]
[scan-build] Add an option to skip overriding CC and CXX make vars
Autoconf and some other systems tend to add essential compilation
options to CC (e.g. -std=gnu99). When running such an auto-generated
makefile, scan-build does not need to change CC and CXX as they are
already set to use ccc-analyzer by a configure script.
Implement a new option --keep-cc as was proposed in this discussion:
http://lists.llvm.org/pipermail/cfe-dev/2013-September/031832.html
Patch by Paul Fertser!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323665
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonathan Roelofs [Mon, 29 Jan 2018 16:37:53 +0000 (16:37 +0000)]
[analyzer] Fix -x language argument for C preprocessed sources
clang's -x option doesn't accept c-cpp-output as a language (even though
463eb6ab was merged, the driver still doesn't handle that).
This bug prevents testing C language projects when ccache is used.
Fixes #25851.
Investigation and patch by Dave Rigby.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323664
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Liu [Mon, 29 Jan 2018 13:21:23 +0000 (13:21 +0000)]
[Lexer] Support adding working directory to relative search dir for #include shortening in HeaderSearch.
Reviewers: bkramer
Subscribers: mgorny, hintonda, cfe-commits
Differential Revision: https://reviews.llvm.org/D42577
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323647
91177308-0d34-0410-b5e6-
96231b3b80d8
Hiroshi Inoue [Mon, 29 Jan 2018 05:15:18 +0000 (05:15 +0000)]
[NFC] fix trivial typos in comments
"to to" -> "to"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323627
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Neilson [Sun, 28 Jan 2018 17:27:45 +0000 (17:27 +0000)]
Change memcpy/memove/memset to have dest and source alignment attributes.
Summary:
This change is step three in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API.
Step 4) Update Polly to use the new IRBuilder API.
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use getDestAlignment()
and getSourceAlignment() instead.
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reference
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20151109/312083.html
Reviewers: rjmccall
Subscribers: jyknight, nemanjai, nhaehnle, javed.absar, sbc100, aheejin, kbarton, fedor.sergeev, cfe-commits
Differential Revision: https://reviews.llvm.org/D41677
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323617
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonas Hahnfeld [Sun, 28 Jan 2018 10:11:25 +0000 (10:11 +0000)]
[git-clang-format] Process CUDA files
Clang supports compiling CUDA source files for some time,
format them by default as well.
Differential Revision: https://reviews.llvm.org/D42589
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323615
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Horvath [Sat, 27 Jan 2018 16:38:56 +0000 (16:38 +0000)]
Attempt to make the PS4 build bot happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323590
91177308-0d34-0410-b5e6-
96231b3b80d8
Gabor Horvath [Sat, 27 Jan 2018 16:11:45 +0000 (16:11 +0000)]
[ASTImporter] Add support to import some AST nodes:
* CXXOperatorCallExpr
* SizeOfPackExpr
* DependentTemplateSpecializationType
* DependentSizedArray
* CXXTypeidExpr
* Fix importing CXXTemporaryObjectExpr
Some of the changes are based on
https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp
Differential Revision: https://reviews.llvm.org/D42335
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323589
91177308-0d34-0410-b5e6-
96231b3b80d8
Akira Hatanaka [Sat, 27 Jan 2018 00:34:09 +0000 (00:34 +0000)]
[CodeGen] Use the non-virtual alignment when emitting the base
constructor.
Previously, clang would emit an over-aligned (16-byte) store to
initialize B::x in B's base constructor when compiling the following
code:
struct A {
__attribute__((aligned(16))) double data1;
};
struct B : public virtual A {
B() : x(123) {}
double a;
int x;
};
struct C : public virtual B {};
void test() { B b; C c; }
This was happening because the code in IRGen that does member
initialization was using the alignment of a complete object instead of
the non-virtual alignment.
This commit fixes the bug.
rdar://problem/
36382481
Differential Revision: https://reviews.llvm.org/D42521
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323578
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Davis [Sat, 27 Jan 2018 00:25:29 +0000 (00:25 +0000)]
Always allow "#pragma region".
Summary:
Both MS and PS4 targets are capable of recognizing the
existence of: #pragma region, #pragma endregion.
Since this pragma is only a hint for certain editors, and has no logic,
it seems helpful to permit this pragma in all cases, not just MS compatibility mode.
Reviewers: rnk, rsmith, majnemer
Reviewed By: majnemer
Subscribers: Quuxplusone, probinson, majnemer, cfe-commits
Differential Revision: https://reviews.llvm.org/D42248
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323577
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 26 Jan 2018 20:01:13 +0000 (20:01 +0000)]
Try to unbreak 32 bit builds after r323528.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323554
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 26 Jan 2018 19:34:45 +0000 (19:34 +0000)]
[X86] Add 'rdrnd' feature to silvermont to match recent gcc bug fix.
gcc recently fixed this bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83546
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323552
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Fri, 26 Jan 2018 19:26:12 +0000 (19:26 +0000)]
[index] Fix crash when indexing a C++14 PCH/module related to TemplateTemplateParmDecls of alias templates
TemplateTemplateParmDecls of alias templates ended-up serialized as 'file-level decls' which was causing a crash while trying to index a PCH/module file that contained them.
Commit makes sure TemplateTemplateParmDecls are not recorded as such kind of decls.
Fixes crash of rdar://
36608297
Differential Revision: https://reviews.llvm.org/D42588
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323549
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Fri, 26 Jan 2018 19:08:26 +0000 (19:08 +0000)]
AST: support protocol conformances on id/class/interfaces in MS ABI
Add support for mangling ObjC protocol conformances in MS ABI as if they are
COM interfaces. By diverging from the itanium mangling of `objc_protocol`
prefixed names, this approach allows for a semi-reasonable, albeit of
questionable sanity, undecoration via existing tooling. There is also the
possibility of adding an extension and taking part of the namespace to add the
conformance via the `L` and `Z` "modifiers", but the existing tooling would not
be able to properly undecorated the symbol even though incidentally `undname`
currently produces something legible while wine's implementation is not able to
cope with the extension.
This allows for the disambiguation of overloads where the parameter differs
only in the protocol conformance of the ObjC type, e.g.
```
@protocol P;
void f(std::vector<id>);
void f(std::vector<id<P>>);
```
which clang would previously fail due to the mangling being identical as the
protocol conformance was ignored.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323547
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 26 Jan 2018 18:31:14 +0000 (18:31 +0000)]
[X86] Define __IBT__ when -mibt is specified.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323543
91177308-0d34-0410-b5e6-
96231b3b80d8
Martin Probst [Fri, 26 Jan 2018 15:07:49 +0000 (15:07 +0000)]
clang-format: [JS] Prevent ASI before [ and (.
Summary:
JavaScript automatic semicolon insertion can trigger before [ and (, so
avoid breaking before them if the previous token is likely to terminate
an expression.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D42570
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323532
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 26 Jan 2018 14:14:11 +0000 (14:14 +0000)]
[AST] Use bit packing to reduce sizeof(TypedefNameDecl) from 88 to 80.
We can stash the cached transparent tag bit in existing pointer padding.
Everything coming out of ASTContext is always aligned to a multiple of
8, so we have 8 spare bits.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323528
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam McCall [Fri, 26 Jan 2018 12:06:44 +0000 (12:06 +0000)]
[ASTImporter] avoid warnings: unused var, switch covered
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323524
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bader [Fri, 26 Jan 2018 11:48:46 +0000 (11:48 +0000)]
[OpenCL] Add "cles_khr_int64" extension.
Summary:
For OpenCL 1.1 embedded profile 64 bit integers i.e. long,
ulong including the appropriate vector data types and operations
on 64-bit integers are optional. The "cles_khr_int64" extension
string will be reported if the embedded profile implementation
supports 64-bit integers.
Reviewers: Anastasia, bader
Reviewed By: Anastasia, bader
Subscribers: bader, yaxunl, Anastasia, cfe-commits
Differential Revision: https://reviews.llvm.org/D42532
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323522
91177308-0d34-0410-b5e6-
96231b3b80d8
Aleksei Sidorin [Fri, 26 Jan 2018 11:36:54 +0000 (11:36 +0000)]
[ASTImporter] Support LambdaExprs and improve template support
Also, a number of style and bug fixes was done:
* ASTImporterTest: added sanity check for source node
* ExternalASTMerger: better lookup for template specializations
* ASTImporter: don't add templated declarations into DeclContext
* ASTImporter: introduce a helper, ImportTemplateArgumentListInfo getting SourceLocations
* ASTImporter: proper set ParmVarDecls for imported FunctionProtoTypeLoc
Differential Revision: https://reviews.llvm.org/D42301
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323519
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Liu [Fri, 26 Jan 2018 11:10:32 +0000 (11:10 +0000)]
[Tooling] Test more APIs of ToolExecutor. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323517
91177308-0d34-0410-b5e6-
96231b3b80d8
Hiroshi Inoue [Fri, 26 Jan 2018 08:15:52 +0000 (08:15 +0000)]
[NFC] fix trivial typos in comments and documents
"in in" -> "in", "on on" -> "on" etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323509
91177308-0d34-0410-b5e6-
96231b3b80d8
Amara Emerson [Fri, 26 Jan 2018 00:27:22 +0000 (00:27 +0000)]
[Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel.
Differential Revision: https://reviews.llvm.org/D42276
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323485
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Thu, 25 Jan 2018 21:49:03 +0000 (21:49 +0000)]
Don't let test write to the source dir after r323426.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323473
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Thu, 25 Jan 2018 19:54:31 +0000 (19:54 +0000)]
AST: inline a single-use variable (NFC)
Inline the single use variable into the only use. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323461
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 25 Jan 2018 15:57:22 +0000 (15:57 +0000)]
Unused diagnostics can occur in tblgen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323435
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Thu, 25 Jan 2018 15:24:43 +0000 (15:24 +0000)]
[clang-cl] Add support for /arch:AVX512F and /arch:AVX512
For /arch:AVX512F:
clang-cl and cl.exe both defines __AVX512F__ __AVX512CD__.
clang-cl also defines __AVX512ER__ __AVX512PF__.
64-bit cl.exe also defines (according to /Bz) _NO_PREFETCHW.
For /arch:AVX512:
clang-cl and cl.exe both define
__AVX512F__ __AVX512CD__ __AVX512BW__ __AVX512DQ__ __AVX512VL__.
64-bit cl.exe also defines _NO_PREFETCHW.
So not 100% identical, but pretty close.
Also refactor the existing AVX / AVX2 code to not repeat itself in both the
32-bit and 64-bit cases.
https://reviews.llvm.org/D42538
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323433
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Thu, 25 Jan 2018 14:38:29 +0000 (14:38 +0000)]
clang-cl: Simplify handling of /arch: flag.
r213083 initially implemented /arch: support by mapping it to CPU features.
Then r241077 additionally mapped it to CPU, which made the feature flags
redundant (if harmless). This change here removes the redundant mapping to
feature flags, and rewrites test/Driver/cl-x86-flags.c to be a bit more of an
integration test that checks for preprocessor defines like AVX (like documented
on MSDN) instead of for driver flags.
To keep emitting warn_drv_unused_argument, use getLastArgNoClaim() followed by an explicit claim() if needed.
This is in preparation for adding support for /arch:AVX512(F).
No intended behavior change.
https://reviews.llvm.org/D42497
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323426
91177308-0d34-0410-b5e6-
96231b3b80d8
Ivan A. Kosarev [Thu, 25 Jan 2018 14:21:55 +0000 (14:21 +0000)]
[CodeGen] Decorate aggregate accesses with TBAA tags
Differential Revision: https://reviews.llvm.org/D41539
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323421
91177308-0d34-0410-b5e6-
96231b3b80d8
Krasimir Georgiev [Thu, 25 Jan 2018 14:10:43 +0000 (14:10 +0000)]
[clang-format] Fixes indentation of inner text proto messages
Summary:
Consider the text proto:
```
message {
sub { key: value }
}
```
Previously the first `{` was TT_Unknown, which caused the inner message to be
indented by the continuation width. This didn't happen for:
```
message {
sub: { key: value }
}
```
This is because the code to mark the first `{` as a TT_DictLiteral was only
considering the case where it marches forward and reaches a `:`.
This patch updates this by looking not only for `:`, but also for `<` and `{`.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D42500
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323419
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Dardis [Thu, 25 Jan 2018 10:09:33 +0000 (10:09 +0000)]
[Driver] Add support for mips32 and scudo
r317337 missed that scudo is supported on MIPS32, so permit that option for
MIPS32.
Reviewers: cryptoad, atanasyan
Differential Revision: https://reviews.llvm.org/D42416
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323412
91177308-0d34-0410-b5e6-
96231b3b80d8
Kamil Rytarowski [Wed, 24 Jan 2018 23:08:49 +0000 (23:08 +0000)]
FreeBSD needs also execinfo (in sanitizers)
Summary: As NetBSD, FreeBSD needs execinfo for backtrace's matters.
Patch by: David CARLIER.
Reviewers: joerg, vitalybuka
Reviewed By: vitalybuka
Subscribers: emaste, krytarowski, cfe-commits
Differential Revision: https://reviews.llvm.org/D42467
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323387
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Shaposhnikov [Wed, 24 Jan 2018 22:17:30 +0000 (22:17 +0000)]
[analyzer] Do not attempt to get the pointee of void*
Do not attempt to get the pointee of void* while generating a bug report
(otherwise it will trigger an assert inside RegionStoreManager::getBinding
assert(!T->isVoidType() && "Attempting to dereference a void pointer!")).
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D42396
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323382
91177308-0d34-0410-b5e6-
96231b3b80d8
Brian Gesiak [Wed, 24 Jan 2018 22:15:42 +0000 (22:15 +0000)]
[coroutines] Pass coro func args to promise ctor
Summary:
Use corutine function arguments to initialize a promise type, but only
if the promise type defines a constructor that takes those arguments.
Otherwise, fall back to the default constructor.
Test Plan: check-clang
Reviewers: rsmith, GorNishanov, eric_niebler
Reviewed By: GorNishanov
Subscribers: toby-allsopp, lewissbaker, EricWF, cfe-commits
Differential Revision: https://reviews.llvm.org/D41820
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323381
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 24 Jan 2018 21:24:10 +0000 (21:24 +0000)]
[analyzer] NFC: Run many existing C++ tests with a custom operator new().
In order to provide more test coverage for inlined operator new(), add more
run-lines to existing test cases, which would trigger our fake header
to provide a body for operator new(). Most of the code should still behave
reasonably. When behavior intentionally changes, #ifs are provided.
Differential Revision: https://reviews.llvm.org/D42221
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323376
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 24 Jan 2018 20:59:40 +0000 (20:59 +0000)]
[analyzer] Enable c++-allocator-inlining by default.
This allows the analyzer to analyze ("inline") custom operator new() calls and,
even more importantly, inline constructors of objects that were allocated
by any operator new() - not necessarily a custom one.
All changes in the tests in the current commit are intended improvements,
even if they didn't carry any explicit FIXME flag.
It is possible to restore the old behavior via
-analyzer-config c++-allocator-inlining=false
(this flag is supported by scan-build as well, and it can be into a clang
--analyze invocation via -Xclang .. -Xclang ..). There is no intention to
remove the old behavior for now.
Differential Revision: https://reviews.llvm.org/D42219
rdar://problem/
12180598
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323373
91177308-0d34-0410-b5e6-
96231b3b80d8
Artem Dergachev [Wed, 24 Jan 2018 20:32:26 +0000 (20:32 +0000)]
[analyzer] Assume that the allocated value is non-null before construction.
I.e. not after. In the c++-allocator-inlining=true mode, we need to make the
assumption that the conservatively evaluated operator new() has returned a
non-null value. Previously we did this on CXXNewExpr, but now we have to do that
before calling the constructor, because some clever constructors are sometimes
assuming that their "this" is null and doing weird stuff. We would also crash
upon evaluating CXXNewExpr when the allocator was inlined and returned null and
had a throw specification; this is UB even for custom allocators, but we still
need not to crash.
Added more FIXME tests to ensure that eventually we fix calling the constructor
for null return values.
Differential Revision: https://reviews.llvm.org/D42192
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323370
91177308-0d34-0410-b5e6-
96231b3b80d8
Vassil Vassilev [Wed, 24 Jan 2018 19:26:50 +0000 (19:26 +0000)]
Revert r323051 "[cmake] Use CLANG_BINARY_DIR to determine the build directory."
This broke swift builds.
Thanks for the post-commit review of Chris Bieneman and Davide Italiano!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323368
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Wed, 24 Jan 2018 18:59:58 +0000 (18:59 +0000)]
IRGen: Emit an inline implementation of __builtin_wmemcmp on MSVCRT platforms.
The MSVC runtime library does not provide a definition of wmemcmp,
so we need an inline implementation.
Differential Revision: https://reviews.llvm.org/D42441
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323362
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 24 Jan 2018 18:58:32 +0000 (18:58 +0000)]
Don't create hidden dllimport global values.
Hidden visibility is almost the opposite of dllimport. We were
producing them before (dllimport wins in the existing llvm
implementation), but now the llvm verifier produces an error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323361
91177308-0d34-0410-b5e6-
96231b3b80d8