]> granicus.if.org Git - clang/log
clang
10 years agoInsert poisoned paddings between fields in C++ classes so that AddressSanitizer can...
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

10 years agoMS Compat: mark globals emitted in read-only sections const
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

10 years agoNo longer emit diagnostics about unused results (comparisons, etc) from unevaluated...
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

10 years agoUpdate for llvm change.
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

10 years agoDebugInfo: Follow up to r219736, also test/demonstrate that we emit the constant...
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

10 years agoFixing comment grammar; NFC.
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

10 years agoSpeculatively fix GCC 4.7 build after r219938
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

10 years agoSwitching to range-based for loops; NFC.
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

10 years agoFix code to follow the "Don’t use else after a return" rule.
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

10 years agoUse iterators and algorithms to possibly make this code a bit tidier
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

10 years agoRemove one of SanitizerBlacklist::isIn() overloads. NFC.
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

10 years agoUse array_lengthof; NFC.
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

10 years ago[AArch64] Enable A53 erratum workaround (835769) by default for Android targets
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

10 years agotests: move test to more appropriate location
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

10 years agoOpenCL: Emit global variables in the constant addr space as constant globals
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

10 years agoOpenCL: Add -ffake-address-space-map to a test
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

10 years agoclang-format: Fix behavior with comments before conditional expressions
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

10 years agoclang-format: [ObjC] Fix method expression detection.
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

10 years agoFrontend: Fix some underscore-then-capital UB
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

10 years agospecify dwarf version for Solaris
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

10 years agoPR21246: DebugInfo: Emit the appropriate type (cv qualifiers, reference-ness, etc...
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

10 years agoBugfix in template instantiation in CXXPseudoDestructorExpr.
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

10 years agoDebugInfo: Cleanup testing of non-type template parameters.
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

10 years ago[CMake] clangBasic: Add Core to LINK_COMPONENTS introduced by r219840.
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

10 years agoMoving CGF::EmitAlignmentAssumption to IRBuilder
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

10 years agoCodeGen: Don't drop thread_local when emitting __thread aliases
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

10 years agoMove SanitizerBlacklist object from CodeGenModule to ASTContext.
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

10 years agoAvoid having "using namespace" for both "clang" and "llvm" namespaces.
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

10 years agoSema: handle AttributedTypeLocs in C++14 auto deduction
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

10 years agotest: simplify test further
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

10 years agoChange hasName() to take const std::string&, as it was taking before rL219792.
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

10 years agoMove -fsanitize-blacklist to LangOpts from CodeGenOpts. NFC.
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

10 years agoMove SanitizerBlacklist to clangBasic. NFC.
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

10 years agoAs requested by Matt Thomas, use long long for intmax_t and int64_t on
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

10 years agoSet ABI and DescriptionString first to reduce OS specific logic.
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

10 years agoAdd llvm_unreachable after switch to avoid warnings about a missing
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

10 years agoDrop unneccessary default case from switch introduced in r219809
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

10 years agoRevert "Fix late template parsing leak with incremental processing"
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

10 years ago[analyzer] Perl scripts are run differently from makefiles. Sometimes additional...
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

10 years agoFix late template parsing leak with incremental processing
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

10 years ago[libclang] Add function to retrieve storage class in libclang.
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

10 years agoAdding attributes to the IndirectFieldDecl that we generate for anonymous struct...
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

10 years agoDon't use a global_ctors comdat for globals that aren't externally visible
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

10 years agoCodeGen: Cleanup CGRecordLowering::lowerUnion a little
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

10 years agoFix for PR21254 - Assertion in comment parser
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

10 years agoUpdate for llvm api change.
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

10 years agoUpdate for llvm api change.
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

10 years agoTurned Sema::HandleDelayedAvailabilityCheck into a static function; NFC.
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

10 years ago[analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.
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

10 years agoSpeed up hasName() matcher.
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

10 years agoFixed a comment. No functional changes.
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

10 years agoCodeGen: Use the initing member's type for a union's storage type more often
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

10 years agoCodeGen: Fix a typo in a comment
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

10 years agoMS ABI: Use the correct this arg when generating implicit array copy ctor
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

10 years agoImprovements to -Wnull-conversion
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

10 years agoFrontend: Don't accept null DiagnosticsEngines when building ASTUnits
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

10 years agoFrontend: Remove some unused arguments in ASTUnit (NFC)
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

10 years agovadefs.h: be even more conservative and only define the macros if already defined
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

10 years agoclang-cl: Diagnose the usage of ASAN with a debug runtime library
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

10 years agoSort files list in lib/Headers/CMakeLists.txt
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

10 years agoMS Compat: interpose vadefs.h to fix definitions of _crt_va_{start,end,arg} (PR21247)
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

10 years agoDebugInfo: Lazily built static member variable declarations should use the canonical...
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

10 years agoARM: remove ARM/Thumb distinction for preferred alignment.
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

10 years agoBe smarter when parsing variable declarations with unknown types.
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

10 years agoARM: set preferred aggregate alignment to 32 universally.
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

10 years agoFactor code into CXXRecordDecl::getTemplateInstantiationPattern() helper
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

10 years agoPatch to warn on interger overflow in presence of
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

10 years agoCodeGen: correct block mangling in ObjC
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

10 years agoCodeGen: correct mangling for blocks
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

10 years agoFormatting for prior commit
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

10 years ago[SystemZ] Address review comments for r219679
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

10 years agoDebugInfo: Don't leak location information from one function into the prologue of...
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

10 years ago[SystemZ] Add test case to verify default use of integrated assembler
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

10 years agoRe-apply "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic...
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

10 years agoExtend -Rmodule-build to also remark when module building finishes.
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

10 years ago[modules] Merging for class-scope using-declarations.
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

10 years agoRevert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
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

10 years agoFrontend: Try to fix cmake builders after r219647
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

10 years agoFrontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)
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

10 years agoSanitize upcasts and conversion to virtual base.
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

10 years agoFix the build
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

10 years agoObjective-C [Sema]. Fixes a bug in comparing qualified
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

10 years ago[analyzer] Check all 'nonnull' attributes, not just the first one.
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

10 years agoFix order of evaluation bug in DynTypedMatcher::constructVariadic().
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

10 years agoFix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
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

10 years agoRelinquish ownership of MS-style inline assembly.
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

10 years agoMore OpenMP test case compatibility fixes
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

10 years ago[AArch64] Fixup test from A53 erratum patch after buildbot failures
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

10 years agoAdds support for the Cortex-A17 processor to Clang
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

10 years ago[AArch64] Add workaround for Cortex-A53 erratum (835769)
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

10 years agoFix incompatibility issue in /OpenMP/parallel_num_threads_codegen.cpp
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

10 years ago[OPENMP] Codegen for 'num_threads' clause in 'parallel' directive.
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

10 years agoFix test OpenMP/parallel_if_codegen.cpp.
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

10 years ago[OPENMP] Codegen for 'if' clause in 'parallel' directive.
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

10 years agoPredefinedExpr deserialization test in dependent context.
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

10 years ago[Modules] Make header standalone. NFC.
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

10 years agoFixed a problem in r19589.
Tyler Nowicki [Sun, 12 Oct 2014 21:28:02 +0000 (21:28 +0000)]
Fixed a problem in r19589.

Several systems failed to compile the array allocation of the TokenArray.

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

10 years agoAllow constant expressions in pragma loop hints.
Tyler Nowicki [Sun, 12 Oct 2014 20:46:07 +0000 (20:46 +0000)]
Allow constant expressions in pragma loop hints.

Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1).

Reviewed by Richard Smith

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

10 years agoCodeGen: Strip qualifiers from qualified array types in catches
David Majnemer [Sun, 12 Oct 2014 06:58:22 +0000 (06:58 +0000)]
CodeGen: Strip qualifiers from qualified array types in catches

While we ran getUnqualifiedType over the catch type,
it isn't enough for array types.  Use getUnqualifiedArrayType instead.

This fixes PR21252.

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

10 years agoclang/test/Driver: Some tests don't REQUIRE asserts any more. Remove them.
NAKAMURA Takumi [Sun, 12 Oct 2014 06:44:05 +0000 (06:44 +0000)]
clang/test/Driver: Some tests don't REQUIRE asserts any more. Remove them.

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