MS ABI: Use the proper type for inalloca args

Summary:
The definition of a type later in a translation unit may change it's
type from {}* to (%struct.foo*)*.  Earlier function definitions may use
the former while more recent definitions might use the later.  This is
fine until they interact with one another (like one calling the other).
In these cases, a bitcast is needed because the inalloca must match the
function call but the store to the lvalue which initializes the argument
slot has to match the rvalue's type.

This technique is along the same lines with what the other,
non-inalloca, codepaths perform.

This fixes PR19287.

Reviewers: rnk

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205217 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Make test introduced in r205217 more robust

Don't assume any particular IR Value name, pattern match the names from
the GEP instructions instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205218 91177308-0d34-0410-b5e6-96231b3b80d8
Remove unused diagnostic + dead test for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205220 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Document the '\xc1' to '\xda' manglings

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205223 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: mangleStringLiteral shouldn't rely on the host's endianness

No test case is needed, the one in-tree is sufficient.  The build-bot
never emailed me because something else had upset it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205225 91177308-0d34-0410-b5e6-96231b3b80d8
Introduced an attribute syntax-neutral method for parsing attribute arguments that is currently being used by GNU and C++-style attributes. This allows C++11 attributes with argument lists to be handled properly, fixing the "deprecated", "type_visibility", and capability-related attributes with arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205226 91177308-0d34-0410-b5e6-96231b3b80d8
Unify __declspec attribute argument parsing with the common attribute argument parsing code.

This removes a diagnostic that is no longer required (the semantic engine now properly handles attribute syntax so __declspec and __attribute__ spellings no longer get mismatched). This caused several testcases to need updating for a slightly different wording.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205234 91177308-0d34-0410-b5e6-96231b3b80d8
Remove redundant template specialization that just duplicates the partial
specialization that would otherwise be selected.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205249 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Simplify endian swapping code

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205250 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Add a test for Unicode literals

This adds coverage for Unicode code points which are encoded with
non-zero values in the upper half of the wchar_t.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205251 91177308-0d34-0410-b5e6-96231b3b80d8
Implement the 'optnone' attribute, which suppresses most optimizations
on a function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205255 91177308-0d34-0410-b5e6-96231b3b80d8
DebugInfo compression: Enable compression before any sections are created.

For those playing at home this produced some fairly subtle behavior. The
sections created in InitMCObjectFileInfo were created without compressed
debug info (a mistake, but not necessarily /broken). Since these
sections were almost always referenced by the existing MCSection object,
this almost worked.

This got weird when we got to handling the relocations for a section.
See ELFObjectWriter::WriteSection where we compute the true section for
a relocation section by simply stripping the ".rela" prefix and then
looking up that section - doing so hit the compression codepath, looked
up .zdebug_blah and found a newly constructed empty section... thus,
things got weird.

This is untestable without a cross-project test (let me know if people
would prefer that to no testing).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205261 91177308-0d34-0410-b5e6-96231b3b80d8
Warn when requesting compress-debug-sections and zlib is not available

Another shot in the dark, since I do have zlib installed. Will be
watching the bots for fallout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205265 91177308-0d34-0410-b5e6-96231b3b80d8
Comment necessity of early initialization

Code review feedback from Eric Christopher on r204261.

I didn't want to go into too much detail (the revision history should
provide the full stuff) - but I can add more if that's preferred.

Also moved this up to right by the construction of the MCAsmInfo so
there's less chance that other things might sneak in in between.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205267 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Simplify MangleByte further

It turns out that the ranges where the '?' <letter> manglings occur are
identical to the ranges of ASCII characters OR'd with 0x80.

Thanks to Richard Smith for the insight!

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205270 91177308-0d34-0410-b5e6-96231b3b80d8
Fix up compression related test cases

Fallout from r205261, ensure it doesn't matter how we disable compressed
debug info, even if zlib is missing and that we warn when we don't have
zlib and don't warn when we do, all while silently suppressing these
tests on the systems they weren't intended for...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205271 91177308-0d34-0410-b5e6-96231b3b80d8
Disable this-return optimizations when targeting iOS 5 and earlier.

Clang implements the part of the ARM ABI saying that certain functions
(e.g., constructors and destructors) return "this", but Apple's version of
gcc and llvm-gcc did not. The libstdc++ dylib on iOS 5 was built with
llvm-gcc, which means that clang cannot safely assume that code from the C++
runtime will correctly follow the ABI. It is also possible to run into this
problem when linking with other libraries built with gcc or llvm-gcc. Even
though there is no way to reliably detect that situation, it is most likely
to come up when targeting older versions of iOS. Disabling the optimization
for any code targeting iOS 5 solves the libstdc++ problem and has a reasonably
good chance of fixing the issue for other older libraries as well.
<rdar://problem/16377159>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205272 91177308-0d34-0410-b5e6-96231b3b80d8
Add failing testcase for DR305. Looks like we didn't implement the resolution
here in the simple-template-id case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205273 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Add double-unlock detection to PthreadLockChecker.

We've decided to punt on supporting recursive locks for now; the common case
is non-recursive.

Patch by Daniel Fahlgren!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205274 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Lock checker: make sure locks aren't used after being destroyed.

Patch by Daniel Fahlgren!

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