summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTReaderDecl.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-08-31 18:48:39 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-08-31 18:48:39 +0000
commit0035052729e4a3adfbbf0a65ac42d372e9a29c55 (patch)
treee941f52afb7f7eae68bf12a49a2e11ab8a728622 /clang/lib/Serialization/ASTReaderDecl.cpp
parentd40722e26787a6e080e0de30d8980bc15da93ec9 (diff)
downloadbcm5719-llvm-0035052729e4a3adfbbf0a65ac42d372e9a29c55.tar.gz
bcm5719-llvm-0035052729e4a3adfbbf0a65ac42d372e9a29c55.zip
[MS ABI] Correctly mangle classes without names for linkage purposes
A class without a name for linkage purposes gets a name along the lines of <unnamed-type-foo> where foo is either the name of a declarator which defined it (like a variable or field) or a typedef-name (like a typedef or alias-declaration). We handled the declarator case correctly but it would fall down during template instantiation if the declarator didn't share the tag's type. We failed to handle the typedef-name case at all. Instead, keep track of the association between the two and keep it up to date in the face of template instantiation. llvm-svn: 246469
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 00785aa1d05..25a684a531e 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -441,8 +441,8 @@ void ASTDeclReader::Visit(Decl *D) {
// If this is a tag declaration with a typedef name for linkage, it's safe
// to load that typedef now.
if (NamedDeclForTagDecl)
- cast<TagDecl>(D)->NamedDeclOrQualifier =
- cast<NamedDecl>(Reader.GetDecl(NamedDeclForTagDecl));
+ cast<TagDecl>(D)->TypedefNameDeclOrQualifier =
+ cast<TypedefNameDecl>(Reader.GetDecl(NamedDeclForTagDecl));
} else if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) {
// if we have a fully initialized TypeDecl, we can safely read its type now.
ID->TypeForDecl = Reader.GetType(TypeIDForTypeDecl).getTypePtrOrNull();
@@ -595,16 +595,13 @@ ASTDeclReader::RedeclarableResult ASTDeclReader::VisitTagDecl(TagDecl *TD) {
case 1: { // ExtInfo
TagDecl::ExtInfo *Info = new (Reader.getContext()) TagDecl::ExtInfo();
ReadQualifierInfo(*Info, Record, Idx);
- TD->NamedDeclOrQualifier = Info;
+ TD->TypedefNameDeclOrQualifier = Info;
break;
}
case 2: // TypedefNameForAnonDecl
NamedDeclForTagDecl = ReadDeclID(Record, Idx);
TypedefNameForLinkage = Reader.GetIdentifierInfo(F, Record, Idx);
break;
- case 3: // DeclaratorForAnonDecl
- NamedDeclForTagDecl = ReadDeclID(Record, Idx);
- break;
default:
llvm_unreachable("unexpected tag info kind");
}
OpenPOWER on IntegriCloud