MS ABI: Use the most recent decl to check the inheritance model

This was crashing compilation of DeclContext::buildLookupImpl<>.

llvm-svn: 201013
This commit is contained in:
Reid Kleckner 2014-02-08 01:15:37 +00:00
parent f8b417c5ef
commit e253b098d3
2 changed files with 8 additions and 3 deletions

View File

@ -1084,12 +1084,13 @@ void MicrosoftCXXNameMangler::mangleTemplateArg(const TemplateDecl *TD,
case TemplateArgument::Declaration: {
const NamedDecl *ND = cast<NamedDecl>(TA.getAsDecl());
if (isa<FieldDecl>(ND) || isa<IndirectFieldDecl>(ND)) {
mangleMemberDataPointer(cast<CXXRecordDecl>(ND->getDeclContext()),
cast<ValueDecl>(ND));
mangleMemberDataPointer(
cast<CXXRecordDecl>(ND->getDeclContext())->getMostRecentDecl(),
cast<ValueDecl>(ND));
} else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD);
if (MD && MD->isInstance())
mangleMemberFunctionPointer(MD->getParent(), MD);
mangleMemberFunctionPointer(MD->getParent()->getMostRecentDecl(), MD);
else
mangle(FD, "$1?");
} else {

View File

@ -22,6 +22,10 @@ int ReadField(T &o) {
return F ? o.*F : 0;
}
// Redeclare some of the classes so that the implicit attribute goes on the most
// recent redeclaration rather than the definition.
struct V;
void ReadFields() {
A a;
I i;