Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.

The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,

  link "clangAST"

or

  link framework "MyFramework"

Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.

For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172437 91177308-0d34-0410-b5e6-96231b3b80d8
This patch addresses varargs processing for small complex types under
the 64-bit PowerPC ELF ABI.

The ABI requires that the real and imaginary parts of a complex argument
each occupy their own doubleword.  Arguments smaller than 8 bytes are
right-adjusted within the doubleword.

Clang expects EmitVAARG() to return a pointer to a structure in which
the real and imaginary parts are packed adjacently in memory.  To accomplish
this, we generate code to load the code appropriately from the varargs
location and pack the values into a temporary variable in the form Clang
expects, returning a pointer to that structure.

The test case demonstrates correct code generation for all "small" complex
types on PPC64:  int, short, char, and float.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172438 91177308-0d34-0410-b5e6-96231b3b80d8
Infer "link" lines for top-level frameworks. Essentially, a framework
will have a shared library with the same name as its framework (and no
suffix!) within its .framework directory. Detect this both when
inferring the whole top-level framework and when parsing a module map.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172439 91177308-0d34-0410-b5e6-96231b3b80d8
Switch autolinking metadata format over to actual linker options, e.g.,

  !0 = metadata !{metadata !"-lautolink"}
  !1 = metadata !{metadata !"-framework", metadata !"autolink_framework"}

referenced from llvm.module.linkoptions, e.g.,

  !llvm.module.linkoptions = !{!0, !1, !2, !3}

This conceptually moves the logic for figuring out the syntax the
linker will accept from LLVM into Clang. Moreover, it makes it easier
to support MSVC's

  #pragma comment(linker, "some option")

in the future, should anyone care to do so.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172441 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] -drain is not an alias for -release.

This was previously added to support -[NSAutoreleasePool drain], which
behaves like -release under non-GC and "please collect" under GC. We're
not currently modeling the autorelease pool stack, though, so we can
just take this out entirely.

Fixes PR14927.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172444 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Fix cast-away-const warning by using const_cast.

Patch by David Greene, modified by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172445 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Add ProgramStatePartialTrait<const void *>.

This should fix cast-away-const warnings reported by David Greene.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172446 91177308-0d34-0410-b5e6-96231b3b80d8
When forming the link options for an imported module, also include the
link options for the modules it imports.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172448 91177308-0d34-0410-b5e6-96231b3b80d8
Topologically sort the link options generated for modules based on
module-import dependencies, so we'll get the link order correct for
those silly linkers that need it.


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

We lower these into 2x chained usub.with.overflow intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172476 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor to call ActOnFinishFullExpr on every full expression. Teach
ActOnFinishFullExpr that some of its checks only apply to discarded-value
expressions. This adds missing checks for unexpanded variadic template
parameter packs to a handful of constructs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172485 91177308-0d34-0410-b5e6-96231b3b80d8
Document that we should recognize attributes supported by gcc with C++11
[[gnu::...]] syntax

Pointed out by Richard Smith on the mailing list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172487 91177308-0d34-0410-b5e6-96231b3b80d8
[driver] Warnings for warning options are handled by the frontend.  The driver needs to process the
warning options to setup diagnostic state, but should not be emitting warnings as these would be
rudndant with what the frontend emits.
rdar://13001556

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172497 91177308-0d34-0410-b5e6-96231b3b80d8
Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
attributes appertain to a declaration, even though they would be much more
naturally modelled as appertaining to a function type. Previously, we would
try to distribute them from the declarator to the function type, then
reject them for being at an incorrect location. Now, we just distribute them
as far as the declarator; the existing attribute handling code can actually
apply them there just fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172504 91177308-0d34-0410-b5e6-96231b3b80d8
Add -fopenmp -cc1 option and wire it up to define _OPENMP, from Alexey Bataev!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172509 91177308-0d34-0410-b5e6-96231b3b80d8
PR14918: Don't confuse braced-init-lists after template variable declarations
with function definitions.

We really should remove Parser::isDeclarationAfterDeclarator entirely, since
it's meaningless in C++11 (an open brace could be either a function definition
or an initializer, which is what it's trying to differentiate between). The
other caller of it happens to be correct right now...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172510 91177308-0d34-0410-b5e6-96231b3b80d8
PR14950: Fix out-of-bounds function parameter access in literal operator lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172514 91177308-0d34-0410-b5e6-96231b3b80d8
Don't crash when binding a reference to a temporary pointer created from
resolving an overloaded function reference within an initializer list.
Previously we would try to resolve the overloaded function reference without
first stripping off the InitListExpr wrapper.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172517 91177308-0d34-0410-b5e6-96231b3b80d8
Resolved merge error with r172323 (llvm::X -> X)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172528 91177308-0d34-0410-b5e6-96231b3b80d8
Fixes various bugs around the keywords class, struct and union.

This switches to parsing record definitions only if we can clearly
identify them. We're specifically allowing common patterns for
visibility control through macros and attributes, but we cannot
currently fix all instances. This fixes all known bugs we have though.

Before:
static class A f() {
  return g();
} int x;

After:
static class A f() {
  return g();
}
int x;

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