libclang: New functions clang_Type_getNumTemplateArguments,
clang_Type_getTemplateArgument

Note that these functions don't handle variadic templates -- see tests.

Patch by Matthieu Nottale and Philippe Daouadi.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202406 91177308-0d34-0410-b5e6-96231b3b80d8
Assert that the name of some internal variables start with \01L or \01l.

No functionality change. This is just an intermediate patch for changing those
global variables to use private linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202409 91177308-0d34-0410-b5e6-96231b3b80d8
Split FileEntry name vs. isValid

This is a small bit of refactoring in preparation for FileEntry owning
the storage for its own name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202412 91177308-0d34-0410-b5e6-96231b3b80d8
Use private linkage for globals we already name with \01L and \01l.

In llvm the only semantic difference between internal and private is that llvm
tries to hide private globals my mangling them with a private prefix. Since
the globals changed by this patch already had the magic don't mangle marker,
there should be no change in the generated assembly.

A followup patch should then be able to drop the \01L and \01l prefixes and let
llvm mangle as appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202419 91177308-0d34-0410-b5e6-96231b3b80d8
Remove constructors from FileEntry that prevent owning resources

This cleans up some constructors that would not be safe once FileEntry
owns the storage for its name. These were already suspect, since they
wouldn't work if the FileEntry had an open file descriptor. The only
user for these constructors was in UniqueFileContainer, which wasn't a
very useful abstraction anyway. So it and UniqueDirContainer have been
replaced with std::map<UniqueID, *>.

This change should not affect anything outside the FileManager.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202420 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Remove constructors from FileEntry that prevent owning resources"

This reverts commit r202420, which broke the build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202421 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Fix vftable mangling by using the vbtable name algorithm

Summary:
This merges VFPtrInfo and VBTableInfo into VPtrInfo, since they hold
almost the same information.  With that change, the vbtable mangling
code can easily be applied to vftable data and we magically get the
correct, unambiguous vftable names.

Fixes PR17748.

Reviewers: timurrrr, majnemer

CC: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202425 91177308-0d34-0410-b5e6-96231b3b80d8
Diagnose attempts to apply ms_struct to records with base classes
or virtual functions, but permit that error to be downgraded to
a warning (with -Wno-error=incompatible-ms-struct), and officially
support this kind of dual, ABI-mixing layout.

The basic problem here is that projects which use ms_struct are often
not very circumspect about what types they annotate; for example,
some projects enable the pragma in a prefix header and then only
selectively disable it around system header inclusions.  They may
only care about binary compatibility with MSVC for a subset of
those structs, but that doesn't mean they have no binary
compatibility concerns at all for the rest; thus we are essentially
forced into supporting this hybrid ABI.  But it's reasonable for
us to at least point out the places where we're not making
any guarantees.

The original diagnostic was for dynamic classes, i.e. those with
virtual functions or virtual bases; I've extended it to include
all classes with bases, because we are not actually making any
attempt to duplicate MSVC's base subobject layout in ms_struct
(and it is indeed quite different from Itanium, even for
non-virtual bases).

rdar://16178895

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202427 91177308-0d34-0410-b5e6-96231b3b80d8
Fix -Wunused-function in Release build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202429 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] check for now possibly null predecessor edge.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202434 91177308-0d34-0410-b5e6-96231b3b80d8
[CFG] record the original (now unreachable) block of 'case:' and 'default:' cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202435 91177308-0d34-0410-b5e6-96231b3b80d8
[-Wunreachable-code] always treat 'case:' and 'default:' cases as reachable.

This is a heuristic.  Many switch statements, although they look covered
over an enum, may actually handle at runtime more values than in the enum.

This is overly conservative, as there are some cases that clearly
can be ruled as being clearly unreachable, e.g. 'switch (42) { case 1: ... }'.
We can refine this later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202436 91177308-0d34-0410-b5e6-96231b3b80d8
Remove an assertion that no longer holds. <rdar://problem/16135814>

In r201528, I changed the PGO instrumentation counter for a "do" loop to not
include the fall-through count. That fall-through count is included later, b
it means that this assertion may fail for "do" loops.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202437 91177308-0d34-0410-b5e6-96231b3b80d8
Reapply r202420 hopefully fixed for other STLs

Keep the copy constructor around, and add a FIXME that we should really
remove it as soon as we have C++11 std::map's emplace function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202439 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Attempt to fix DenseMap entry reference invalidation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202441 91177308-0d34-0410-b5e6-96231b3b80d8
Honour 'use-external-names' in FileManager

Pass through the externally-visible names that we got from the VFS down
to FileManager, and test that this is the name showing up in __FILE__,
diagnostics, and debug information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202442 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Honour 'use-external-names' in FileManager"

Revert r202442, which broke the buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202443 91177308-0d34-0410-b5e6-96231b3b80d8
"&&&" != "&&"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202444 91177308-0d34-0410-b5e6-96231b3b80d8
Add -mcrbits/-mno-crbits to control the PowerPC CR-bit-tracking feature

The backend currently enables CR-bit tracking by default at -O2 and higher.
These flags allow the user to override that default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202453 91177308-0d34-0410-b5e6-96231b3b80d8
-fdump-record-layouts: Sort nvbases by offset before printing them

It makes our -fdump-record-layouts a little more sane.

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