r204744 - MS ABI: Mark direct virtual bases as visted when building vtable paths

Reid Kleckner reid at kleckner.net
Tue Mar 25 11:33:28 PDT 2014


Author: rnk
Date: Tue Mar 25 13:33:27 2014
New Revision: 204744

URL: http://llvm.org/viewvc/llvm-project?rev=204744&view=rev
Log:
MS ABI: Mark direct virtual bases as visted when building vtable paths

Fixes PR19240.  In retrospect, this is a fairly obvious bug.  :)

Modified:
    cfe/trunk/lib/AST/VTableBuilder.cpp
    cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp

Modified: cfe/trunk/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/VTableBuilder.cpp?rev=204744&r1=204743&r2=204744&view=diff
==============================================================================
--- cfe/trunk/lib/AST/VTableBuilder.cpp (original)
+++ cfe/trunk/lib/AST/VTableBuilder.cpp Tue Mar 25 13:33:27 2014
@@ -3210,6 +3210,8 @@ void MicrosoftVTableContext::computeVTab
     // morally virtual bases.
     for (const auto &I : Base->vbases())
       VBasesSeen.insert(I.getType()->getAsCXXRecordDecl());
+    if (I.isVirtual())
+      VBasesSeen.insert(Base);
   }
 
   // Sort the paths into buckets, and if any of them are ambiguous, extend all

Modified: cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp?rev=204744&r1=204743&r2=204744&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/microsoft-abi-vtables-virtual-inheritance.cpp Tue Mar 25 13:33:27 2014
@@ -659,3 +659,26 @@ C c;
 // MANGLING-DAG: @"\01??_7C at pr17748@@6BA at 1@@"
 // MANGLING-DAG: @"\01??_7C at pr17748@@6BB at 1@@"
 }
+
+namespace pr19240 {
+struct A {
+  virtual void c();
+};
+
+struct B : virtual A {
+  virtual void c();
+};
+
+struct C { };
+
+struct D : virtual A, virtual C, B {};
+
+D obj;
+
+// Each MDC only has one vftable.
+
+// MANGLING-DAG: @"\01??_7D at pr19240@@6B@"
+// MANGLING-DAG: @"\01??_7A at pr19240@@6B@"
+// MANGLING-DAG: @"\01??_7B at pr19240@@6B@"
+
+}





More information about the cfe-commits mailing list