[cfe-commits] r70780 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/RecordLayout.h lib/AST/ASTContext.cpp

Daniel Dunbar daniel at zuster.org
Sun May 3 07:27:59 PDT 2009


Author: ddunbar
Date: Sun May  3 09:27:48 2009
New Revision: 70780

URL: http://llvm.org/viewvc/llvm-project?rev=70780&view=rev
Log:
Remove ASTContext::addRecordToClass.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/include/clang/AST/RecordLayout.h
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=70780&r1=70779&r2=70780&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Sun May  3 09:27:48 2009
@@ -97,10 +97,6 @@
 
   llvm::DenseMap<unsigned, FixedWidthIntType*> SignedFixedWidthIntTypes;
   llvm::DenseMap<unsigned, FixedWidthIntType*> UnsignedFixedWidthIntTypes;
-
-  // FIXME: ASTRecordForInterface/ASTFieldForIvarRef and addRecordToClass and
-  // getFieldDecl be part of the backend (i.e. CodeGenTypes)?
-  llvm::DenseMap<const ObjCInterfaceDecl*, RecordDecl*> ASTRecordForInterface;
   
   /// BuiltinVaListType - built-in va list type.
   /// This is initially null and set by Sema::LazilyCreateBuiltin when
@@ -539,7 +535,6 @@
   const ASTRecordLayout &
   getASTObjCImplementationLayout(const ObjCImplementationDecl *D);
 
-  const RecordDecl *addRecordToClass(const ObjCInterfaceDecl *D);
   void CollectObjCIvars(const ObjCInterfaceDecl *OI,
                         llvm::SmallVectorImpl<FieldDecl*> &Fields);
 

Modified: cfe/trunk/include/clang/AST/RecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecordLayout.h?rev=70780&r1=70779&r2=70780&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/RecordLayout.h (original)
+++ cfe/trunk/include/clang/AST/RecordLayout.h Sun May  3 09:27:48 2009
@@ -24,7 +24,7 @@
 /// This class contains layout information for one RecordDecl,
 /// which is a struct/union/class.  The decl represented must be a definition,
 /// not a forward declaration.  
-/// This class is also used to contain layout informaiton for one 
+/// This class is also used to contain layout information for one 
 /// ObjCInterfaceDecl. FIXME - Find appropriate name.
 /// These objects are managed by ASTContext.
 class ASTRecordLayout {

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=70780&r1=70779&r2=70780&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun May  3 09:27:48 2009
@@ -71,15 +71,6 @@
     }
   }
 
-  {
-    llvm::DenseMap<const ObjCInterfaceDecl*, RecordDecl*>::iterator
-      I = ASTRecordForInterface.begin(), E = ASTRecordForInterface.end();
-    while (I != E) {
-      RecordDecl *R = (I++)->second;
-      R->Destroy(*this);
-    }
-  }
-
   // Destroy nested-name-specifiers.
   for (llvm::FoldingSet<NestedNameSpecifier>::iterator
          NNS = NestedNameSpecifiers.begin(),
@@ -676,7 +667,10 @@
     if (!IVDecl->isInvalidDecl())
       Fields.push_back(cast<FieldDecl>(IVDecl));
   }
-  // look into properties.
+  // Look into properties.
+  //
+  // FIXME: This needs to go away, synthesized ivars shouldn't be
+  // accessible from the interface decl.
   for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(*Ctx),
        E = OI->prop_end(*Ctx); I != E; ++I) {
     if (ObjCIvarDecl *IV = (*I)->getPropertyIvarDecl())
@@ -691,51 +685,6 @@
   CollectLocalObjCIvars(this, OI, Fields);
 }
 
-/// addRecordToClass - produces record info. for the class for its
-/// ivars and all those inherited.
-///
-const RecordDecl *ASTContext::addRecordToClass(const ObjCInterfaceDecl *D) {
-  assert(!D->isForwardDecl() && "Invalid decl!");
-
-  RecordDecl *&RD = ASTRecordForInterface[D];
-  if (RD)
-    return RD;
-  
-  llvm::SmallVector<FieldDecl*, 32> RecFields;
-  CollectLocalObjCIvars(this, D, RecFields);
-  
-  RD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, D->getLocation(),
-                          D->getIdentifier());
-  const RecordDecl *SRD;
-  if (const ObjCInterfaceDecl *SuperClass = D->getSuperClass()) {
-    SRD = addRecordToClass(SuperClass);
-  } else {
-    SRD = RecordDecl::Create(*this, TagDecl::TK_struct, 0, SourceLocation(), 0);
-    const_cast<RecordDecl*>(SRD)->completeDefinition(*this);
-  }
-
-  RD->addDecl(*this, 
-              FieldDecl::Create(*this, RD,
-                                SourceLocation(),
-                                0,
-                                getTagDeclType(const_cast<RecordDecl*>(SRD)),
-                                0, false));
-
-  /// FIXME! Can do collection of ivars and adding to the record while
-  /// doing it.
-  for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
-    RD->addDecl(*this,
-                FieldDecl::Create(*this, RD, 
-                                  RecFields[i]->getLocation(), 
-                                  RecFields[i]->getIdentifier(),
-                                  RecFields[i]->getType(), 
-                                  RecFields[i]->getBitWidth(), false));
-  }
-  
-  RD->completeDefinition(*this);
-  return RD;
-}
-
 /// getInterfaceLayoutImpl - Get or compute information about the
 /// layout of the given interface.
 ///





More information about the cfe-commits mailing list