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
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
unique_ptrify SourceManager::createFileID

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216715 91177308-0d34-0410-b5e6-96231b3b80d8
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
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
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
unique_ptrify Directives in VerifyDiagnosticConsumer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216740 91177308-0d34-0410-b5e6-96231b3b80d8
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
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
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
unique_ptr-ify PathDiagnosticPiece ownership

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216751 91177308-0d34-0410-b5e6-96231b3b80d8
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
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
unique_ptrify the diagnostics in CXDiagnosticSetImpl

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216754 91177308-0d34-0410-b5e6-96231b3b80d8
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