[cfe-commits] r120109 - in /cfe/trunk/lib/CodeGen: CGRecordLayoutBuilder.cpp CodeGenTypes.cpp

Anders Carlsson andersca at mac.com
Wed Nov 24 11:57:04 PST 2010


Author: andersca
Date: Wed Nov 24 13:57:04 2010
New Revision: 120109

URL: http://llvm.org/viewvc/llvm-project?rev=120109&view=rev
Log:
Simplify code.

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

Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=120109&r1=120108&r2=120109&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Wed Nov 24 13:57:04 2010
@@ -140,9 +140,6 @@
 
   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);
@@ -689,15 +686,6 @@
   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)
@@ -723,7 +711,7 @@
   if (!IsZeroInitializable)
     return;
 
-  const CGRecordLayout &Layout = getCGRecordLayout(RD);
+  const CGRecordLayout &Layout = Types.getCGRecordLayout(RD);
   if (!Layout.isZeroInitializable())
     IsZeroInitializable = false;
 }

Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=120109&r1=120108&r2=120109&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Wed Nov 24 13:57:04 2010
@@ -524,11 +524,5 @@
 }
 
 bool CodeGenTypes::isZeroInitializable(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.
-  ConvertTagDeclType(RD);
-  
-  const CGRecordLayout &Layout = getCGRecordLayout(RD);
-  return Layout.isZeroInitializable();
+  return getCGRecordLayout(RD).isZeroInitializable();
 }





More information about the cfe-commits mailing list