[cfe-commits] r104683 - in /cfe/trunk/lib/AST: RecordLayoutBuilder.cpp RecordLayoutBuilder.h

Anders Carlsson andersca at mac.com
Tue May 25 22:31:23 PDT 2010


Author: andersca
Date: Wed May 26 00:31:23 2010
New Revision: 104683

URL: http://llvm.org/viewvc/llvm-project?rev=104683&view=rev
Log:
Fix thinko and remove another unused function.

Modified:
    cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
    cfe/trunk/lib/AST/RecordLayoutBuilder.h

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=104683&r1=104682&r2=104683&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed May 26 00:31:23 2010
@@ -244,7 +244,7 @@
       cast<CXXRecordDecl>(I->getType()->getAs<RecordType>()->getDecl());
 
     // Skip the primary base.
-    if (Base == PrimaryBase && PrimaryBaseIsVirtual)
+    if (Base == PrimaryBase && !PrimaryBaseIsVirtual)
       continue;
 
     // Lay out the base.
@@ -880,41 +880,6 @@
   Alignment = NewAlignment;
 }
 
-const ASTRecordLayout *
-ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx,
-                                      const RecordDecl *D) {
-  ASTRecordLayoutBuilder Builder(Ctx);
-
-  Builder.Layout(D);
-
-  if (!isa<CXXRecordDecl>(D))
-    return new (Ctx) ASTRecordLayout(Ctx, Builder.Size, Builder.Alignment,
-                                     Builder.Size,
-                                     Builder.FieldOffsets.data(),
-                                     Builder.FieldOffsets.size());
-
-  // FIXME: This is not always correct. See the part about bitfields at
-  // http://www.codesourcery.com/public/cxx-abi/abi.html#POD for more info.
-  // FIXME: IsPODForThePurposeOfLayout should be stored in the record layout.
-  bool IsPODForThePurposeOfLayout = cast<CXXRecordDecl>(D)->isPOD();
-
-  // FIXME: This should be done in FinalizeLayout.
-  uint64_t DataSize =
-    IsPODForThePurposeOfLayout ? Builder.Size : Builder.DataSize;
-  uint64_t NonVirtualSize =
-    IsPODForThePurposeOfLayout ? DataSize : Builder.NonVirtualSize;
-
-  return new (Ctx) ASTRecordLayout(Ctx, Builder.Size, Builder.Alignment,
-                                   DataSize, Builder.FieldOffsets.data(),
-                                   Builder.FieldOffsets.size(),
-                                   NonVirtualSize,
-                                   Builder.NonVirtualAlignment,
-                                   Builder.SizeOfLargestEmptySubobject,
-                                   Builder.PrimaryBase,
-                                   Builder.PrimaryBaseIsVirtual,
-                                   Builder.Bases, Builder.VBases);
-}
-
 const CXXMethodDecl *
 ASTRecordLayoutBuilder::ComputeKeyFunction(const CXXRecordDecl *RD) {
   assert(RD->isDynamicClass() && "Class does not have any virtual methods!");

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.h?rev=104683&r1=104682&r2=104683&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.h (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.h Wed May 26 00:31:23 2010
@@ -174,8 +174,6 @@
   ASTRecordLayoutBuilder(const ASTRecordLayoutBuilder&);   // DO NOT IMPLEMENT
   void operator=(const ASTRecordLayoutBuilder&); // DO NOT IMPLEMENT
 public:
-  static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
-                                              const RecordDecl *RD);
   static const CXXMethodDecl *ComputeKeyFunction(const CXXRecordDecl *RD);
 };
 





More information about the cfe-commits mailing list