[cfe-commits] r119955 - /cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp

Anders Carlsson andersca at mac.com
Sun Nov 21 15:56:07 PST 2010


Author: andersca
Date: Sun Nov 21 17:56:06 2010
New Revision: 119955

URL: http://llvm.org/viewvc/llvm-project?rev=119955&view=rev
Log:
Add getCGRecordLayout helper function. No functionality change.

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

Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=119955&r1=119954&r2=119955&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Sun Nov 21 17:56:06 2010
@@ -140,6 +140,9 @@
 
   unsigned getTypeAlignment(const llvm::Type *Ty) const;
 
+  /// getCGRecordLayout - Return the CGRecordLayout for the given record.
+  const CGRecordLayout &getCGRecordLayout(const CXXRecordDecl *RD);
+
   /// CheckZeroInitializable - Check if the given type contains a pointer
   /// to data member.
   void CheckZeroInitializable(QualType T);
@@ -687,6 +690,15 @@
   return Types.getTargetData().getABITypeAlignment(Ty);
 }
 
+const CGRecordLayout &
+CGRecordLayoutBuilder::getCGRecordLayout(const CXXRecordDecl *RD) {
+  // FIXME: It would be better if there was a way to explicitly compute the
+  // record layout instead of converting to a type.
+  Types.ConvertTagDeclType(RD);
+
+  return Types.getCGRecordLayout(RD);
+}
+
 void CGRecordLayoutBuilder::CheckZeroInitializable(QualType T) {
   // This record already contains a member pointer.
   if (!IsZeroInitializable)
@@ -712,12 +724,7 @@
   if (!IsZeroInitializable)
     return;
 
-  // FIXME: It would be better if there was a way to explicitly compute the
-  // record layout instead of converting to a type.
-  Types.ConvertTagDeclType(RD);
-  
-  const CGRecordLayout &Layout = Types.getCGRecordLayout(RD);
-  
+  const CGRecordLayout &Layout = getCGRecordLayout(RD);
   if (!Layout.isZeroInitializable())
     IsZeroInitializable = false;
 }





More information about the cfe-commits mailing list