[ASan] Print exact source location of global variables in error reports.

See https://code.google.com/p/address-sanitizer/issues/detail?id=299 for the
original feature request.

Introduce llvm.asan.globals metadata, which Clang (or any other frontend)
may use to report extra information about global variables to ASan
instrumentation pass in the backend. This metadata replaces
llvm.asan.dynamically_initialized_globals that was used to detect init-order
bugs. llvm.asan.globals contains the following data for each global:
  1) source location (file/line/column info);
  2) whether it is dynamically initialized;
  3) whether it is blacklisted (shouldn't be instrumented).

Source location data is then emitted in the binary and can be picked up
by ASan runtime in case it needs to print error report involving some global.
For example:

  0x... is located 4 bytes to the right of global variable 'C::array' defined in '/path/to/file:17:8' (0x...) of size 40

These source locations are printed even if the binary doesn't have any
debug info.

This is an ABI-breaking change. ASan initialization is renamed to
__asan_init_v4(). Pre-built libraries compiled with older Clang will not work
with the fresh runtime.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212188 91177308-0d34-0410-b5e6-96231b3b80d8
ARCMigrate: simplify diagnostic handling

Recent enhancements in the diagnostics engine mean that
TransformActions::report() no longer needs to duplicate this suppression logic.

That's great because the old code was flawed and would have attached notes to
the wrong primary diagnostic in non-trivial use.

With these changes it becomes safe to use reportNote() freely in the migration
tool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212191 91177308-0d34-0410-b5e6-96231b3b80d8
Update the MSVC Compatibility document

It hasn't been updated to reflect the progress we've made.  We've fuzz
tested VFTables, VBTables, layout, and RTTI data.  We support lambdas
that are compatible with their scheme.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212193 91177308-0d34-0410-b5e6-96231b3b80d8
CodeGen: make target builtins support languages

This extends the target builtin support to allow language specific annotations
(i.e. LANGBUILTIN).  This is to allow MSVC compatibility whilst retaining the
ability to have EABI targets use a __builtin_ prefix.  This is merely to allow
uniformity in the EABI case where the unprefixed name is provided as an alias in
the header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212196 91177308-0d34-0410-b5e6-96231b3b80d8
Fixup typo in MSVCCompatibility.rst

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212219 91177308-0d34-0410-b5e6-96231b3b80d8
Fix Typo in MSVCCompatibility.rst
Also removed a sentance that was no longer relevant.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212227 91177308-0d34-0410-b5e6-96231b3b80d8
More editorial issues in MSVCCompatibility.rst

Make the status text for lambdas green.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212229 91177308-0d34-0410-b5e6-96231b3b80d8
Fix linkage bug that miscompiled variable templates instantiated from similarly named local types. In essence, this bug ensures that the x<Foo> specialization in function foo() defined as follows differs between two distinct translation units.
    static int &foo() {
       struct Foo { };
       return x<Foo>;
    }

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212233 91177308-0d34-0410-b5e6-96231b3b80d8
Update the MSVC compatibilty document for class template parsing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212237 91177308-0d34-0410-b5e6-96231b3b80d8
Enable clang to continue to parse libstdc++4.6 and stlport after r210091.

r210091 made initialization checking more strict in c++11 mode. LWG2193 is
about changing standard libraries to still be valid under these new rules,
but older libstdc++ (e.g. libstdc++4.6 in -D_GLIBCXX_DEBUG=1 mode, or stlport)
do not implement that yet.  So fall back to the C++03 semantics for container
classes in system headers below the std namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212238 91177308-0d34-0410-b5e6-96231b3b80d8
Address review feedback for r212238.

Also, forgot to say in the commit message of r212238: Library authors will
see a warning about this issue if they build with -Wsystem-headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212243 91177308-0d34-0410-b5e6-96231b3b80d8
ARM: rename ARM builtins to use __builtin_arm prefix

This corrects SVN r212196's naming change to use the proper prefix of
`__builtin_arm_` instead of `__builtin_`.

Thanks to Yi Kong for pointing out the incorrect naming!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212253 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Get linkage of RTTI data correct

The Itanium rules are not appropriate for the MS ABI.  RTTI data is
_never_ imported and thus is never available_externally.  It is either
internal (if the type's linkage is internal) or linkonce_odr.

This also means that classes which inherit from dllimport'd bases force
their translation unit to duplicate the entirety of the RTTI data of
that base.

Interestingly, the complete object locator can never be referenced by
translation units which import the class.

This fixes PR20106.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212256 91177308-0d34-0410-b5e6-96231b3b80d8
[Driver][Mips] Check MIPS CPU name provided to the Clang driver.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212260 91177308-0d34-0410-b5e6-96231b3b80d8
ARMEB: Fix function result return for composite types

Reviewed at http://reviews.llvm.org/D4364



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212261 91177308-0d34-0410-b5e6-96231b3b80d8
refactor for-loop as range-loop before making changes.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212262 91177308-0d34-0410-b5e6-96231b3b80d8
Move the calling of emitTargetMD() later.

Summary:
Because a global created by GetOrCreateLLVMGlobal() is not finalised until later viz:
  extern char a[];
  char f(){ return a[5];}
  char a[10];

Change MangledDeclNames to use a MapVector rather than a DenseMap so that the
Metadata is output in order of original declaration, so to make deterministic
and improve human readablity.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212263 91177308-0d34-0410-b5e6-96231b3b80d8
Add the __qdbl intrinsic to the arm_acle.h header

Patch by: Moritz Roth

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212264 91177308-0d34-0410-b5e6-96231b3b80d8
[ARM] Implement ISB memory barrier intrinsic

Adds support for __builtin_arm_isb. Also corrects DSB and ISB instructions
modelling by adding has-side-effects property.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212277 91177308-0d34-0410-b5e6-96231b3b80d8
The RTTI fallback is no more. Remove outdated diagnostic.

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