r201013 - MS ABI: Use the most recent decl to check the inheritance model
Reid Kleckner
reid at kleckner.net
Fri Feb 7 17:15:37 PST 2014
Author: rnk
Date: Fri Feb 7 19:15:37 2014
New Revision: 201013
URL: http://llvm.org/viewvc/llvm-project?rev=201013&view=rev
Log:
MS ABI: Use the most recent decl to check the inheritance model
This was crashing compilation of DeclContext::buildLookupImpl<>.
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=201013&r1=201012&r2=201013&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Feb 7 19:15:37 2014
@@ -1084,12 +1084,13 @@ void MicrosoftCXXNameMangler::mangleTemp
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 {
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp?rev=201013&r1=201012&r2=201013&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp Fri Feb 7 19:15:37 2014
@@ -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;
More information about the cfe-commits
mailing list