[cfe-commits] r93696 - /cfe/trunk/lib/CodeGen/CGVtable.cpp

Anders Carlsson andersca at mac.com
Sun Jan 17 15:53:21 PST 2010


Author: andersca
Date: Sun Jan 17 17:53:20 2010
New Revision: 93696

URL: http://llvm.org/viewvc/llvm-project?rev=93696&view=rev
Log:
Minor VTT builder cleanup, no functionality change.

Modified:
    cfe/trunk/lib/CodeGen/CGVtable.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Sun Jan 17 17:53:20 2010
@@ -1266,6 +1266,9 @@
                                  const CXXRecordDecl *VtableClass,
                                  const CXXRecordDecl *RD,
                                  uint64_t Offset) {
+    if (!GenerateDefinition)
+      return 0;
+
     uint64_t AddressPoint;
     
     if (VtableClass != Class) {
@@ -1330,17 +1333,14 @@
         // FIXME: Slightly too many of these for __ZTT8test8_B2
         llvm::Constant *init;
         if (BaseMorallyVirtual)
-          init = GenerateDefinition ? 
-            BuildVtablePtr(vtbl, VtblClass, RD, Offset) : 0;
+          init = BuildVtablePtr(vtbl, VtblClass, RD, Offset);
         else {
-          init = GenerateDefinition ?
-            getCtorVtable(BaseSubobject(Base, BaseOffset)) : 0;
+          init = getCtorVtable(BaseSubobject(Base, BaseOffset));
           
           subvtbl = init;
           subVtblClass = Base;
           
-          init = GenerateDefinition ?
-          BuildVtablePtr(init, Class, Base, BaseOffset) : 0;
+          init = BuildVtablePtr(init, Class, Base, BaseOffset);
         }
         Inits.push_back(init);
       }
@@ -1359,16 +1359,14 @@
 
     // First comes the primary virtual table pointer...
     if (MorallyVirtual) {
-      Vtable = GenerateDefinition ? ClassVtbl : 0;
+      Vtable = ClassVtbl;
       VtableClass = Class;
     } else {
-      Vtable = GenerateDefinition ? 
-        getCtorVtable(BaseSubobject(RD, Offset)) : 0;
+      Vtable = getCtorVtable(BaseSubobject(RD, Offset));
       VtableClass = RD;
     }
     
-    llvm::Constant *Init = GenerateDefinition ?
-      BuildVtablePtr(Vtable, VtableClass, RD, Offset) : 0;
+    llvm::Constant *Init = BuildVtablePtr(Vtable, VtableClass, RD, Offset);
     Inits.push_back(Init);
 
     // then the secondary VTTs....
@@ -1428,9 +1426,9 @@
       GenerateDefinition(GenerateDefinition) {
     
     // First comes the primary virtual table pointer for the complete class...
-    ClassVtbl = CGM.getVtableInfo().getVtable(Class);
-    llvm::Constant *Init = GenerateDefinition ? 
-      BuildVtablePtr(ClassVtbl, Class, Class, 0) : 0;
+    ClassVtbl = GenerateDefinition ? CGM.getVtableInfo().getVtable(Class) : 0;
+
+    llvm::Constant *Init = BuildVtablePtr(ClassVtbl, Class, Class, 0);
     Inits.push_back(Init);
     
     // then the secondary VTTs...





More information about the cfe-commits mailing list