]> granicus.if.org Git - clang/commitdiff
Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. They are...
authorDouglas Gregor <dgregor@apple.com>
Sun, 1 Jan 2012 22:06:18 +0000 (22:06 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 1 Jan 2012 22:06:18 +0000 (22:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147419 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclObjC.h
lib/AST/ASTImporter.cpp
lib/AST/DeclObjC.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTWriterDecl.cpp
tools/libclang/IndexingContext.h

index 157544ff86cb7331529bc9749721760079930efe..5f6bdec1cff2c5f2f0b985aed0e316b851c36129 100644 (file)
@@ -1077,9 +1077,6 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
   
   DefinitionData *Data;
 
-  bool InitiallyForwardDecl : 1;
-  bool isForwardProtoDecl : 1; // declared with @protocol.
-
   SourceLocation EndLoc; // marks the '>' or identifier.
 
   DefinitionData &data() const {
@@ -1089,8 +1086,7 @@ class ObjCProtocolDecl : public ObjCContainerDecl,
   
   ObjCProtocolDecl(DeclContext *DC, IdentifierInfo *Id,
                    SourceLocation nameLoc, SourceLocation atStartLoc,
-                   ObjCProtocolDecl *PrevDecl,
-                   bool isForwardDecl);
+                   ObjCProtocolDecl *PrevDecl);
 
   void allocateDefinitionData();
 
@@ -1104,8 +1100,7 @@ public:
                                   IdentifierInfo *Id,
                                   SourceLocation nameLoc,
                                   SourceLocation atStartLoc,
-                                  ObjCProtocolDecl *PrevDecl,
-                                  bool isForwardDecl);
+                                  ObjCProtocolDecl *PrevDecl);
 
   const ObjCProtocolList &getReferencedProtocols() const {
     assert(hasDefinition() && "No definition available!");
@@ -1186,11 +1181,6 @@ public:
   /// \brief Starts the definition of this Objective-C protocol.
   void startDefinition();
 
-  /// \brief True if it was initially a forward reference.
-  /// Differs with \see isForwardDecl in that \see isForwardDecl will change to
-  /// false when we see the definition, but this will remain true.
-  bool isInitiallyForwardDecl() const { return InitiallyForwardDecl; }
-
   // Location information, modeled after the Stmt API.
   SourceLocation getLocStart() const { return getAtStartLoc(); } // '@'protocol
   SourceLocation getLocEnd() const { return EndLoc; }
index 6ee8ba3a5f3b40f6e5bf3efa25f569ea83771257..82307e8e98034b1d7e68d77df3ca505c5430a6d8 100644 (file)
@@ -3123,8 +3123,7 @@ Decl *ASTNodeImporter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
       ToProto = ObjCProtocolDecl::Create(Importer.getToContext(), DC,
                                          Name.getAsIdentifierInfo(), Loc,
                                          Importer.Import(D->getAtStartLoc()),
-                                         /*PrevDecl=*/0,
-                                         D->isInitiallyForwardDecl());
+                                         /*PrevDecl=*/0);
       ToProto->setLexicalDeclContext(LexicalDC);
       LexicalDC->addDeclInternal(ToProto);
     }
index aabea0434c9bf8b801ccb96d0aa26f2bdc315bc2..59bfdc6b6e027a4b0909fcdbec8e507234d3e0d2 100644 (file)
@@ -970,12 +970,8 @@ void ObjCProtocolDecl::anchor() { }
 ObjCProtocolDecl::ObjCProtocolDecl(DeclContext *DC, IdentifierInfo *Id,
                                    SourceLocation nameLoc, 
                                    SourceLocation atStartLoc,
-                                   ObjCProtocolDecl *PrevDecl,
-                                   bool isForwardDecl)
-  : ObjCContainerDecl(ObjCProtocol, DC, Id, nameLoc, atStartLoc),
-    Data(0),
-    InitiallyForwardDecl(isForwardDecl),
-    isForwardProtoDecl(isForwardDecl) 
+                                   ObjCProtocolDecl *PrevDecl)
+  : ObjCContainerDecl(ObjCProtocol, DC, Id, nameLoc, atStartLoc), Data()
 {
   setPreviousDeclaration(PrevDecl);
   if (PrevDecl)
@@ -986,11 +982,9 @@ ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC,
                                            IdentifierInfo *Id,
                                            SourceLocation nameLoc,
                                            SourceLocation atStartLoc,
-                                           ObjCProtocolDecl *PrevDecl,
-                                           bool isForwardDecl) {
+                                           ObjCProtocolDecl *PrevDecl) {
   ObjCProtocolDecl *Result 
-    = new (C) ObjCProtocolDecl(DC, Id, nameLoc, atStartLoc, PrevDecl,
-                               isForwardDecl);
+    = new (C) ObjCProtocolDecl(DC, Id, nameLoc, atStartLoc, PrevDecl);
   
   return Result;
 }
index 51d282a546c3e387cb23d86aef861de850dc324e..e76971188ff9f06236789cc2de573b9b608392ce 100644 (file)
@@ -583,8 +583,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
     // FIXME: Can we turn this into an error?
     PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
                                      ProtocolLoc, AtProtoInterfaceLoc,
-                                     /*PrevDecl=*/0,
-                                     /*isForwardDecl=*/false);
+                                     /*PrevDecl=*/0);
     PDecl->startDefinition();
   } else {
     if (PrevDecl) {
@@ -599,8 +598,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
     // Create the new declaration.
     PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
                                      ProtocolLoc, AtProtoInterfaceLoc,
-                                     /*PrevDecl=*/PrevDecl, 
-                                     /*isForwardDecl=*/false);
+                                     /*PrevDecl=*/PrevDecl);
     
     PushOnScopeChains(PDecl, TUScope);
     PDecl->startDefinition();
@@ -707,7 +705,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
     ObjCProtocolDecl *PDecl
       = ObjCProtocolDecl::Create(Context, CurContext, Ident, 
                                  IdentList[i].second, AtProtocolLoc,
-                                 PrevDecl, /*isForwardDecl=*/true);
+                                 PrevDecl);
         
     PushOnScopeChains(PDecl, TUScope);
     CheckObjCDeclScope(PDecl);
index 12436c5c4fe73bdb9ebc35357ae9ccb697a4b8d3..46dcc8757d90a5053bebc434fe60ecc1bdb4760e 100644 (file)
@@ -764,8 +764,6 @@ void ASTDeclReader::VisitObjCProtocolDecl(ObjCProtocolDecl *PD) {
   
   RedeclarableResult Redecl = VisitRedeclarable(PD);
   VisitObjCContainerDecl(PD);
-  PD->InitiallyForwardDecl = Record[Idx++];
-  PD->isForwardProtoDecl = Record[Idx++];
   PD->setLocEnd(ReadSourceLocation(Record, Idx));
   
   // Determine whether we need to merge this declaration with another @protocol
@@ -1976,7 +1974,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
     break;
   case DECL_OBJC_PROTOCOL:
     D = ObjCProtocolDecl::Create(Context, 0, 0, SourceLocation(),
-                                 SourceLocation(), 0, false);
+                                 SourceLocation(), 0);
     break;
   case DECL_OBJC_AT_DEFS_FIELD:
     D = ObjCAtDefsFieldDecl::Create(Context, 0, SourceLocation(),
index b0c54e391b5163bdbad67e52224dbf10ba050631..4701b8fc386ab8e190b29eb8ae3830973520d654 100644 (file)
@@ -518,8 +518,6 @@ void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
 void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
   VisitRedeclarable(D);
   VisitObjCContainerDecl(D);
-  Record.push_back(D->isInitiallyForwardDecl());
-  Record.push_back(D->isForwardProtoDecl);
   Writer.AddSourceLocation(D->getLocEnd(), Record);
   
   ObjCProtocolDecl *Def = D->getDefinition();
index 0091fd1f8cd2fd5c4c49dbc0b1ed91a6dd50b3ac..b58e3b690e850640914edb1d5654d0b977702ed2 100644 (file)
@@ -142,7 +142,7 @@ struct ObjCProtocolDeclInfo : public ObjCContainerDeclInfo {
   ObjCProtocolDeclInfo(const ObjCProtocolDecl *D)
     : ObjCContainerDeclInfo(Info_ObjCProtocol,
                             /*isForwardRef=*/false,
-                            /*isRedeclaration=*/D->isInitiallyForwardDecl(),
+                            /*isRedeclaration=*/D->getPreviousDeclaration(),
                             /*isImplementation=*/false) { }
 
   static bool classof(const DeclInfo *D) {