Refactor linkage computation in CGObjCMac.cpp.

Before this patch the globals were created with the wrong linkage and patched
afterwards. From the comments it looks like something would complain about
having an internal GV with no initializer. At least in clang the verifier will
only run way after we set the initializer, so that is not a problem.

This patch should be a nop. It just figures out the linkage earlier and
converts the old calls to setLinkage to asserts. The only case where that is
not possible is when we first see a weak import that is then implemented. In
that case we have to change the linkage, but that is the only setLinkage left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202305 91177308-0d34-0410-b5e6-96231b3b80d8
argument -> parameter terminology fixes for FunctionTypeInfo

This is a continuation of r199686.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202307 91177308-0d34-0410-b5e6-96231b3b80d8
PR18962: Fix "Unable to find record layout information for type"

Clang is using llvm::StructType::isOpaque() as a way of signaling if
we've finished record type conversion in
CodeGenTypes::isRecordLayoutComplete().  However, Clang was setting the
body of the type before it finished laying out the type as a base type.
Laying out the %class.C.base LLVM type attempts to convert more types,
eventually recursively attempting to layout 'C' again, at which point we
would say that layout was complete, even though we were still in the
middle of it.

By not setting the body, we correctly signal that layout is not
complete, and things work as expected.

At some point, it might be worth refactoring this to avoid looking at
the LLVM IR types under construction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202320 91177308-0d34-0410-b5e6-96231b3b80d8
Fix testcase for PR18962 with an explicit triple

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202324 91177308-0d34-0410-b5e6-96231b3b80d8
Rework CFG edges to encode potentially unreachable edges, instead of just making them NULL.

This is to support some analyses, like -Wunreachable-code, that
will need to recover the original unprunned CFG edges in order
to suppress issues that aren't really bugs in practice.

There are two important changes here:

- AdjacentBlock replaces CFGBlock* for CFG successors/predecessors.
  This has the size of 2 pointers, instead of 1.  This is unlikely
  to have a significant memory impact on Sema since a single
  CFG usually exists at one time, but could impact the memory
  usage of the static analyzer.  This could possibly be optimized
  down to a single pointer with some cleverness.

- Predecessors can now contain null predecessors, which means
  some analyses doing a reverse traversal will need to take into
  account.  This already exists for successors, which contain
  successor slots for specific branch kinds (e.g., 'if') that
  expect a fixed number of successors, even if a branch is
  not reachable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202325 91177308-0d34-0410-b5e6-96231b3b80d8
[CFG] Encode unreachable block information for successors when visiting 'if' statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202326 91177308-0d34-0410-b5e6-96231b3b80d8
[CFG] encode unreachable block information for would-have-been successors for calls to 'noreturn' functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202327 91177308-0d34-0410-b5e6-96231b3b80d8
[-Wunreachable-code] Prune out unreachable warnings where a 'break' is preceded by a call to a 'noreturn' function.

For example:

	unreachable();
    break;

This code is idiomatic and defensive.  The fact that 'break' is
unreachable here is not interesting.  This occurs frequently
in LLVM/Clang itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202328 91177308-0d34-0410-b5e6-96231b3b80d8
Add a 'use-external-names' option to VFS overlay files

When true, sets the name of the file to be the name from
'external-contents'. Otherwise, you get the virtual path that the file
was looked up by. This will not affect any non-virtual paths, or fully
virtual paths (for which there is no reasonable 'external' name anyway).

The setting is available globally, but can be overriden on a per-file
basis.

The goal is that this setting will control which path you see in debug
info, diagnostics, etc. which are sensitive to which path is used. That
will come in future patches that pass the name through to FileManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202329 91177308-0d34-0410-b5e6-96231b3b80d8
Fix -Wunused-variable in non-assert builds. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202330 91177308-0d34-0410-b5e6-96231b3b80d8
[MS ABI] Error instead of generating bad vftables for certain virtual hierarchies (PR18967)

Erroring out until we fix the bug means we don't have to keep chasing down
this same miscompile in a bunch of different places.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202331 91177308-0d34-0410-b5e6-96231b3b80d8
Pass down the debug emission kind into the compile unit for code
generation purposes.
Paired with a commit to llvm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202334 91177308-0d34-0410-b5e6-96231b3b80d8
Add category test case for attribute 'objc_protocol_requires_explicit_implementation'.

This test also illustrates that checking for properties is not working properly with
this attribute, as we are missing a diagnostic for a property not being implemented.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202335 91177308-0d34-0410-b5e6-96231b3b80d8
As of r202325, CFGBlock predecessors may be NULL. Ignore such preds. Fixes a crasher, PR18983.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202340 91177308-0d34-0410-b5e6-96231b3b80d8
Change this test to not try to emit any IR. (It should fail to, but it tries to create an output file before encountering the error.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202343 91177308-0d34-0410-b5e6-96231b3b80d8
[ASTUnit] Fix use-after-free bug in ASTUnit::getMainBufferWithPrecompiledPreamble().

With r197755 we started reading the contents of buffer file entries, but the
buffers may point to ASTReader blobs that have been disposed.

Fix this by having the CompilerInstance object keep a reference to the ASTReader
as well as having the ASTContext keep reference to the ExternalASTSource.

This was very difficult to construct a test case for.
rdar://16149782

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202346 91177308-0d34-0410-b5e6-96231b3b80d8
[-Wunreachable-code] Don't warn about unreachable 'default:' cases.

They are covered by -Wcovered-switch-default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202349 91177308-0d34-0410-b5e6-96231b3b80d8
Fix test case indentation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202351 91177308-0d34-0410-b5e6-96231b3b80d8
[-Wunreachable-code] Don't warn about trivially unreachable return statements preceded by 'noreturn' functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202352 91177308-0d34-0410-b5e6-96231b3b80d8
[OPENMP] First changes for Parsing and Sema for 'omp simd' directive support


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