[ms-cxxabi] Elide dtor access checks for pass-by-val objects in callees

The ABI requires the destructor to be invoked in the callee, but the
standard does not require access checks here so we avoid doing direct
access checks on the destructor.

If we end up needing to define an implicit destructor, we don't skip
access checks for the base class, etc. Those checks are effectively part
of generating the destructor definition, and aren't affected by which TU
the check is performed in.

Differential Revision: http://llvm-reviews.chandlerc.com/D2409

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199120 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Add a CFG node for the allocator call in a C++ 'new' expression.

In an expression like "new (a, b) Foo(x, y)", two things happen:
- Memory is allocated by calling a function named 'operator new'.
- The memory is initialized using the constructor for 'Foo'.

Currently the analyzer only models the second event, though it has special
cases for both the default and placement forms of operator new. This patch
is the first step towards properly modeling both events: it changes the CFG
so that the above expression now generates the following elements.

1. a
2. b
3. (CFGNewAllocator)
4. x
5. y
6. Foo::Foo

The analyzer currently ignores the CFGNewAllocator element, but the next
step is to treat that as a call like any other.

The CFGNewAllocator element is not added to the CFG for analysis-based
warnings, since none of them take advantage of it yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199123 91177308-0d34-0410-b5e6-96231b3b80d8
Hook up NetBSD/aarch64.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199124 91177308-0d34-0410-b5e6-96231b3b80d8
Update for getLazyBitcodeModule API change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199126 91177308-0d34-0410-b5e6-96231b3b80d8
Follow-up to r199120: don't try referencing the dtor if the param decl isn't valid.

This was caught by running test/SemaCXX/destructor.cpp in MS ABI mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199128 91177308-0d34-0410-b5e6-96231b3b80d8
[ms-abi] Quick fix layout of an array of records

This fixes llvm::SmallVector, which fixes lots of TUs in the MS ABI self
host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199129 91177308-0d34-0410-b5e6-96231b3b80d8
Update tests in preparation for using the MS ABI for Win32 targets

In preparation for making the Win32 triple imply MS ABI mode,
make all tests pass in this mode, or make them use the Itanium
mode explicitly.

Differential Revision: http://llvm-reviews.chandlerc.com/D2401

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199130 91177308-0d34-0410-b5e6-96231b3b80d8
Use the MS ABI for Win32 targets by default

In addition to being a sensible default, this is a huge improvement
in test coverage for the MS ABI: any bot that targets Win32 will
now run the test suite using the MS ABI by default.

Differential Revision: http://llvm-reviews.chandlerc.com/D2401

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199131 91177308-0d34-0410-b5e6-96231b3b80d8
[ms-abi] Leading VFPtrs don't suppress the leading zero sized flag

The MS-ABI tracks a bit that asserts that the first sub-object is zero 
sized.  This bit is used to add padding between objects if there's the 
potential for zero sized objects to alias.  The bit is still true even 
if the zero sized base is lead by a VFPtr.  This patch makes clang mimic 
that behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199132 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: Remove some unnecessary braces

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199136 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: Remove a superfluous setCurrentRegionCount

This call looks like it was an artifact of an earlier change, and
doesn't actually make sense. We begin a new region immediately anyway,
so it was mostly harmless.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199137 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: Introduce CodeGenPGO::setCurrentRegionUnreachable

There are a number of places where we do PGO.setCurrentRegionCount(0)
directly after an unconditional branch. Give this operation a name so
that it's clearer why we're doing this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199138 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: Rename adjustFallThroughCount -> adjustForControlFlow

adjustFallThroughCount isn't a good name, and the documentation was
even worse. This commit attempts to clarify what it's for and when to
use it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199139 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: Clarify a comment about PGO in case statement ranges

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199140 91177308-0d34-0410-b5e6-96231b3b80d8
There is no such thing as __attribute__((align)); that's a __declspec attribute. Fixing these test cases to use the proper spelling for their syntax.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199141 91177308-0d34-0410-b5e6-96231b3b80d8
Updating the attribute declarations to have the correct syntaxes. This means giving a __declspec spelling to: deprecated, naked, noinline, noreturn, and nothrow. uuid has no GNU spelling, so it was switched to __declspec. dllexport and dllimport both are now supported with GNU spellings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199142 91177308-0d34-0410-b5e6-96231b3b80d8
__forceinline is a keyword, and not a GNU-style attribute. This FIXME appears to be out-dated, and the attribute syntax is becoming more important these days.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199143 91177308-0d34-0410-b5e6-96231b3b80d8
When determining the attribute's parsed kind, pay attention to the syntax used. This fixes bugs where an attribute has differing GNU and Declspec spellings, but they are treated as the same. Eg) __declspec(aligned) when it should be __attribute__((aligned)), and __attribute__((align)) when it should be __declspec(align).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199144 91177308-0d34-0410-b5e6-96231b3b80d8
Teach the standalone Clang CMake bits about the flag to force using an
old toolchain to build. The toolchain version is now checked in
HandleLLVMOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199150 91177308-0d34-0410-b5e6-96231b3b80d8
Adding myself as the code owner for the attribute subsystem.

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