]> granicus.if.org Git - clang/log
clang
10 years agoMake all virtual member pointers use variadic musttail calls
Reid Kleckner [Fri, 29 Aug 2014 21:43:29 +0000 (21:43 +0000)]
Make all virtual member pointers use variadic musttail calls

This avoids encoding information about the function prototype into the
thunk at the cost of some function prototype bitcast gymnastics.

Fixes PR20653.

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

10 years agoFix for PR20660, where unexpanded parameter pack in function parameter clause causes...
Larisse Voufo [Fri, 29 Aug 2014 21:08:16 +0000 (21:08 +0000)]
Fix for PR20660, where unexpanded parameter pack in function parameter clause causes clang to crash.

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

10 years agoAdd a comment, no functional change.
Nico Weber [Fri, 29 Aug 2014 21:05:44 +0000 (21:05 +0000)]
Add a comment, no functional change.

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

10 years agoObjective-C [qoi]. If property is going to be implemented
Fariborz Jahanian [Fri, 29 Aug 2014 20:29:31 +0000 (20:29 +0000)]
Objective-C [qoi]. If property is going to be implemented
in the super class, do not issue the warning about property
in current class's protocol will not be auto synthesized.
// rdar://18179833

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

10 years agounique_ptrify the raw_ostream argument to clang::serialized_diags::create
David Blaikie [Fri, 29 Aug 2014 20:17:13 +0000 (20:17 +0000)]
unique_ptrify the raw_ostream argument to clang::serialized_diags::create

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

10 years agounique_ptrify clang::ento::createCheckerManager
David Blaikie [Fri, 29 Aug 2014 20:11:03 +0000 (20:11 +0000)]
unique_ptrify clang::ento::createCheckerManager

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

10 years agounique_ptrify PathDiagnosticConsumer::HandlePathDiagnostic
David Blaikie [Fri, 29 Aug 2014 20:06:10 +0000 (20:06 +0000)]
unique_ptrify PathDiagnosticConsumer::HandlePathDiagnostic

FoldingSet, another intrusive data structure that could use some
unique_ptr love on its interfaces. Eventually.

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

10 years agoAdd an option to silence all analyzer warnings.
Anna Zaks [Fri, 29 Aug 2014 20:01:38 +0000 (20:01 +0000)]
Add an option to silence all analyzer warnings.

People have been incorrectly using "-analyzer-disable-checker" to
silence analyzer warnings on a file, when analyzing a project. Add
the "-analyzer-disable-all-checks" option, which would allow the
suppression and suggest it as part of the error message for
"-analyzer-disable-checker". The idea here is to compose this with
"--analyze" so that users can selectively opt out specific files from
static analysis.

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

10 years agounique_ptrify thep passing of BugReports to BugReportEquivClass
David Blaikie [Fri, 29 Aug 2014 19:57:52 +0000 (19:57 +0000)]
unique_ptrify thep passing of BugReports to BugReportEquivClass

I suspect llvm::ilist should take elements by unique_ptr, since it does
take ownership of the element (by stitching it into the linked list) -
one day.

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

10 years agounique_ptrify HeaderMap::FileBuffer
David Blaikie [Fri, 29 Aug 2014 19:51:32 +0000 (19:51 +0000)]
unique_ptrify HeaderMap::FileBuffer

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

10 years agounique_ptrify Preprocessor's TokenLexerCache
David Blaikie [Fri, 29 Aug 2014 19:36:52 +0000 (19:36 +0000)]
unique_ptrify Preprocessor's TokenLexerCache

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

10 years agounique_ptrify the result of CFG::buildCFG/CFGBuilder::buildCFG
David Blaikie [Fri, 29 Aug 2014 18:53:26 +0000 (18:53 +0000)]
unique_ptrify the result of CFG::buildCFG/CFGBuilder::buildCFG

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

10 years agounique_ptrify the diagnostics in CXDiagnosticSetImpl
David Blaikie [Fri, 29 Aug 2014 18:43:24 +0000 (18:43 +0000)]
unique_ptrify the diagnostics in CXDiagnosticSetImpl

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

10 years agoObjective-C. Tweak diagnosing properties that are not auto-synthesized.
Fariborz Jahanian [Fri, 29 Aug 2014 18:31:16 +0000 (18:31 +0000)]
Objective-C. Tweak diagnosing properties that are not auto-synthesized.
Do not warn when property declared in class's protocol will be auto-synthesized
by its uper class implementation because super class has also declared this
property while this class has not. Continue to warn if current class
has declared the property also (because this declaration will not result
in a 2nd synthesis).
rdar://18152478

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

10 years agounique_ptrify PathDiagnostic::setEndOfPath's argument
David Blaikie [Fri, 29 Aug 2014 18:18:47 +0000 (18:18 +0000)]
unique_ptrify PathDiagnostic::setEndOfPath's argument

Again, if shared ownership is the right model here (I assume it is,
given graph algorithms & such) this could be tidied up (the 'release'
call removed in favor of something safer) by having
IntrunsiveRefCntPointer constructible from a unique_ptr.

(& honestly I'd probably favor taking a page out of shared_ptr's book,
allowing implicit construction from a unique_ptr rvalue, and only allow
explicit from a raw pointer - currently IntrusiveRefCntPointer can
implicitly own from a raw pointer, which seems unsafe)

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

10 years agounique_ptr-ify PathDiagnosticPiece ownership
David Blaikie [Fri, 29 Aug 2014 18:18:43 +0000 (18:18 +0000)]
unique_ptr-ify PathDiagnosticPiece ownership

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

10 years agoCheck in a test case for the problem with late-dropped dllimport (PR20803)
Hans Wennborg [Fri, 29 Aug 2014 17:36:11 +0000 (17:36 +0000)]
Check in a test case for the problem with late-dropped dllimport (PR20803)

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

10 years agoOne other BuryPointer of a unique_ptr cleanup.
David Blaikie [Fri, 29 Aug 2014 17:02:26 +0000 (17:02 +0000)]
One other BuryPointer of a unique_ptr cleanup.

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

10 years agoProvide a BuryPointer for unique_ptrs.
David Blaikie [Fri, 29 Aug 2014 16:53:14 +0000 (16:53 +0000)]
Provide a BuryPointer for unique_ptrs.

In theory, it'd be nice if we could move to a case where all buried
pointers were buried via unique_ptr to demonstrate that the program had
finished with the value (that we could really have cleanly deallocated
it) but instead chose to bury it.

I think the main reason that's not possible right now is the various
IntrusiveRefCntPtrs in the Frontend, sharing ownership for a variety of
compiler bits (see the various similar
"CompilerInstance::releaseAndLeak*" functions). I have yet to figure out
their correct ownership semantics - but perhaps, even if the
intrusiveness can be removed, the shared ownership may yet remain and
that would lead to a non-unique burying as is there today. (though we
could model that a little better - by passing in a shared_ptr, etc -
rather than needing the two step that's currently used in those other
releaseAndLeak* functions)

This might be a bit more robust if BuryPointer took the boolean:

BuryPointer(bool, unique_ptr<T>)

and the choice to bury was made internally - that way, even when
DisableFree was not set, the unique_ptr would still be null in the
caller and there'd be no chance of accidentally having a different
codepath where the value is used after burial in !DisableFree, but it
becomes null only in DisableFree, etc...

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

10 years agounique_ptrify Directives in VerifyDiagnosticConsumer
David Blaikie [Fri, 29 Aug 2014 16:30:23 +0000 (16:30 +0000)]
unique_ptrify Directives in VerifyDiagnosticConsumer

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

10 years agoclang-format: Fix unary operator detection in corner case.
Daniel Jasper [Fri, 29 Aug 2014 12:54:38 +0000 (12:54 +0000)]
clang-format: Fix unary operator detection in corner case.

Before:
  decltype(* ::std::declval<const T &>()) void F();

After:
  decltype(*::std::declval<const T &>()) void F();

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

10 years agoASTMatchers: Replace some copies of the bound nodes tree builder with moves.
Benjamin Kramer [Fri, 29 Aug 2014 11:22:47 +0000 (11:22 +0000)]
ASTMatchers: Replace some copies of the bound nodes tree builder with moves.

But don't move if all we do is clearing the thing. The move method is too large
to be inlined and performs a ton of unnecessary checking when the RHS is empty.

No functionality change.

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

10 years agoUse store size instead of alloc size when coercing.
James Molloy [Fri, 29 Aug 2014 10:17:52 +0000 (10:17 +0000)]
Use store size instead of alloc size when coercing.

Previously, EnterStructPointerForCoercedAccess used Alloc size when determining how to convert. This was problematic, because there were situations were the alloc size was larger than the store size. For example, if the first element of a structure were i24 and the destination type were i32, the old code would generate a GEP and a load i24. The code should compare store sizes to ensure the whole object is loaded. I have attached a test case.

This patch modifies the output of arm64-be-bitfield.c test case, but the new IR seems to be equivalent, and after -O3, the compiler generates identical ARM assembly. (asr x0, x0, #54)

Patch by Thomas Jablin!

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

10 years agounique_ptrify SourceManager::createFileID
David Blaikie [Fri, 29 Aug 2014 07:59:55 +0000 (07:59 +0000)]
unique_ptrify SourceManager::createFileID

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

10 years agoCodeGen: Don't completely mess-up optimized atomic libcalls
David Majnemer [Fri, 29 Aug 2014 07:27:49 +0000 (07:27 +0000)]
CodeGen: Don't completely mess-up optimized atomic libcalls

Summary:
We did a great job getting this wrong:
- We messed up which LLVM IR types to use for arguments and return values.
  The optimized libcalls use integer types for values.

  Clang attempted to use the IR type which corresponds to the value
  passed in instead of using an appropriately sized integer type.  This
  would result in violations of the ABI for, as an example, floating
  point types.
- We didn't bother recording the result of the atomic libcall in the
  destination memory.

Instead, call the functions with arguments matching the type of the
libcall prototype's parameters.

This fixes PR20780.

Differential Revision: http://reviews.llvm.org/D5098

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

10 years agounique_ptrify Driver Action handling
David Blaikie [Fri, 29 Aug 2014 07:25:23 +0000 (07:25 +0000)]
unique_ptrify Driver Action handling

It hits a limit when we reach ActionList, which is used for dynamic
conditional ownership, so we lose type safety there.

This did expose at least one caller "lying" about ownership (passing
ownership to an Action, then updating the Action to specify that it
doesn't actually own the thing that was passed) - changing this to
unique_ptr just makes that oddity more obvious.

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

10 years agoImprove unique_ptr-y ownership in ASTUnit::ComputePreamble
David Blaikie [Fri, 29 Aug 2014 06:34:53 +0000 (06:34 +0000)]
Improve unique_ptr-y ownership in ASTUnit::ComputePreamble

Rather than having a pair of pairs and a reference out parameter, build
a structure with everything together and named. A raw pointer and a
unique_ptr, rather than a raw pointer and a boolean, are used to
communicate ownership transfer.

It's possible one day we'll end up with a conditional pointer (probably
represented by a raw pointer and a boolean) abstraction to use in places
like this. Conditional ownership seems to be coming up more often than
I'd hoped...

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

10 years agoUse llvm::makeArrayRef instead of explicitly calling ArrayRef constructor and mention...
Craig Topper [Fri, 29 Aug 2014 06:05:01 +0000 (06:05 +0000)]
Use llvm::makeArrayRef instead of explicitly calling ArrayRef constructor and mentioning the type. This works now that we have a conversion from ArrayRef<T*> to ArrayRef<const T*>.

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

10 years agounique_ptrify clang::BackendConsumer::takeModule
David Blaikie [Fri, 29 Aug 2014 05:08:19 +0000 (05:08 +0000)]
unique_ptrify clang::BackendConsumer::takeModule

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

10 years agocall __asan_load_cxx_array_cookie when loading array cookie in asan mode.
Kostya Serebryany [Fri, 29 Aug 2014 01:01:32 +0000 (01:01 +0000)]
call __asan_load_cxx_array_cookie when loading array cookie in asan mode.

Summary:
The current implementation of asan cookie is incorrect:
we add nosanitize metadata to the cookie load, but the metadata may be lost
and we will instrument the load from poisoned memory.
This change replaces the load with a call to __asan_load_cxx_array_cookie (r216692)

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5111

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

10 years agoIntroduce -DLLVM_USE_SANITIZER=Undefined CMake option to build UBSan-ified version...
Alexey Samsonov [Fri, 29 Aug 2014 00:50:36 +0000 (00:50 +0000)]
Introduce -DLLVM_USE_SANITIZER=Undefined CMake option to build UBSan-ified version of LLVM/Clang.

I've fixed most of the simple bugs and currently "check-llvm" test suite
has 26 failures, and "check-clang" suite has 5 failures.

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

10 years agoBetter codegen support for DLL attributes being dropped after the first declaration...
Hans Wennborg [Fri, 29 Aug 2014 00:16:06 +0000 (00:16 +0000)]
Better codegen support for DLL attributes being dropped after the first declaration (PR20792)

For the following code:

  __declspec(dllimport) int f(int x);
  int user(int x) {
    return f(x);
  }
  int f(int x) { return 1; }

Clang will drop the dllimport attribute in the AST, but CodeGen would have
already put it on the LLVM::Function, and that would never get updated.
(The same thing happens for global variables.)

This makes Clang check dropped DLL attribute case each time the LLVM object
is referenced.

This isn't perfect, because we will still get it wrong if the function is
never referenced by codegen after the attribute is dropped, but this handles
the common cases and makes us not fail in the verifier.

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

10 years agoDon't create a null reference in ASTUnit::LoadFromCommandLine.
Alexey Samsonov [Thu, 28 Aug 2014 23:51:01 +0000 (23:51 +0000)]
Don't create a null reference in ASTUnit::LoadFromCommandLine.

This change is the last in the pack of five commits
(also see r216691, r216694, r216695, and r216696) that reduces the number
of test failures in "check-clang" invocation in UBSan bootstrap
from 2443 down to 5.

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

10 years agoDon't load invalid enum value in Sema::LazilyCreateBuiltin.
Alexey Samsonov [Thu, 28 Aug 2014 23:34:32 +0000 (23:34 +0000)]
Don't load invalid enum value in Sema::LazilyCreateBuiltin.

This bug was reported by UBSan.

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

10 years agoDon't load ill-formed AmbiguityKind in Sema::Lookup.
Alexey Samsonov [Thu, 28 Aug 2014 23:17:55 +0000 (23:17 +0000)]
Don't load ill-formed AmbiguityKind in Sema::Lookup.

This bug was reported by UBSan.

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

10 years agoProperly align inline space for ImplicitConversionSequences in OverloadSet.
Alexey Samsonov [Thu, 28 Aug 2014 22:59:39 +0000 (22:59 +0000)]
Properly align inline space for ImplicitConversionSequences in OverloadSet.

This bug was reported by UBSan.

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

10 years agoDon't create a null reference to NestedNameSpecifier.
Alexey Samsonov [Thu, 28 Aug 2014 22:18:42 +0000 (22:18 +0000)]
Don't create a null reference to NestedNameSpecifier.

This bug was reported by UBSan.

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

10 years agoCall powerpc-darwin external tools with -arch ppc.
Rafael Espindola [Thu, 28 Aug 2014 21:23:05 +0000 (21:23 +0000)]
Call powerpc-darwin external tools with -arch ppc.

With this patch we call external tools for powerpc-darwin with "-arch ppc"
instead of "-arch powerpc", so as to be compatible with the cctools assembler
and ld64 linker.

Patch by Stephen Drake!

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

10 years agoOops, use correct RUN: line for test.
Richard Smith [Thu, 28 Aug 2014 21:09:23 +0000 (21:09 +0000)]
Oops, use correct RUN: line for test.

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

10 years ago[modules] PR20786: add (already passing) regression test from the bug report.
Richard Smith [Thu, 28 Aug 2014 20:14:15 +0000 (20:14 +0000)]
[modules] PR20786: add (already passing) regression test from the bug report.

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

10 years agoReverting r216675. This breaks some bots. Before this can be committed again, I have...
Aaron Ballman [Thu, 28 Aug 2014 17:24:14 +0000 (17:24 +0000)]
Reverting r216675. This breaks some bots. Before this can be committed again, I have to explore runtime ABI requirements with libc++abi.

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

10 years agoObjective-C IRGen. Fixes an assertion crash caused by inconsistent
Fariborz Jahanian [Thu, 28 Aug 2014 17:05:17 +0000 (17:05 +0000)]
Objective-C IRGen. Fixes an assertion crash caused by inconsistent
linkage related to generation of OBJC_SELECTOR_REFERENCES symbol
needed in generation of call to 'super' in a class method.
// rdar://18150301

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

10 years agoThrow a std::bad_array_new_length exception when the expression (or constant-expressi...
Aaron Ballman [Thu, 28 Aug 2014 16:48:44 +0000 (16:48 +0000)]
Throw a std::bad_array_new_length exception when the expression (or constant-expression) passed to operator new[] results in overflow in conformance with [expr.new]p7. Fixes PR11644.

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

10 years agoCache the memoization data for DynTypedNodes.
Samuel Benzaquen [Thu, 28 Aug 2014 15:49:06 +0000 (15:49 +0000)]
Cache the memoization data for DynTypedNodes.

Summary:
Cache the memoization data for DynTypedNodes.
It is free to do so on create(), but expensive to determine dynamically.

Reviewers: klimek

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5101

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

10 years agoarm_acle: Fix error in ROR implementation
Yi Kong [Thu, 28 Aug 2014 15:25:52 +0000 (15:25 +0000)]
arm_acle: Fix error in ROR implementation

The logic in calculating the rotate amount was flawed.

Thanks Pasi Parviainen for pointing out!

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

10 years ago[CMake] clangStaticAnalyzerFrontend: Add clangLex, corresponding to r216550.
NAKAMURA Takumi [Thu, 28 Aug 2014 12:42:28 +0000 (12:42 +0000)]
[CMake] clangStaticAnalyzerFrontend: Add clangLex, corresponding to r216550.

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

10 years ago[ARM] Change default ABI for AArch32 to be "aapcs" (was "apcs-gnu")
Oliver Stannard [Thu, 28 Aug 2014 12:15:49 +0000 (12:15 +0000)]
[ARM] Change default ABI for AArch32 to be "aapcs" (was "apcs-gnu")

The current default abi when no environment is given is "apcs-gnu",
which is obsolete. This patch changes the default to "aapcs". "aapcs" has both
hard- and soft-float variants, so the -mhard-float, -msoft-float and
-mfloat-abi= options now all behave as expected when no environment is
specified in the triple.

While writing this I also noticed that a preprocessor test claims to be
checking darwin, but is actually checking the defaults, which are
different for darwin.

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

10 years agoarm_acle: Implement data processing intrinsics
Yi Kong [Thu, 28 Aug 2014 09:44:07 +0000 (09:44 +0000)]
arm_acle: Implement data processing intrinsics

Summary:
ACLE 2.0 section 9.2 defines the following "miscellaneous data processing intrinsics": `__clz`, `__cls`, `__ror`, `__rev`, `__rev16`, `__revsh` and `__rbit`.

`__clz` has already been implemented in the arm_acle.h header file. The rest are not supported yet. This patch completes ACLE data processing intrinsics.

Reviewers: t.p.northover, rengolin

Reviewed By: rengolin

Subscribers: aemerson, mroth, llvm-commits

Differential Revision: http://reviews.llvm.org/D4983

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

10 years agoFixed test compatibility with MSVC codegen.
Alexey Bataev [Thu, 28 Aug 2014 06:37:56 +0000 (06:37 +0000)]
Fixed test compatibility with MSVC codegen.

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

10 years ago[modules] When completing the redecl chain for an anonymous declaration in a
Richard Smith [Thu, 28 Aug 2014 05:44:07 +0000 (05:44 +0000)]
[modules] When completing the redecl chain for an anonymous declaration in a
merged context, pull in the lexical decls in that context, since one of them
may complete the redecl chain.

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

10 years ago[C++11] Support for capturing of variable length arrays in lambda expression.
Alexey Bataev [Thu, 28 Aug 2014 04:28:19 +0000 (04:28 +0000)]
[C++11] Support for capturing of variable length arrays in lambda expression.
Differential Revision: http://reviews.llvm.org/D4368

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

10 years agoDuring cross field uninitialized checking, when processing an assignment,
Richard Trieu [Thu, 28 Aug 2014 03:23:47 +0000 (03:23 +0000)]
During cross field uninitialized checking, when processing an assignment,
don't mark the field as initialized until the next initializer instead of
instantly.  Since this checker is AST based, statements are processed in tree
order instead of following code flow.  This can result in different warnings
from just reordering the code.  Also changed to use one checker per constructor
instead of creating a new checker per field.

class T {
  int x, y;

  // Already warns
  T(bool b) : x(!b ? (1 + y) : (y = 5)) {}

  // New warning added here, previously (1 + y) comes after (y = 5) in the AST
  // preventing the warning.
  T(bool b) : x(b ? (y = 5) : (1 + y)) {}

};

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

10 years ago[modules] Number anonymous declarations that are lexically within mergeable
Richard Smith [Thu, 28 Aug 2014 01:33:39 +0000 (01:33 +0000)]
[modules] Number anonymous declarations that are lexically within mergeable
contexts, so that we can merge them when we merge the surrounding context.

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

10 years agoProperly handle multiple nonnull attributes in CodeGen
Alexey Samsonov [Thu, 28 Aug 2014 00:53:20 +0000 (00:53 +0000)]
Properly handle multiple nonnull attributes in CodeGen

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

10 years agoKill one of EmitCallArgs overloads. NFC.
Alexey Samsonov [Thu, 28 Aug 2014 00:22:11 +0000 (00:22 +0000)]
Kill one of EmitCallArgs overloads. NFC.

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

10 years ago[modules] Add an assert that we properly manage the IsCompleteDefinition flag
Richard Smith [Wed, 27 Aug 2014 23:11:59 +0000 (23:11 +0000)]
[modules] Add an assert that we properly manage the IsCompleteDefinition flag
on CXXRecordDecls when merging definitions, and make it pass by not trying to
save and restore this flag across AST serialization/deserialization. For
CXXRecordDecls, we have a separate mechanism to manage this.

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

10 years agoPR20769: Fix confusion when checking whether a prior default argument was in
Richard Smith [Wed, 27 Aug 2014 22:31:34 +0000 (22:31 +0000)]
PR20769: Fix confusion when checking whether a prior default argument was in
scope when checking for conflicts.

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

10 years agoMore -Wuninitialized updates
Richard Trieu [Wed, 27 Aug 2014 22:15:10 +0000 (22:15 +0000)]
More -Wuninitialized updates

Fix r216438 to catch more complicated self-initialized in std::move.  For
instance, "Foo f = std::move(cond ? OtherFoo : (UNUSED_VALUE, f));"

Make sure that BinaryConditionalOperator, ConditionalOperator, BinaryOperator
with comma operator, and OpaqueValueExpr perform the correct usage forwarding
across the three uninitialized value checkers.

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

10 years agoQuery CompilationDatabase right before running each compilation.
Alexander Kornienko [Wed, 27 Aug 2014 21:36:39 +0000 (21:36 +0000)]
Query CompilationDatabase right before running each compilation.

Summary:
Query CompilationDatabase right before running each compilation. This allows
supporting compilation databases that change external state required for
successful compilation.

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5086

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

10 years agoAllow adding dll attributes on certain redecls with a warning if the decl hasn't...
Hans Wennborg [Wed, 27 Aug 2014 21:27:40 +0000 (21:27 +0000)]
Allow adding dll attributes on certain redecls with a warning if the decl hasn't been used yet (PR20746)

This shouldn't really be allowed, but it comes up in real code (see PR). As
long as the decl hasn't been used there's no technical difficulty in supporting
it, so downgrade the error to a warning.

Differential Revision: http://reviews.llvm.org/D5087

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

10 years agoOverload SourceManager::overrideFileContents so that unconditionally passing ownershi...
David Blaikie [Wed, 27 Aug 2014 20:54:45 +0000 (20:54 +0000)]
Overload SourceManager::overrideFileContents so that unconditionally passing ownership is explicitly done using unique_ptr.

Only those callers who are dynamically passing ownership should need the
3 argument form. Those accepting the default ("do pass ownership")
should do so explicitly with a unique_ptr now.

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

10 years agoObjective-C. Change to method lookup rules to look
Fariborz Jahanian [Wed, 27 Aug 2014 20:34:29 +0000 (20:34 +0000)]
Objective-C. Change to method lookup rules to look
into primary class's named categories before looking
into their protocols. This is because categories are
part of the public interface and , just as primary class,
preference should be given to them before class
(and category) protocols.  // rdar://18013929

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

10 years agoUpdate for LLVM api change.
Rafael Espindola [Wed, 27 Aug 2014 20:03:29 +0000 (20:03 +0000)]
Update for LLVM api change.

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

10 years agoAdd tests for variadic functions versus attribute nonnull in the static analyzer.
Richard Smith [Wed, 27 Aug 2014 19:05:47 +0000 (19:05 +0000)]
Add tests for variadic functions versus attribute nonnull in the static analyzer.

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

10 years agoUpdate for llvm API change.
Rafael Espindola [Wed, 27 Aug 2014 19:03:27 +0000 (19:03 +0000)]
Update for llvm API change.

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

10 years agoFix regression in r216520: don't apply nonnull to non-pointer function
Richard Smith [Wed, 27 Aug 2014 18:56:18 +0000 (18:56 +0000)]
Fix regression in r216520: don't apply nonnull to non-pointer function
parameters in the IR.

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

10 years agoFix PR20773 which I introduced with a silly edit mistake in r216531.
Chandler Carruth [Wed, 27 Aug 2014 18:21:27 +0000 (18:21 +0000)]
Fix PR20773 which I introduced with a silly edit mistake in r216531.
Trivial fix, and I've made the gentoo tests more representative. With
the changes, they would have caught this failure.

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

10 years agoclang-format: Address review comments of r216501.
Daniel Jasper [Wed, 27 Aug 2014 17:16:46 +0000 (17:16 +0000)]
clang-format: Address review comments of r216501.

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

10 years agoCall ResolveExceptionSpec for non-OdrUsed functions.
Nico Weber [Wed, 27 Aug 2014 17:04:39 +0000 (17:04 +0000)]
Call ResolveExceptionSpec for non-OdrUsed functions.

In C++11, instantiation of exception specs is deferred. The instantiation is
done in MarkFunctionReferenced(), which wasn't called for non-OdrUsed functions,
which then caused an assert in codegen. Fixes PR19190, see the bug for details.

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

10 years agoObjective-C. When multiple nullary selectors are found in
Fariborz Jahanian [Wed, 27 Aug 2014 16:38:47 +0000 (16:38 +0000)]
Objective-C. When multiple nullary selectors are found in
global pool in the course of method selection for
a messaging expression, select one with the most general
return type of 'id'. This is to remove type-mismatch
warning (which is useless) as result of random selection of
method with more restrictive return type. rdar://18095772

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

10 years agoAllow __fp16 as a function arg or return type for AArch64
Oliver Stannard [Wed, 27 Aug 2014 16:31:57 +0000 (16:31 +0000)]
Allow __fp16 as a function arg or return type for AArch64

ACLE 2.0 allows __fp16 to be used as a function argument or return
type. This enables this for AArch64.

This also fixes an existing bug that causes clang to not allow
homogeneous floating-point aggregates with a base type of __fp16. This
is valid for AAPCS64, but not for AAPCS-VFP.

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

10 years agoQuick fix to test/CodeGen/2007-06-18-SextAttrAggregate.c for x86_64-mingw32, correspo...
NAKAMURA Takumi [Wed, 27 Aug 2014 16:22:26 +0000 (16:22 +0000)]
Quick fix to test/CodeGen/2007-06-18-SextAttrAggregate.c for x86_64-mingw32, corresponding to r216507.

FIXME: Explicit triplets might be given here.

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

10 years agoUse unique_ptr instead of OwningPtr. I'm not certain how this compiled.
Ted Kremenek [Wed, 27 Aug 2014 15:30:35 +0000 (15:30 +0000)]
Use unique_ptr instead of OwningPtr.  I'm not certain how this compiled.

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

10 years agoAdd support for the static analyzer to synthesize function implementations from exter...
Ted Kremenek [Wed, 27 Aug 2014 15:14:15 +0000 (15:14 +0000)]
Add support for the static analyzer to synthesize function implementations from external model files.

Currently the analyzer lazily models some functions using 'BodyFarm',
which constructs a fake function implementation that the analyzer
can simulate that approximates the semantics of the function when
it is called.  BodyFarm does this by constructing the AST for
such definitions on-the-fly.  One strength of BodyFarm
is that all symbols and types referenced by synthesized function
bodies are contextual adapted to the containing translation unit.
The downside is that these ASTs are hardcoded in Clang's own
source code.

A more scalable model is to allow these models to be defined as source
code in separate "model" files and have the analyzer use those
definitions lazily when a function body is needed.  Among other things,
it will allow more customization of the analyzer for specific APIs
and platforms.

This patch provides the initial infrastructure for this feature.
It extends BodyFarm to use an abstract API 'CodeInjector' that can be
used to synthesize function bodies.  That 'CodeInjector' is
implemented using a new 'ModelInjector' in libFrontend, which lazily
parses a model file and injects the ASTs into the current translation
unit.

Models are currently found by specifying a 'model-path' as an
analyzer option; if no path is specified the CodeInjector is not
used, thus defaulting to the current behavior in the analyzer.

Models currently contain a single function definition, and can
be found by finding the file <function name>.model.  This is an
initial starting point for something more rich, but it bootstraps
this feature for future evolution.

This patch was contributed by Gábor Horváth as part of his
Google Summer of Code project.

Some notes:

- This introduces the notion of a "model file" into
  FrontendAction and the Preprocessor.  This nomenclature
  is specific to the static analyzer, but possibly could be
  generalized.  Essentially these are sources pulled in
  exogenously from the principal translation.

  Preprocessor gets a 'InitializeForModelFile' and
  'FinalizeForModelFile' which could possibly be hoisted out
  of Preprocessor if Preprocessor exposed a new API to
  change the PragmaHandlers and some other internal pieces.  This
  can be revisited.

  FrontendAction gets a 'isModelParsingAction()' predicate function
  used to allow a new FrontendAction to recycle the Preprocessor
  and ASTContext.  This name could probably be made something
  more general (i.e., not tied to 'model files') at the expense
  of losing the intent of why it exists.  This can be revisited.

- This is a moderate sized patch; it has gone through some amount of
  offline code review.  Most of the changes to the non-analyzer
  parts are fairly small, and would make little sense without
  the analyzer changes.

- Most of the analyzer changes are plumbing, with the interesting
  behavior being introduced by ModelInjector.cpp and
  ModelConsumer.cpp.

- The new functionality introduced by this change is off-by-default.
  It requires an analyzer config option to enable.

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

10 years agoclang-format: Fix regression in formatting of braced initializers.
Daniel Jasper [Wed, 27 Aug 2014 11:53:26 +0000 (11:53 +0000)]
clang-format: Fix regression in formatting of braced initializers.

Before:
  Node n{1, Node{1000}, //
                2};

After:
  Node n{1, Node{1000}, //
         2};

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

10 years agoMove some ARM-specific code from CGCall.cpp to TargetInfo.cpp
Oliver Stannard [Wed, 27 Aug 2014 10:43:15 +0000 (10:43 +0000)]
Move some ARM-specific code from CGCall.cpp to TargetInfo.cpp

This tidies up some ARM-specific code added by r208417 to move it out
of the target-independent parts of clang into TargetInfo.cpp. This
also has the advantage that we can now flatten struct arguments to
variadic AAPCS functions.

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

10 years ago[asan] Restore asan-rt name on linux back to pre-r216380.
Evgeniy Stepanov [Wed, 27 Aug 2014 09:46:54 +0000 (09:46 +0000)]
[asan] Restore asan-rt name on linux back to pre-r216380.

There is no reason to have different library names for shared and static
cases on linux. It also breaks Android where we install the shared asan-rt
library into the system and should keep the old name.

This change reverts most of r216380 limiting it to win32 targets only.

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

10 years agoSignificantly fix Clang's header search for Ubuntu (and possibly other
Chandler Carruth [Wed, 27 Aug 2014 08:41:41 +0000 (08:41 +0000)]
Significantly fix Clang's header search for Ubuntu (and possibly other
modern Debian-based distributions) due to on-going multiarch madness.

It appears that when the multiarch heeader search support went into the
clang driver, it went in in a quite bad state. The order of includes
completely failed to match the order exhibited by GCC, and in a specific
case -- when the GCC triple and the multiarch triple don't match as with
i686-linux-gnu and i386-linux-gnu -- we would absolutely fail to find
the libstdc++ target-specific header files.

I assume that folks who have been using Clang on Ubuntu 32-bit systems
have been applying weird patches to hack around this. I can't imagine
how else it could have worked. This was originally reported by a 64-bit
operating system user who had a 32-bit crosscompiler installed. We tried
to use that rather than the bi-arch support of the 64-bit compiler, but
failed due to the triple differences.

I've corrected all the wrong orderings in the existing tests and added
a specific test for the multiarch triple strings that are different in
a significant way. This should significantly improve the usability of
Clang when checked out vanilla from upstream onto Ubuntu machines with
an i686 GCC installation for whatever reason.

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

10 years agoSimplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting...
Craig Topper [Wed, 27 Aug 2014 06:28:36 +0000 (06:28 +0000)]
Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.

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

10 years agoFix some cases were ArrayRefs were being passed by reference.
Craig Topper [Wed, 27 Aug 2014 06:28:16 +0000 (06:28 +0000)]
Fix some cases were ArrayRefs were being passed by reference.

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

10 years agoRefactor one of the larger functions for Type Diffing into smaller functions.
Richard Trieu [Wed, 27 Aug 2014 06:24:47 +0000 (06:24 +0000)]
Refactor one of the larger functions for Type Diffing into smaller functions.
No functionality change.

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

10 years agoDriver: Restore -fkeep-inline-functions as an ignored flag
Justin Bogner [Wed, 27 Aug 2014 05:12:35 +0000 (05:12 +0000)]
Driver: Restore -fkeep-inline-functions as an ignored flag

Several options were moved to the clang_ignored_gcc_optimization group
in r213365, but -fkeep-inline-functions was accidentally dropped. This
restores the flag.

Patch by Steven Wu. Thanks!

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

10 years agoFix representation of __attribute__((nonnull)) to support correctly modeling
Richard Smith [Wed, 27 Aug 2014 04:59:42 +0000 (04:59 +0000)]
Fix representation of __attribute__((nonnull)) to support correctly modeling
the no-arguments case. Don't expand this to an __attribute__((nonnull(A, B,
C))) attribute, since that does the wrong thing for function templates and
varargs functions.

In passing, fix a grammar error in the diagnostic, a crash if
__attribute__((nonnull(N))) is applied to a varargs function,
a bug where the same null argument could be diagnosed multiple
times if there were multiple nonnull attributes referring to it,
and a bug where nonnull attributes would not be accumulated correctly
across redeclarations.

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

10 years agoChange a few methods to static methods. No functionality change.
Richard Trieu [Wed, 27 Aug 2014 04:45:30 +0000 (04:45 +0000)]
Change a few methods to static methods.  No functionality change.

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

10 years agoPR20760: Don't assert (and produce better diagnostics) if a default initializer
Richard Smith [Wed, 27 Aug 2014 03:23:12 +0000 (03:23 +0000)]
PR20760: Don't assert (and produce better diagnostics) if a default initializer
contains an unmatched closing bracket token.

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

10 years agoRefactor the diagnostic DeclContext printing. No functionality change.
Richard Trieu [Wed, 27 Aug 2014 03:05:19 +0000 (03:05 +0000)]
Refactor the diagnostic DeclContext printing.  No functionality change.

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

10 years agoClangCodeGenTests: Prune redundant libdeps.
NAKAMURA Takumi [Wed, 27 Aug 2014 01:50:11 +0000 (01:50 +0000)]
ClangCodeGenTests: Prune redundant libdeps.

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

10 years ago[CMake] ClangCodeGenTests: Add Core. It's referenced by the test.
NAKAMURA Takumi [Wed, 27 Aug 2014 01:50:00 +0000 (01:50 +0000)]
[CMake] ClangCodeGenTests: Add Core. It's referenced by the test.

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

10 years agoClangCodeGenTests: Reorder libdeps.
NAKAMURA Takumi [Wed, 27 Aug 2014 01:49:49 +0000 (01:49 +0000)]
ClangCodeGenTests: Reorder libdeps.

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

10 years agoClangCodeGenTests: Quick fix to USEDLIBS. clangCodeGen requires, at least, AST, Basic...
NAKAMURA Takumi [Wed, 27 Aug 2014 00:58:19 +0000 (00:58 +0000)]
ClangCodeGenTests: Quick fix to USEDLIBS. clangCodeGen requires, at least, AST, Basic, Frontend, and Lex.

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

10 years agoRe-apply r216491 (Win64 ABI shouldn't extend integer type arguments.)
Julien Lerouge [Wed, 27 Aug 2014 00:36:55 +0000 (00:36 +0000)]
Re-apply r216491 (Win64 ABI shouldn't extend integer type arguments.)

This time though, preserve the extension for bool types since that's compatible
with what MSVC expects.

See http://reviews.llvm.org/D4380

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

10 years agoFix missing component.
Julien Lerouge [Wed, 27 Aug 2014 00:33:21 +0000 (00:33 +0000)]
Fix missing component.

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

10 years ago[modules] Don't assert when merging virtual functions that override other
Richard Smith [Tue, 26 Aug 2014 23:29:11 +0000 (23:29 +0000)]
[modules] Don't assert when merging virtual functions that override other
functions. Also don't needlessly pull in non-canonical declarations of the
overridden virtual functions.

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

10 years agoclang-format: Don't butcher __asm blocks.
Daniel Jasper [Tue, 26 Aug 2014 23:15:12 +0000 (23:15 +0000)]
clang-format: Don't butcher __asm blocks.

Instead completely cop out of formatting them for now.

This fixes llvm.org/PR20618.

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

10 years agoAttempt to address cmake buildbot failure
Keno Fischer [Tue, 26 Aug 2014 22:50:03 +0000 (22:50 +0000)]
Attempt to address cmake buildbot failure

CMake gets confused by the fact that both LLVM and Clang now have
a CodeGen unittest. Rename the target to avoid that. The new test
was also missing ProfileData (thanks to Julien Lerouge for
pointing that out)

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

10 years agoRevert 216491, it breaks CodeGenCXX/microsoft-abi-member-pointers.cpp
Julien Lerouge [Tue, 26 Aug 2014 22:11:53 +0000 (22:11 +0000)]
Revert 216491, it breaks CodeGenCXX/microsoft-abi-member-pointers.cpp

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

10 years agoDon't segfault in EmitCXXGlobalInitFunc when main file is a membuf
Keno Fischer [Tue, 26 Aug 2014 22:10:15 +0000 (22:10 +0000)]
Don't segfault in EmitCXXGlobalInitFunc when main file is a membuf

Summary: When the main file is created from a membuffer, there is no file entry that can be retrieved. This uses "__GLOBAL_I_a" in that case which is what was always used before r208128.

Reviewers: majnemer, thakis

Reviewed By: thakis

Subscribers: yaron.keren, rsmith, cfe-commits

Differential Revision: http://reviews.llvm.org/D5043

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

10 years agoUpdate for llvm api change.
Rafael Espindola [Tue, 26 Aug 2014 22:00:14 +0000 (22:00 +0000)]
Update for llvm api change.

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

10 years agoWin64 ABI shouldn't extend integer type arguments.
Julien Lerouge [Tue, 26 Aug 2014 21:52:27 +0000 (21:52 +0000)]
Win64 ABI shouldn't extend integer type arguments.

Summary:
MSVC doesn't extend integer types smaller than 64bit, so to preserve
binary compatibility, clang shouldn't either.

For example, the following C code built with MSVC:

unsigned test(unsigned v);
unsigned foobar(unsigned short);
int main() { return test(0xffffffff) + foobar(28); }

Produces the following:

  0000000000000004: B9 FF FF FF FF     mov         ecx,0FFFFFFFFh
  0000000000000009: E8 00 00 00 00     call        test
  000000000000000E: 89 44 24 20        mov         dword ptr [rsp+20h],eax
  0000000000000012: 66 B9 1C 00        mov         cx,1Ch
  0000000000000016: E8 00 00 00 00     call        foobar

And as you can see, when setting up the call to foobar, only cx is overwritten.

If foobar is compiled with clang, then the zero extension added by clang means
the rest of the register, which contains garbage, could be used.

For example if foobar is:

unsigned foobar(unsigned short v) {
    return v;
}

Compiled with clang -fomit-frame-pointer -O3 gives the following assembly:

foobar:
  0000000000000000: 89 C8              mov         eax,ecx
  0000000000000002: C3                 ret

And that function would return garbage because the 16 most significant bits of
ecx still contain garbage from the first call.

With this change, the code for that function is now:

foobar:
  0000000000000000: 0F B7 C1           movzx       eax,cx
  0000000000000003: C3                 ret

Reviewers: chapuni, rnk

Reviewed By: rnk

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D4380

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

10 years agoClarify comment so this doesn't appear to be a C11-only rule.
Richard Smith [Tue, 26 Aug 2014 21:51:57 +0000 (21:51 +0000)]
Clarify comment so this doesn't appear to be a C11-only rule.

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