]> granicus.if.org Git - clang/commitdiff
MS ABI: Use the most recent decl to check the inheritance model
authorReid Kleckner <reid@kleckner.net>
Sat, 8 Feb 2014 01:15:37 +0000 (01:15 +0000)
committerReid Kleckner <reid@kleckner.net>
Sat, 8 Feb 2014 01:15:37 +0000 (01:15 +0000)
This was crashing compilation of DeclContext::buildLookupImpl<>.

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

lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms-templates-memptrs.cpp

index 4ecbab437bc40ac73d8578156f85d89f366b07a5..a8a09a7e60420615d8a23edad32ae10fe3fcf96f 100644 (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 {
index 0d30b9efb4f14bd0b586743ab1cdef7eb7e680c0..803cac3748b1c802ba9f5035818850175c5cf379 100644 (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;