]> granicus.if.org Git - clang/commitdiff
Fold the ASTRecordLayoutBuilder::ComputeLayout overload that takes an ObjCInterfaceDe...
authorAnders Carlsson <andersca@mac.com>
Wed, 26 May 2010 05:04:25 +0000 (05:04 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 26 May 2010 05:04:25 +0000 (05:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104672 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayoutBuilder.cpp
lib/AST/RecordLayoutBuilder.h

index 5463f61f2c59f5c0cc49826bf3af7cf24275421d..a255ff41ae3547decea7b9979914ccafe9912fea 100644 (file)
@@ -639,8 +639,7 @@ void ASTRecordLayoutBuilder::Layout(const RecordDecl *D) {
 }
 
 // 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 @@ ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx,
                                    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 @@ ASTContext::getObjCLayout(const ObjCInterfaceDecl *D,
       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;
index 5d4a74731a0057b81d1b7029a73652cdda95264c..c3a48f7ee76d7dfea76abd1fd4a3e9ce97fcd4f1 100644 (file)
@@ -26,6 +26,9 @@ namespace clang {
   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 @@ class ASTRecordLayoutBuilder {
 
   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 @@ class ASTRecordLayoutBuilder {
 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);
 };