[cfe-commits] r95963 - in /cfe/trunk: lib/CodeGen/CGVtable.cpp test/CodeGenCXX/vtable-layout.cpp

Anders Carlsson andersca at mac.com
Thu Feb 11 18:38:14 PST 2010


Author: andersca
Date: Thu Feb 11 20:38:13 2010
New Revision: 95963

URL: http://llvm.org/viewvc/llvm-project?rev=95963&view=rev
Log:
When dumping vtables, dump whether a virtual member function is pure or not.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp
    cfe/trunk/test/CodeGenCXX/vtable-layout.cpp

Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=95963&r1=95962&r2=95963&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Feb 11 20:38:13 2010
@@ -500,7 +500,6 @@
 
   /// dumpLayout - Dump the vtable layout.
   void dumpLayout(llvm::raw_ostream&);
-  
 };
 
 void VtableBuilder::layoutSimpleVtable(const CXXRecordDecl *RD) {
@@ -593,6 +592,9 @@
         PredefinedExpr::ComputeName(PredefinedExpr::PrettyFunctionNoVirtual, 
                                     MD);
       Out << Str;
+      if (MD->isPure())
+        Out << " [pure]";
+
       break;
     }
 
@@ -600,6 +602,9 @@
       const CXXDestructorDecl *DD = Component.getDestructorDecl();
       
       Out << DD->getQualifiedNameAsString() << "() [complete]";
+      if (DD->isPure())
+        Out << " [pure]";
+
       break;
     }
 
@@ -607,6 +612,9 @@
       const CXXDestructorDecl *DD = Component.getDestructorDecl();
       
       Out << DD->getQualifiedNameAsString() << "() [deleting]";
+      if (DD->isPure())
+        Out << " [pure]";
+
       break;
     }
 

Modified: cfe/trunk/test/CodeGenCXX/vtable-layout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-layout.cpp?rev=95963&r1=95962&r2=95963&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/vtable-layout.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-layout.cpp Thu Feb 11 20:38:13 2010
@@ -39,4 +39,22 @@
 
 void A::f() { }
 
+// Another simple vtable dumper test.
+// CHECK:     Vtable for 'Test2::B' (6 entries).
+// CHECK-NEXT:  0 | offset_to_top (0)
+// CHECK-NEXT:  1 | Test2::B RTTI
+// CHECK-NEXT:    -- (Test2::B, 0) vtable address --
+// CHECK-NEXT:  2 | void Test2::B::f()
+// CHECK-NEXT:  3 | void Test2::B::g() [pure]
+// CHECK-NEXT:  4 | Test2::B::~B() [complete] [pure]
+// CHECK-NEXT:  5 | Test2::B::~B() [deleting] [pure]
+
+struct B {
+  virtual void f();
+  virtual void g() = 0;
+  virtual ~B() = 0;
+};
+
+void B::f() { }
+
 }





More information about the cfe-commits mailing list