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

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


Author: andersca
Date: Wed May 26 00:04:25 2010
New Revision: 104672

URL: http://llvm.org/viewvc/llvm-project?rev=104672&view=rev
Log:
Fold the ASTRecordLayoutBuilder::ComputeLayout overload that takes an ObjCInterfaceDecl pointer into its only callsite.

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=104672&r1=104671&r2=104672&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Wed May 26 00:04:25 2010
@@ -639,8 +639,7 @@
 }
 
 // FIXME. Impl is no longer needed.
-void ASTRecordLayoutBuilder::Layout(const ObjCInterfaceDecl *D,
-                                    const ObjCImplementationDecl *Impl) {
+void ASTRecordLayoutBuilder::Layout(const ObjCInterfaceDecl *D) {
   if (ObjCInterfaceDecl *SD = D->getSuperClass()) {
     const ASTRecordLayout &SL = Context.getASTObjCInterfaceLayout(SD);
 
@@ -913,20 +912,6 @@
                                    Builder.Bases, Builder.VBases);
 }
 
-const ASTRecordLayout *
-ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx,
-                                      const ObjCInterfaceDecl *D,
-                                      const ObjCImplementationDecl *Impl) {
-  ASTRecordLayoutBuilder Builder(Ctx);
-
-  Builder.Layout(D, Impl);
-
-  return new (Ctx) ASTRecordLayout(Ctx, Builder.Size, Builder.Alignment,
-                                   Builder.DataSize,
-                                   Builder.FieldOffsets.data(),
-                                   Builder.FieldOffsets.size());
-}
-
 const CXXMethodDecl *
 ASTRecordLayoutBuilder::ComputeKeyFunction(const CXXRecordDecl *RD) {
   assert(RD->isDynamicClass() && "Class does not have any virtual methods!");
@@ -1035,8 +1020,15 @@
       return getObjCLayout(D, 0);
   }
 
+  ASTRecordLayoutBuilder Builder(*this);
+  Builder.Layout(D);
+
   const ASTRecordLayout *NewEntry =
-    ASTRecordLayoutBuilder::ComputeLayout(*this, D, Impl);
+    new (*this) ASTRecordLayout(*this, Builder.Size, Builder.Alignment,
+                                Builder.DataSize,
+                                Builder.FieldOffsets.data(),
+                                Builder.FieldOffsets.size());
+  
   ObjCLayouts[Key] = NewEntry;
 
   return *NewEntry;

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.h?rev=104672&r1=104671&r2=104672&view=diff
==============================================================================
--- cfe/trunk/lib/AST/RecordLayoutBuilder.h (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.h Wed May 26 00:04:25 2010
@@ -26,6 +26,9 @@
   class RecordDecl;
 
 class ASTRecordLayoutBuilder {
+  // FIXME: Remove this and make the appropriate fields public.
+  friend class ASTContext;
+  
   ASTContext &Context;
 
   /// Size - The current size of the record layout.
@@ -91,8 +94,7 @@
 
   void Layout(const RecordDecl *D);
   void Layout(const CXXRecordDecl *D);
-  void Layout(const ObjCInterfaceDecl *D,
-              const ObjCImplementationDecl *Impl);
+  void Layout(const ObjCInterfaceDecl *D);
 
   void LayoutFields(const RecordDecl *D);
   void LayoutField(const FieldDecl *D);
@@ -169,9 +171,6 @@
 public:
   static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
                                               const RecordDecl *RD);
-  static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
-                                              const ObjCInterfaceDecl *D,
-                                            const ObjCImplementationDecl *Impl);
   static const CXXMethodDecl *ComputeKeyFunction(const CXXRecordDecl *RD);
 };
 





More information about the cfe-commits mailing list