[leaks] Fix a leak of a basic block when we successfully fold a switch
condition to a constant and emit only the relevant statement. In that
case, we were previously creating the epilog jump destination, a cleanup
scope, and emitting any condition variable into it. Instead, we can emit
the condition variable (if we have one) into the cleanup scope used for
the entire folded case sequence. We avoid creating a jump dest, a basic
block, and an extra cleanup scope. Win!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207888 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI x64: Pass small objects with dtors but no copy ctors directly

Passing objects directly (in registers or memory) creates a second copy
of the object in the callee.  The callee always destroys its copy, but
we also have to destroy any temporary created in the caller.  In other
words, copy elision of these kinds of objects is impossible.

Objects larger than 8 bytes with non-trivial dtors and trivial copy
ctors are still passed indirectly, and we can still elide copies of
them.

Fixes PR19640.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207889 91177308-0d34-0410-b5e6-96231b3b80d8
Rewrite NRVO determination. Track NRVO candidates on the parser Scope and apply the NRVO candidate flag to all possible NRVO candidates here, and remove the flags in computeNRVO or upon template instantiation. A variable now has NRVO applied if and only if every return statement in that scope returns that variable. This is nearly optimal.

Performs NRVO roughly 7% more often in a bootstrap build of clang. Patch co-authored by Richard Smith.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207890 91177308-0d34-0410-b5e6-96231b3b80d8
Err, wait. Those new test functions in r207890 need CHECK lines.


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

Naming the destructor using a typedef-name for the class-name is
well-formed.

This fixes PR19620.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207892 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Sema: Implement DR244"

This was accidentally committed.

This reverts commit r207892.

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

ABIArgInfo was pretty hard to grok, it had data members with names like
"BoolData0" and "UIntData".  Constructors with lots of bool arguments.
Reusing the same data member for multiple purposes.

It was also wasteful with memory, this new layout is 8 bytes smaller.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207894 91177308-0d34-0410-b5e6-96231b3b80d8
Update Preprocessor::Initialize() documentation following r207825

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207895 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a bunch of mislayered clang/Lex includes from Sema

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207896 91177308-0d34-0410-b5e6-96231b3b80d8
Eliminate ASTContext's DelayInitialization flag

Having various possible states of initialization following construction doesn't
add value here.

Also remove the unused size_reserve parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207897 91177308-0d34-0410-b5e6-96231b3b80d8
[leaks] Don't leak the fake arguments we synthesize for LLVM option
parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207899 91177308-0d34-0410-b5e6-96231b3b80d8
[leaks] Re-shuffle code such that we don't create a basic block for
initializing an array unless we need it. Specifically, position the
creation of a new basic block after we've checked all of the cases that
bypass the need for it.

Fixes another leak in test/CodeGen* found by LSan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207900 91177308-0d34-0410-b5e6-96231b3b80d8
[leaks] The PDFileEntry nodes in the FilesMade FoldingSet contain
a std::vector that allocates on the heap. As a consequence, we have to
run all of their destructors when tearing down the set, not just
deallocate the memory blobs.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207908 91177308-0d34-0410-b5e6-96231b3b80d8
Replace one-element SmallVectors inside DenseMaps with TinyPtrVector.

That's exactly what TinyPtrVector was designed for. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207919 91177308-0d34-0410-b5e6-96231b3b80d8
Wrap a few lines at 80 columns, change a confusing indent. No behavior change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207921 91177308-0d34-0410-b5e6-96231b3b80d8
Minor cleanups, no behavior change.

* Fixes a "return" that was indented at the same level as the continuation
  from the previous line
* Wrap several lines to 80 columns
* Remove an if check that was always true
* Move a variable declaration slightly closer to its use


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207922 91177308-0d34-0410-b5e6-96231b3b80d8
Target: fix wchar_t definition for Windows on ARM

Windows on ARM uses AAPCS, but has some deviations.  wchar_t remains an unsigned
short on WoA, which does not conform to AAPCS.  Ensure that wchar_t is defined
accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207929 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: complete ARM ACLE hint 8.4 support

Add support for the remaining hints from the ACLE.  Although __dbg is listed as
a hint, it is handled different, so it is not covered by this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207930 91177308-0d34-0410-b5e6-96231b3b80d8
[Modules] Add the resource-dir to the module hash.

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