Sema: Allow aliases to have incomplete type

gcc supports this behavior and it is pervasively used inside the Linux
kernel.

Note that both gcc and clang will reject code that attempts to do this
in a C++ language mode.

This fixes PR17998.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212631 91177308-0d34-0410-b5e6-96231b3b80d8
Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics.

Turn llvm::SpecialCaseList into a simple class that parses text files in
a specified format and knows nothing about LLVM IR. Move this class into
LLVMSupport library. Implement two users of this class:
  * DFSanABIList in DFSan instrumentation pass.
  * SanitizerBlacklist in Clang CodeGen library.
The latter will be modified to use actual source-level information from frontend
(source file names) instead of unstable LLVM IR things (LLVM Module identifier).

Remove dependency edge from ClangCodeGen/ClangDriver to LLVMTransformUtils.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212643 91177308-0d34-0410-b5e6-96231b3b80d8
[Driver] Expose getARMCPUForMArch() function in the Driver API; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212666 91177308-0d34-0410-b5e6-96231b3b80d8
Cleanup. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212667 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Fix __fastcall methods that return structs

The sret paramater consumes the register after the implicit 'this'
parameter, as with other calling conventions.

Fixes PR20278, which turned out to be very easy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212669 91177308-0d34-0410-b5e6-96231b3b80d8
Prevent link warnings due to -Wframe-larger-than=

Although this is nominally a -W option, we actually handle it in the driver
exactly as an f-group flag that's translated directly to -mllvm.

That means f_Group (and unintuitively, not W_Group) has the semantics we want
to make it behave like a standard warning flag: no automatic forwarding, no
warning for link invocations and compile-only.

Silences diagnostics like:

  [691/1545] Linking CXX executable bin/llvm-diff
  clang-3.5: warning: argument unused during compilation: '-Wframe-larger-than=2048'

(Hopefully we can move towards handling these in the frontend but that'll
require some infrastructure work.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212670 91177308-0d34-0410-b5e6-96231b3b80d8
Add clang headers that fix machine-dependent definitions on FreeBSD 9.2
Differential Revision: http://reviews.llvm.org/D3908


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212689 91177308-0d34-0410-b5e6-96231b3b80d8
[mips] Add support for -modd-spreg/-mno-odd-spreg

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212700 91177308-0d34-0410-b5e6-96231b3b80d8
[mips][mips64r6] Add support for mips-img-linux-gnu GCC toolchains

Summary:
* Support the multilib layout used by the mips-img-linux-gnu
* Recognize mips{,64}{,el}-img-linux-gnu as being aliases of mips-img-linux-gnu
* Use the correct dynamic linker for mips-img-linux-gnu
* Make mips32r6/mips64r6 the default CPU for mips-img-linux-gnu

Subscribers: mpf

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212719 91177308-0d34-0410-b5e6-96231b3b80d8
[x32] Adding X32 target support to driver, including TargetInfo,DescriptionString, flags, paths lookup, etc. Cover changes with new tests. The author of the patch is Pavel Chupin (@pavel.v.chupin).
The changes enable "hello world" on x32 target (x86_64-*-linux-gnux32). s/isX32/IsX32/ also fixed.

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212725 91177308-0d34-0410-b5e6-96231b3b80d8
[Codestyle][x32] Cosmetic codestyle fix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212728 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Check for code testing a variable for 0 after using it as a denominator.

This new checker, alpha.core.TestAfterDivZero, catches issues like this:

  int sum = ...
  int avg = sum / count; // potential division by zero...
  if (count == 0) { ... } // ...caught here

Because the analyzer does not necessarily explore /all/ paths through a program,
this check is restricted to only work on zero checks that immediately follow a
division operation (/ % /= %=). This could later be expanded to handle checks
dominated by a division operation but not necessarily in the same CFG block.

Patch by Anders Rönnholm! (with very minor modifications by me)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212731 91177308-0d34-0410-b5e6-96231b3b80d8
Fix clang tests to be compliant with LLVM IR aliases

Comdat IR references were mistakenly printed for aliases when they
passed through the IR/AsmWriter code.

This makes clang's tests not check for the existance of these wrongly
printed comdat references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212733 91177308-0d34-0410-b5e6-96231b3b80d8
[PowerPC] ABI support for non-Altivec vector types

This patch adds support for passing arguments of non-Altivec vector type
(i.e. defined via attribute ((vector_size (...)))) on powerpc64-linux.

While such types are not mentioned in the formal ABI document, this
patch implements a calling convention compatible with GCC:

- Vectors of size < 16 bytes are passed in a GPR
- Vectors of size > 16 bytes are passed via reference

Note that vector types with a number of elements that is not a power
of 2 are not supported by GCC, so there is no pre-existing ABI to
follow.  We choose to pass those (of size < 16) as if widened to the
next power of two, so they might end up in a vector register or
in a GPR.  (Sizes > 16 are always passed via reference as well.)

Reviewed by Hal Finkel.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212734 91177308-0d34-0410-b5e6-96231b3b80d8
Provide -verify support to match "any" line for diagnostics in included files.

Allow diagnostic checks that originate in included files to be matched without necessarily determining the line number that the diagnostic occurs on.  The new syntax replaces the line number with '*'.  This extension is limited to diagnostics in included files and may be used where the include file is not part of the test-suite itself.

Expected uses are for diagnostics originating in system headers, or for users who use -verify in testing 3rd-party library code where the location of diagnostics in header files may change from revision to revision and their precise location is not important to the success of the test-case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212735 91177308-0d34-0410-b5e6-96231b3b80d8
[PowerPC] ABI support for aligned by-value aggregates

This patch adds support for respecting the ABI and type alignment
of aggregates passed by value.  Currently, all aggregates are aligned
at 8 bytes in the parameter save area.  This is incorrect for two
reasons:

- Aggregates that need alignment of 16 bytes or more should be aligned
  at 16 bytes in the parameter save area.  This is implemented by
  using an appropriate "byval align" attribute in the IR.

- Aggregates that need alignment beyond 16 bytes need to be dynamically
  realigned by the caller.  This is implemented by setting the Realign
  flag of the ABIArgInfo::getIndirect call.

In addition, when expanding a va_arg call accessing a type that is
aligned at 16 bytes in the argument save area (either one of the
aggregate types as above, or a vector type which is already aligned
at 16 bytes), code needs to align the va_list pointer accordingly.

Reviewed by Hal Finkel.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212743 91177308-0d34-0410-b5e6-96231b3b80d8
[Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMCPUForMArch() function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212751 91177308-0d34-0410-b5e6-96231b3b80d8
Quick (attempted) fix for non-asserts builds for a test introduced in r212743.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212752 91177308-0d34-0410-b5e6-96231b3b80d8
Avoid definining more GCC specific predefined macros in clang-cl

Reviewers: hansw, rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212753 91177308-0d34-0410-b5e6-96231b3b80d8
Remove use of uniform initialization ({}) introduced in r212725 since this isn't supported in MSVC.

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