Fix a vftable mangling bug

We need to walk the class hierarchy twice: once in depth-first base
specifier order for mangling and again in depth-first layout order for
vftable layout.

Vftable layout seems to depend on the full path from the most derived
class to the base containing the vfptr.

Fixes PR21031.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218285 91177308-0d34-0410-b5e6-96231b3b80d8
Don't use comdats for initializers on platforms that don't support it

In particular, pre-.init_array ELF uses the .ctors section mechanism.
MinGW COFF also uses .ctors, now that I think about it. Therefore,
restrict this optimization to the two platforms that are currently known
to work: ELF with .init_array and COFF with .CRT$XCU.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218287 91177308-0d34-0410-b5e6-96231b3b80d8
Attempt to fix Sema/builtin-object-size.c after r218258

The type of size_t varies between targets.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218288 91177308-0d34-0410-b5e6-96231b3b80d8
Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.

Also add a test to make sure that this doesn't break again. Fixes PR21036.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218292 91177308-0d34-0410-b5e6-96231b3b80d8
AST: Mangle cast expression encoding more accurately

Don't mangle all casts in expressions as "cv", use the appropriate
encoding which corresponds to a specific cast.

This fixes PR21034.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218293 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a typo in comment in ASTBitCodes.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218294 91177308-0d34-0410-b5e6-96231b3b80d8
Reverting r214064 and r215650 while investigating a pesky performance regression

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218296 91177308-0d34-0410-b5e6-96231b3b80d8
[mips] Fix r218248's testcase to use -O1 instead of -O3.
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218298 91177308-0d34-0410-b5e6-96231b3b80d8
[OPENMP] Parsing/Sema of directive omp parallel for simd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218299 91177308-0d34-0410-b5e6-96231b3b80d8
Revert "Don't use comdats for initializers on platforms that don't support it"

On further investigation, COMDATs should work with .ctors, and the issue
I was hitting probably reproduces with .init_array.

This reverts commit r218287.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218313 91177308-0d34-0410-b5e6-96231b3b80d8
Don't perform ADL when looking up operator=; there is no non-member form of
that function, and apart from being slow, this is unnecessary: ADL can trigger
instantiations that are not permitted here. The standard isn't *completely*
clear here, but this seems like the intent, and in any case this approach is
permitted by [temp.inst]p7.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218330 91177308-0d34-0410-b5e6-96231b3b80d8
PR18793: If we try to EnterTokenStream when our current lexer is a caching
lexer, add the token buffer underneath the caching lexer where possible and
push the tokens directly into the caching lexer otherwise. We previously
put the lexer into a corrupted state where we could not guarantee to provide
the tokens in the right order and would sometimes assert.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218333 91177308-0d34-0410-b5e6-96231b3b80d8
Improve -Wuninitialized to take into account field ordering with initializer
lists.  Since the fields are inititalized one at a time, using a field with
lower index to initialize a higher indexed field should not be warned on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218339 91177308-0d34-0410-b5e6-96231b3b80d8
MS ABI: Pure virtual functions don't contribute to vtordisps

Usually, overriding a virtual function defined in a virtual base
required emission of a vtordisp slot in the record.  However no vtordisp
is needed if the overriding function is pure; it should be impossible to
observe the pure virtual method.

This fixes PR21046.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218340 91177308-0d34-0410-b5e6-96231b3b80d8
Follow-up to r218292: Add more REVERTIBLE_TYPE_TRAITs.

r218292 reverted r197496 because it broke things. In addition to breaking
things, r197496 also made all traits starting with __is_ revertible.
Reinstantiate that part of r197496 because code out there (e.g. libc++) depends
on this behavior. Fixes PR21045.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218365 91177308-0d34-0410-b5e6-96231b3b80d8
Fix an edge case with BinaryOperator's in -Wuninitialized.  Add testcases for
the other visitors as well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218366 91177308-0d34-0410-b5e6-96231b3b80d8
Fix the argument index error of __builtin___memccpy_chk

memccpy_check should have source and dest size at arg 3 and 4
rdar://18431336

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218367 91177308-0d34-0410-b5e6-96231b3b80d8
[x86] Fixed argument types in intrinsics:
_addcarryx_u64
_addcarry_u64
_subborrow_u64

Thanks Pasi Parviainen for notice.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218376 91177308-0d34-0410-b5e6-96231b3b80d8
Sema: Inherit the flexible array property from struct fields

A record which contains a flexible array member is itself a flexible
array member.  A struct which contains such a record should also
consider itself to be a flexible array member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218378 91177308-0d34-0410-b5e6-96231b3b80d8
Clean up ClangTool's argument adjuster handling a bit with unique_ptr.

Make the dtor non-virtual while there. No functionality change.

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