Richard Smith [Thu, 16 Oct 2014 23:00:46 +0000 (23:00 +0000)]
Re-commit r217995 and follow-up patches (r217997, r218011, r218053). These were
reverted in r218058 because they triggered a rejects-valid bug in MSVC.
Original commit message from r217995:
Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219977
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Thu, 16 Oct 2014 22:42:53 +0000 (22:42 +0000)]
Sema: handle additional case of qualified types
A second instance of attributed types escaped the previous change, identified
thanks to Richard Smith! When deducing the void case, we would also assume that
the type would not be attributed. Furthermore, properly handle multiple
attributes being applied to a single TypeLoc.
Properly handle this case and future-proof a bit by ignoring parenthesis
further. The test cases do use the additional parenthesis to ensure that this
case remains properly handled.
Addresses post-commit review comments from Richard Smith to SVN r219851.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219974
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Thu, 16 Oct 2014 21:36:23 +0000 (21:36 +0000)]
test/CodeGen/sections.c: add triple
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219969
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 16 Oct 2014 21:22:40 +0000 (21:22 +0000)]
trying to fix the new test on hexagon-build
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219965
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 16 Oct 2014 20:54:52 +0000 (20:54 +0000)]
Insert poisoned paddings between fields in C++ classes so that AddressSanitizer can find intra-object-overflow bugs
Summary:
The general approach is to add extra paddings after every field
in AST/RecordLayoutBuilder.cpp, then add code to CTORs/DTORs that poisons the paddings
(CodeGen/CGClass.cpp).
Everything is done under the flag -fsanitize-address-field-padding.
The blacklist file (-fsanitize-blacklist) allows to avoid the transformation
for given classes or source files.
See also https://code.google.com/p/address-sanitizer/wiki/IntraObjectOverflow
Test Plan: run SPEC2006 and some of the Chromium tests with -fsanitize-address-field-padding
Reviewers: samsonov, rnk, rsmith
Reviewed By: rsmith
Subscribers: majnemer, cfe-commits
Differential Revision: http://reviews.llvm.org/D5687
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219961
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Thu, 16 Oct 2014 20:52:46 +0000 (20:52 +0000)]
MS Compat: mark globals emitted in read-only sections const
They cannot be written to, so marking them const makes sense and may improve
optimisation.
As a side-effect, SectionInfos has to be moved from Sema to ASTContext.
It also fixes this problem, that occurs when compiling ATL:
warning LNK4254: section 'ATL' (
C0000040) merged into '.rdata' (
40000040) with different attributes
The ATL headers are putting variables in a special section that's marked
read-only. However, Clang currently can't model that read-onlyness in the IR.
But, by making the variables const, the section does become read-only, and
the linker warning is avoided.
Differential Revision: http://reviews.llvm.org/D5812
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219960
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 16 Oct 2014 20:13:28 +0000 (20:13 +0000)]
No longer emit diagnostics about unused results (comparisons, etc) from unevaluated contexts. Fixes PR18571.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219954
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 16 Oct 2014 20:00:22 +0000 (20:00 +0000)]
Update for llvm change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219952
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 16 Oct 2014 18:38:36 +0000 (18:38 +0000)]
DebugInfo: Follow up to r219736, also test/demonstrate that we emit the constant value in this case as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219943
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 16 Oct 2014 18:09:29 +0000 (18:09 +0000)]
Fixing comment grammar; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219942
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Thu, 16 Oct 2014 17:57:41 +0000 (17:57 +0000)]
Speculatively fix GCC 4.7 build after r219938
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219941
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Thu, 16 Oct 2014 17:53:07 +0000 (17:53 +0000)]
Switching to range-based for loops; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219940
91177308-0d34-0410-b5e6-
96231b3b80d8
Samuel Benzaquen [Thu, 16 Oct 2014 17:50:19 +0000 (17:50 +0000)]
Fix code to follow the "Don’t use else after a return" rule.
Summary:
Fix code to follow the "Don’t use else after a return" rule.
This is a followup from rL219792.
Reviewers: alexfh
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D5826
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219939
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 16 Oct 2014 17:23:58 +0000 (17:23 +0000)]
Use iterators and algorithms to possibly make this code a bit tidier
(also, the code executed once the element was found was split half
inside the loop and half after it - now put it all together after the
find operation)
I'm a bit concerned that this code is rather untested (commenting out
this whole function and running check-clang doesn't fail any tests)...
And I wish I had polymorphic lambdas.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219938
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 16 Oct 2014 17:10:38 +0000 (17:10 +0000)]
Remove one of SanitizerBlacklist::isIn() overloads. NFC.
The final goal is to get rid of all the rest overloads that
accept LLVM objects (llvm::Function and llvm::GlobalVariable),
and pass in source-level entities instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219937
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Thu, 16 Oct 2014 16:54:36 +0000 (16:54 +0000)]
Use array_lengthof; NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219935
91177308-0d34-0410-b5e6-
96231b3b80d8
Bradley Smith [Thu, 16 Oct 2014 16:35:14 +0000 (16:35 +0000)]
[AArch64] Enable A53 erratum workaround (835769) by default for Android targets
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219933
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Thu, 16 Oct 2014 16:12:41 +0000 (16:12 +0000)]
tests: move test to more appropriate location
The test is a C++ semantic analysis test, move it to SemaCXX from Sema. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219932
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Thu, 16 Oct 2014 15:29:19 +0000 (15:29 +0000)]
OpenCL: Emit global variables in the constant addr space as constant globals
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219929
91177308-0d34-0410-b5e6-
96231b3b80d8
Tom Stellard [Thu, 16 Oct 2014 15:29:17 +0000 (15:29 +0000)]
OpenCL: Add -ffake-address-space-map to a test
The ensures there is an explicit address space id in the output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219928
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Thu, 16 Oct 2014 09:10:11 +0000 (09:10 +0000)]
clang-format: Fix behavior with comments before conditional expressions
Before:
SomeFunction(
aaaaaaaaaaaaaaaaa,
// comment.
ccccccccccccccccc ?
aaaaaaaaaaaaaaaaaaaa
:
bbbbbbbbbbbbbbbbbbbb);
After:
SomeFunction(
aaaaaaaaaaaaaaaaa,
// comment.
ccccccccccccccccc ?
aaaaaaaaaaaaaaaaaaaa :
bbbbbbbbbbbbbbbbbbbb);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219921
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Jasper [Thu, 16 Oct 2014 08:38:51 +0000 (08:38 +0000)]
clang-format: [ObjC] Fix method expression detection.
Before:
return (a)[foo bar : baz];
After:
return (a)[foo bar:baz];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219919
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Thu, 16 Oct 2014 06:00:55 +0000 (06:00 +0000)]
Frontend: Fix some underscore-then-capital UB
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219903
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Eremin [Thu, 16 Oct 2014 05:55:24 +0000 (05:55 +0000)]
specify dwarf version for Solaris
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219901
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 16 Oct 2014 04:21:25 +0000 (04:21 +0000)]
PR21246: DebugInfo: Emit the appropriate type (cv qualifiers, reference-ness, etc) for non-type template parameters
Plumb through the full QualType of the TemplateArgument::Declaration, as
it's insufficient to only know whether the type is a reference or
pointer (that was necessary for mangling, but insufficient for debug
info). This shouldn't increase the size of TemplateArgument as
TemplateArgument::Integer is still longer by another 32 bits.
Several bits of code were testing that the reference-ness of the
parameters matched, but this seemed to be insufficient (various other
features of the type could've mismatched and wouldn't've been caught)
and unnecessary, at least insofar as removing those tests didn't cause
anything to fail.
(Richard - perchaps you can hypothesize why any of these checks might
need to test reference-ness of the parameters (& explain why
reference-ness is part of the mangling - I would've figured that for the
reference-ness to be different, a prior template argument would have to
be different). I'd be happy to add them in/beef them up and add test
cases if there's a reason for them)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219900
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Thu, 16 Oct 2014 03:04:35 +0000 (03:04 +0000)]
Bugfix in template instantiation in CXXPseudoDestructorExpr.
Fix for clang crash when instantiating a template with qualified lookup for members in non-class types.
Differential Revision: http://reviews.llvm.org/D5769
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219897
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 16 Oct 2014 00:41:40 +0000 (00:41 +0000)]
DebugInfo: Cleanup testing of non-type template parameters.
Separate out the non-nullable parameters from the nullable ones
(currently only the template template parameter) and demonstrate that
cv-qualifiers aren't preserved for non-null parameters (but are
preserved for null parameters) by adding 'const' to an int* non-type
template parameter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219883
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Thu, 16 Oct 2014 00:12:02 +0000 (00:12 +0000)]
[CMake] clangBasic: Add Core to LINK_COMPONENTS introduced by r219840.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219880
91177308-0d34-0410-b5e6-
96231b3b80d8
Hal Finkel [Wed, 15 Oct 2014 23:45:08 +0000 (23:45 +0000)]
Moving CGF::EmitAlignmentAssumption to IRBuilder
The functionality contained in CodeGenFunction::EmitAlignmentAssumption has
been moved to IRBuilder (so that it can also be used by LLVM-level code).
Remove this now-duplicate implementation in favor of the IRBuilder code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219877
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 15 Oct 2014 22:38:23 +0000 (22:38 +0000)]
CodeGen: Don't drop thread_local when emitting __thread aliases
CodeGen wouldn't mark the aliasee as thread_local if the aliasee was a
tentative definition.
Even if the definition was already emitted, it would never mark the
alias as thread_local.
This fixes PR21288.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219859
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 15 Oct 2014 22:17:27 +0000 (22:17 +0000)]
Move SanitizerBlacklist object from CodeGenModule to ASTContext.
Soon we'll need to have access to blacklist before the CodeGen
phase (see http://reviews.llvm.org/D5687), so parse and construct
the blacklist earlier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219857
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 15 Oct 2014 22:00:40 +0000 (22:00 +0000)]
Avoid having "using namespace" for both "clang" and "llvm" namespaces.
This is fragile, as there are classes with the same name in both
namespaces (e.g. llvm::Module and clang::Module).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219855
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Wed, 15 Oct 2014 21:37:55 +0000 (21:37 +0000)]
Sema: handle AttributedTypeLocs in C++14 auto deduction
When performing a type deduction from the return type, the FunctionDecl may be
attributed with a calling convention. In such a case, the retrieved type
location may be an AttributedTypeLoc. Performing a castAs<FunctionProtoTypeLoc>
on such a type loc would result in an assertion as they are not derived types.
Ensure that we correctly handle the attributed type location by looking through
it to the modified type loc.
Fixes an assertion triggered in C++14 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219851
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Wed, 15 Oct 2014 21:37:52 +0000 (21:37 +0000)]
test: simplify test further
Remove the use of an unnecessary function. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219850
91177308-0d34-0410-b5e6-
96231b3b80d8
Samuel Benzaquen [Wed, 15 Oct 2014 21:23:31 +0000 (21:23 +0000)]
Change hasName() to take const std::string&, as it was taking before rL219792.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219849
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 15 Oct 2014 20:22:54 +0000 (20:22 +0000)]
Move -fsanitize-blacklist to LangOpts from CodeGenOpts. NFC.
After http://reviews.llvm.org/D5687 is submitted, we will need
SanitizerBlacklist before the CodeGen phase, so make it a LangOpt
(as it will actually affect ABI / class layout).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219842
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Wed, 15 Oct 2014 19:57:45 +0000 (19:57 +0000)]
Move SanitizerBlacklist to clangBasic. NFC.
This change moves SanitizerBlacklist.h from lib/CodeGen
to public Clang headers in include/clang/Basic. SanitizerBlacklist
is currently only used in CodeGen to decide which functions/modules
should be instrumented, but this will soon change as ASan will
optionally modify class layouts during AST construction
(http://reviews.llvm.org/D5687). We need blacklist machinery
to be available at this point.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219840
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 15 Oct 2014 19:52:03 +0000 (19:52 +0000)]
As requested by Matt Thomas, use long long for intmax_t and int64_t on
PPC64/NetBSD.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219839
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 15 Oct 2014 19:47:15 +0000 (19:47 +0000)]
Set ABI and DescriptionString first to reduce OS specific logic.
Use switch for FreeBSD check to allow easier extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219838
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Wed, 15 Oct 2014 18:03:26 +0000 (18:03 +0000)]
Add llvm_unreachable after switch to avoid warnings about a missing
return.
Forgot to add this in r219818.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219820
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Wed, 15 Oct 2014 17:46:18 +0000 (17:46 +0000)]
Drop unneccessary default case from switch introduced in r219809
This silences:
../tools/clang/tools/libclang/CIndex.cpp:6451:3: warning: default label
in switch which covers all enumeration values [-Wcovered-switch-default]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219818
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 15 Oct 2014 17:22:56 +0000 (17:22 +0000)]
Revert "Fix late template parsing leak with incremental processing"
This reverts commit r219810.
The test suite appears broken.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219813
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Yartsev [Wed, 15 Oct 2014 17:13:02 +0000 (17:13 +0000)]
[analyzer] Perl scripts are run differently from makefiles. Sometimes additional utilities are involved, e.g. 'env' utility that present in MSYS but is missing in MinGW. The patch unifies launch of "c++-analyzer" and "ccc-analyzer".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219812
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 15 Oct 2014 17:08:33 +0000 (17:08 +0000)]
Fix late template parsing leak with incremental processing
Add a second late template parser callback meant to cleanup any
resources allocated by late template parsing. Call it from the
Sema::ActOnEndOfTranslationUnit method after all pending template
instantiations have been completed. Teach Parser::ParseTopLevelDecl to
install the cleanup callback when incremental processing is enabled so
that Parser::TemplateIds can be freed.
Patch by Brad King!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219810
91177308-0d34-0410-b5e6-
96231b3b80d8
Argyrios Kyrtzidis [Wed, 15 Oct 2014 17:05:31 +0000 (17:05 +0000)]
[libclang] Add function to retrieve storage class in libclang.
Patch by guibufolo!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219809
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Wed, 15 Oct 2014 16:58:18 +0000 (16:58 +0000)]
Adding attributes to the IndirectFieldDecl that we generate for anonymous struct/union fields. This fixes PR20930.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219807
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 15 Oct 2014 16:38:00 +0000 (16:38 +0000)]
Don't use a global_ctors comdat for globals that aren't externally visible
In particular, if you have two identical templates in different TUs in
anonymous namespaces, we would use the same global_ctors comdat key for
both. As a result, only one would be run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219806
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 15 Oct 2014 16:36:11 +0000 (16:36 +0000)]
CodeGen: Cleanup CGRecordLowering::lowerUnion a little
Remove some duplicated state, no functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219805
91177308-0d34-0410-b5e6-
96231b3b80d8
Dario Domizioli [Wed, 15 Oct 2014 16:18:20 +0000 (16:18 +0000)]
Fix for PR21254 - Assertion in comment parser
The size of the ID field in CommandInfo was narrow, leading to potential
wrap-around of command IDs, causing misinterpretation later on.
The patch does the following:
- It extends the ID bitfield from 8 to 20 bits.
- It provides a DRY definition of the number of bits for the field to
avoid using literal numbers in different files.
- It introduces a new assertion that checks for the wrap-around.
- It adds the testcase from PR21254.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219802
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 15 Oct 2014 16:12:57 +0000 (16:12 +0000)]
Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219800
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Wed, 15 Oct 2014 15:44:25 +0000 (15:44 +0000)]
Update for llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219797
91177308-0d34-0410-b5e6-
96231b3b80d8
Aaron Ballman [Wed, 15 Oct 2014 15:37:51 +0000 (15:37 +0000)]
Turned Sema::HandleDelayedAvailabilityCheck into a static function; NFC.
Did a bit of drive-by reformatting as well since it required rearranging some other static functions in the file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219795
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Yartsev [Wed, 15 Oct 2014 15:11:45 +0000 (15:11 +0000)]
[analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219794
91177308-0d34-0410-b5e6-
96231b3b80d8
Samuel Benzaquen [Wed, 15 Oct 2014 14:58:46 +0000 (14:58 +0000)]
Speed up hasName() matcher.
Summary:
Speed up hasName() matcher by skipping the expensive generation of the
fully qualified name unless we need it.
In the common case of matching an unqualified name, we don't need to
generate the full name. We might not even need to copy any string at
all.
This change speeds up our clang-tidy benchmark by ~10%
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D5776
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219792
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexander Kornienko [Wed, 15 Oct 2014 11:03:39 +0000 (11:03 +0000)]
Fixed a comment. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219787
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 15 Oct 2014 07:57:41 +0000 (07:57 +0000)]
CodeGen: Use the initing member's type for a union's storage type more often
Unions are initialized with the default initialization of their first
named member. If that member is not zero initialized, then we should
prefer that member's type. Otherwise, we might try to make an otherwise
unsuitable type (like an array) which we cannot easily initialize with a
pointer to member.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219781
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 15 Oct 2014 07:57:38 +0000 (07:57 +0000)]
CodeGen: Fix a typo in a comment
No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219780
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 15 Oct 2014 04:54:54 +0000 (04:54 +0000)]
MS ABI: Use the correct this arg when generating implicit array copy ctor
We assumed the last argument of the copy constructor was the this
pointer. However, this is not the case under the MS ABI.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219775
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Trieu [Wed, 15 Oct 2014 03:42:06 +0000 (03:42 +0000)]
Improvements to -Wnull-conversion
Split logic to separate checking function
Refine the macro checking
Catch nullptr->bool conversions
Add some explanatory comments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219774
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Wed, 15 Oct 2014 00:33:06 +0000 (00:33 +0000)]
Frontend: Don't accept null DiagnosticsEngines when building ASTUnits
The various ways to create an ASTUnit all take a refcounted pointer to
a diagnostics engine as an argument, and if it isn't pointing at
anything they initialize it. This is a pretty confusing API, and it
really makes more sense for the caller to initialize the thing since
they control the lifetime anyway.
This fixes the one caller that didn't bother initializing the pointer
and asserts that the argument is initialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219752
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 14 Oct 2014 23:36:06 +0000 (23:36 +0000)]
Frontend: Remove some unused arguments in ASTUnit (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219747
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Tue, 14 Oct 2014 23:20:25 +0000 (23:20 +0000)]
vadefs.h: be even more conservative and only define the macros if already defined
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219745
91177308-0d34-0410-b5e6-
96231b3b80d8
Ehsan Akhgari [Tue, 14 Oct 2014 23:15:44 +0000 (23:15 +0000)]
clang-cl: Diagnose the usage of ASAN with a debug runtime library
Summary:
AddressSanitizer currently doesn't support this configuration, and binaries
built with it will just get into an infinite loop during startup.
Test Plan: Includes an automated test.
Reviewers: samsonov
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5764
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219744
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Tue, 14 Oct 2014 23:15:43 +0000 (23:15 +0000)]
Sort files list in lib/Headers/CMakeLists.txt
majnemer pointed out that vadefs.h was added in the wrong place. Might
as well sort the rest too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219743
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Tue, 14 Oct 2014 22:35:42 +0000 (22:35 +0000)]
MS Compat: interpose vadefs.h to fix definitions of _crt_va_{start,end,arg} (PR21247)
Differential revision: http://reviews.llvm.org/D5784
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219740
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Tue, 14 Oct 2014 22:22:17 +0000 (22:22 +0000)]
DebugInfo: Lazily built static member variable declarations should use the canonical declaration for line/file information.
When lazily constructing static member variable declarations (when
the vtable optimization fires and the definition of the type is omitted
(or built later, lazily), but the out of line definition of the static
member is provided and must be described in debug info) ensure we use
the canonical declaration when computing the file, line, etc for that
declaration (rather than the definition, which is also a declaration,
but not the canonical one).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219736
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Tue, 14 Oct 2014 22:12:21 +0000 (22:12 +0000)]
ARM: remove ARM/Thumb distinction for preferred alignment.
Thumb1 has legitimate reasons for preferring 32-bit alignment of types
i1/i8/i16, since the 16-bit encoding of "add rD, sp, #imm" requires #imm to be
a multiple of 4. However, this is a trade-off betweem code size and RAM usage;
the DataLayout string is not the best place to represent it even if desired.
So this patch removes the extra Thumb requirements, hopefully making ARM and
Thumb completely compatible in this respect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219735
91177308-0d34-0410-b5e6-
96231b3b80d8
Kaelyn Takata [Tue, 14 Oct 2014 21:57:21 +0000 (21:57 +0000)]
Be smarter when parsing variable declarations with unknown types.
Specifically, avoid typo-correcting the variable name into a type before
typo-correcting the actual type name in the declaration. Doing so
results in a very unpleasant cascade of errors, with the typo correction
of the actual type name being buried in the middle.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219732
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Tue, 14 Oct 2014 20:57:29 +0000 (20:57 +0000)]
ARM: set preferred aggregate alignment to 32 universally.
Before, ARM and Thumb mode code had different preferred alignments, which could
lead to some rather unexpected results. There's justification for reducing it
from the default 64-bits (wasted space), but I don't think there is for going
below 32-bits.
There's no actual ABI change here, just to reassure people.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219720
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Tue, 14 Oct 2014 20:28:40 +0000 (20:28 +0000)]
Factor code into CXXRecordDecl::getTemplateInstantiationPattern() helper
This moves some code from SemaType.cpp's hasVisibleDefinition() into
DeclCXX.cpp so that it can be used elsewhere. I found one other instance
of code trying to do the same thing, there are probably more. Search for
getInstantiatedFrom() to try to find more.
No functionality change.
Reviewed By: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5783
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219714
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Tue, 14 Oct 2014 20:27:05 +0000 (20:27 +0000)]
Patch to warn on interger overflow in presence of
implicit casts. Reviewed by Reid Kleckner.
rdar://
18405357
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219712
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Tue, 14 Oct 2014 17:20:18 +0000 (17:20 +0000)]
CodeGen: correct block mangling in ObjC
Mangling for blocks defined within blocks in an ObjectiveC context were also
broken by SVN r219393. Because the code in mangleName assumed that the code was
either C or C++, we would trigger assertions when trying to mangle the inner
blocks in an ObjectiveC context.
Add a test and use the ObjectiveC specific mangling when dealing with an
ObjectiveC method declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219697
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Tue, 14 Oct 2014 17:20:14 +0000 (17:20 +0000)]
CodeGen: correct mangling for blocks
This addresses a regression introduced with SVN r219393. A block may be
contained within another block. In such a scenario, we would end up within a
BlockDecl, which is not a NamedDecl (as the names are synthesised). The cast to
a NamedDecl of the DeclContext would then assert as the types are unrelated.
Restore the mangling behaviour to that prior to SVN r219393. If the current
block is contained within a BlockDecl, walk up to the parent DeclContext,
recursively, until we have a non-BlockDecl. This is expected to be a NamedDecl.
Add in a couple of asserts to ensure that the assumption that we only encounter
a block within a NamedDecl or a BlockDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219696
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Tue, 14 Oct 2014 17:09:38 +0000 (17:09 +0000)]
Formatting for prior commit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219692
91177308-0d34-0410-b5e6-
96231b3b80d8
Ulrich Weigand [Tue, 14 Oct 2014 16:46:45 +0000 (16:46 +0000)]
[SystemZ] Address review comments for r219679
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219691
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Tue, 14 Oct 2014 16:43:46 +0000 (16:43 +0000)]
DebugInfo: Don't leak location information from one function into the prologue of the next function.
CodeGenFunction objects aren't really designed to be reused for more
than one function, and doing so can leak debug info location information
from one function into the prologue of the next.
Add an assertion in to catch reuses of CodeGenFunction, which
surprisingly only caught the ObjC atomic getter/setter cases. Fix those
and add a test to demonstrate the issue.
The test is a bit slim, because we're just testing for the absence of a
debug location on the prologue instructions, which by itself probably
wouldn't be the end of the world - but the particular debug location
that was ending up there was for the previous function's last
instruction. This produced debug info for another function within this
function, which is something I'm trying to remove all cases of as its a
substantial source of bugs, especially around inlining (see r219215).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219690
91177308-0d34-0410-b5e6-
96231b3b80d8
Ulrich Weigand [Tue, 14 Oct 2014 11:45:53 +0000 (11:45 +0000)]
[SystemZ] Add test case to verify default use of integrated assembler
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219679
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 14 Oct 2014 06:30:31 +0000 (06:30 +0000)]
Re-apply "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
I'd mispelled "Bitcode/BitCodes.h" before, and tested on a case
insensitive filesystem.
This reverts commit r219649, effectively re-applying r219647 and
r219648.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219664
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Tue, 14 Oct 2014 02:08:30 +0000 (02:08 +0000)]
Extend -Rmodule-build to also remark when module building finishes.
In cases of nested module builds, or when you care how long module builds take,
this information was not previously easily available / obvious.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219658
91177308-0d34-0410-b5e6-
96231b3b80d8
Richard Smith [Tue, 14 Oct 2014 02:00:47 +0000 (02:00 +0000)]
[modules] Merging for class-scope using-declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219657
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 14 Oct 2014 00:57:34 +0000 (00:57 +0000)]
Revert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
The bots can't seem to find an include file. Reverting for now and
I'll look into it in a bit.
This reverts commits r219647 and r219648.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219649
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 14 Oct 2014 00:51:18 +0000 (00:51 +0000)]
Frontend: Try to fix cmake builders after r219647
Looks like I missed a dependency here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219648
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Tue, 14 Oct 2014 00:40:55 +0000 (00:40 +0000)]
Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)
We currently read serialized diagnostics directly in the C API, which
makes it difficult to reuse this logic elsewhere. This extracts the
core of the serialized diagnostic parsing logic into a base class that
can be subclassed using a visitor pattern.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219647
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Mon, 13 Oct 2014 23:59:00 +0000 (23:59 +0000)]
Sanitize upcasts and conversion to virtual base.
This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
virtual base, we check that pointer-to-derived has a matching vptr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219642
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Mon, 13 Oct 2014 22:18:22 +0000 (22:18 +0000)]
Fix the build
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219637
91177308-0d34-0410-b5e6-
96231b3b80d8
Fariborz Jahanian [Mon, 13 Oct 2014 21:07:45 +0000 (21:07 +0000)]
Objective-C [Sema]. Fixes a bug in comparing qualified
Objective-C pointer types. In this case, checker incorrectly
claims incompatible pointer types if redundant protocol conformance
is specified. rdar://
18491222
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219630
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rose [Mon, 13 Oct 2014 19:38:02 +0000 (19:38 +0000)]
[analyzer] Check all 'nonnull' attributes, not just the first one.
Patch by Daniel Fahlgren!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219625
91177308-0d34-0410-b5e6-
96231b3b80d8
Samuel Benzaquen [Mon, 13 Oct 2014 18:17:11 +0000 (18:17 +0000)]
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
If it evaluates right-to-left, the vector gets moved before we read the
kind from it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219624
91177308-0d34-0410-b5e6-
96231b3b80d8
Samuel Benzaquen [Mon, 13 Oct 2014 17:38:12 +0000 (17:38 +0000)]
Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
Change r219118 fixed the bug for anyOf and eachOf, but it is still
present for unless.
The variadic wrapper doesn't have enough information to know how to
restrict the type. Different operators handle restrict failures in
different ways.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D5731
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219622
91177308-0d34-0410-b5e6-
96231b3b80d8
Chad Rosier [Mon, 13 Oct 2014 16:45:21 +0000 (16:45 +0000)]
Relinquish ownership of MS-style inline assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219619
91177308-0d34-0410-b5e6-
96231b3b80d8
Ulrich Weigand [Mon, 13 Oct 2014 13:49:39 +0000 (13:49 +0000)]
More OpenMP test case compatibility fixes
Allow "signext" in a couple of more places in recently
added test cases to fix failures on SystemZ.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219615
91177308-0d34-0410-b5e6-
96231b3b80d8
Bradley Smith [Mon, 13 Oct 2014 11:18:05 +0000 (11:18 +0000)]
[AArch64] Fixup test from A53 erratum patch after buildbot failures
Don't include stdint.h directly, instead typedef int64_t which is all we need.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219608
91177308-0d34-0410-b5e6-
96231b3b80d8
Renato Golin [Mon, 13 Oct 2014 10:22:48 +0000 (10:22 +0000)]
Adds support for the Cortex-A17 processor to Clang
Patch by Matthew Wahab.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219607
91177308-0d34-0410-b5e6-
96231b3b80d8
Bradley Smith [Mon, 13 Oct 2014 10:16:06 +0000 (10:16 +0000)]
[AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is
possible for a 64-bit multiply-accumulate instruction in AArch64 state to
generate an incorrect result. The details are quite complex and hard to
determine statically, since branches in the code may exist in some
circumstances, but all cases end with a memory (load, store, or prefetch)
instruction followed immediately by the multiply-accumulate operation.
The safest work-around for this issue is to make the compiler avoid emitting
multiply-accumulate instructions immediately after memory instructions and the
simplest way to do this is to insert a NOP.
This patch implements clang options to enable this workaround in the backend.
The work-around code generation is not enabled by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219604
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 13 Oct 2014 08:51:32 +0000 (08:51 +0000)]
Fix incompatibility issue in /OpenMP/parallel_num_threads_codegen.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219601
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 13 Oct 2014 08:23:51 +0000 (08:23 +0000)]
[OPENMP] Codegen for 'num_threads' clause in 'parallel' directive.
This patch generates call to "kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads);" library function before calling "kmpc_fork_call" each time there is an associated "num_threads" clause in the "omp parallel" directive.
Differential Revision: http://reviews.llvm.org/D5145
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219599
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 13 Oct 2014 06:21:04 +0000 (06:21 +0000)]
Fix test OpenMP/parallel_if_codegen.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219598
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 13 Oct 2014 06:02:40 +0000 (06:02 +0000)]
[OPENMP] Codegen for 'if' clause in 'parallel' directive.
Adds codegen for 'if' clause. Currently only for 'if' clause used with the 'parallel' directive.
If condition evaluates to true, the code executes parallel version of the code by calling __kmpc_fork_call(loc, 1, microtask, captured_struct/*context*/), where loc - debug location, 1 - number of additional parameters after "microtask" argument, microtask - is outlined finction for the code associated with the 'parallel' directive, captured_struct - list of variables captured in this outlined function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:
global_thread_id.addr = alloca i32
store i32 global_thread_id, global_thread_id.addr
zero.addr = alloca i32
store i32 0, zero.addr
kmpc_serialized_parallel(loc, global_thread_id);
microtask(global_thread_id.addr, zero.addr, captured_struct/*context*/);
kmpc_end_serialized_parallel(loc, global_thread_id);
Where loc - debug location, global_thread_id - global thread id, returned by __kmpc_global_thread_num() call or passed as a first parameter in microtask() call, global_thread_id.addr - address of the variable, where stored global_thread_id value, zero.addr - implicit bound thread id (should be set to 0 for serial call), microtask() and captured_struct are the same as in parallel call.
Also this patch checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D4716
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219597
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Bataev [Mon, 13 Oct 2014 03:27:35 +0000 (03:27 +0000)]
PredefinedExpr deserialization test in dependent context.
For commit r219561 - Fix deserialization of PredefinedExpr in dependent context.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219594
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sun, 12 Oct 2014 22:49:21 +0000 (22:49 +0000)]
[Modules] Make header standalone. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219591
91177308-0d34-0410-b5e6-
96231b3b80d8