diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-10-23 20:52:43 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-10-23 20:52:43 +0000 |
commit | 0eb8bbdeab4eee10abf9309c56a201cfc5e1edbe (patch) | |
tree | f5e7348788af6d71e4af7ae232d9dce690bd4ce4 /clang/lib/AST/Decl.cpp | |
parent | 3197b25b27ab1f9b74321e4841f0d8e5fd95f1f6 (diff) | |
download | bcm5719-llvm-0eb8bbdeab4eee10abf9309c56a201cfc5e1edbe.tar.gz bcm5719-llvm-0eb8bbdeab4eee10abf9309c56a201cfc5e1edbe.zip |
AST: Mangle fields in anonymous structs/unions
The Itanium mangler couldn't cope with mangling an IndirectFieldDecl.
Instead, mangle the field the IndirectFieldDecl refers to.
Further, give IndirectFieldDecl no linkage just like FieldDecl.
N.B. Decl.cpp:getLVForNamespaceScopeDecl tried to calculate linkage for
data members of anonymous structs/unions. However, this seems
impossible so turn it into an assertion.
llvm-svn: 193269
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index e18afb02c9d..23e53fffb09 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -575,11 +575,10 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, // Explicitly declared static. if (Function->getCanonicalDecl()->getStorageClass() == SC_Static) return LinkageInfo(InternalLinkage, DefaultVisibility, false); - } else if (const FieldDecl *Field = dyn_cast<FieldDecl>(D)) { - // - a data member of an anonymous union. - if (cast<RecordDecl>(Field->getDeclContext())->isAnonymousStructOrUnion()) - return LinkageInfo::internal(); } + // - a data member of an anonymous union. + assert(!isa<IndirectFieldDecl>(D) && "Didn't expect an IndirectFieldDecl!"); + assert(!isa<FieldDecl>(D) && "Didn't expect a FieldDecl!"); if (D->isInAnonymousNamespace()) { const VarDecl *Var = dyn_cast<VarDecl>(D); @@ -786,6 +785,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, if (!(isa<CXXMethodDecl>(D) || isa<VarDecl>(D) || isa<FieldDecl>(D) || + isa<IndirectFieldDecl>(D) || isa<TagDecl>(D))) return LinkageInfo::none(); |