[cfe-commits] r147419 - in /cfe/trunk: 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
Douglas Gregor
dgregor at apple.com
Sun Jan 1 14:06:18 PST 2012
Author: dgregor
Date: Sun Jan 1 16:06:18 2012
New Revision: 147419
URL: http://llvm.org/viewvc/llvm-project?rev=147419&view=rev
Log:
Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. They are no longer needed
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/tools/libclang/IndexingContext.h
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Sun Jan 1 16:06:18 2012
@@ -1077,9 +1077,6 @@
DefinitionData *Data;
- bool InitiallyForwardDecl : 1;
- bool isForwardProtoDecl : 1; // declared with @protocol.
-
SourceLocation EndLoc; // marks the '>' or identifier.
DefinitionData &data() const {
@@ -1089,8 +1086,7 @@
ObjCProtocolDecl(DeclContext *DC, IdentifierInfo *Id,
SourceLocation nameLoc, SourceLocation atStartLoc,
- ObjCProtocolDecl *PrevDecl,
- bool isForwardDecl);
+ ObjCProtocolDecl *PrevDecl);
void allocateDefinitionData();
@@ -1104,8 +1100,7 @@
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 @@
/// \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; }
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Sun Jan 1 16:06:18 2012
@@ -3123,8 +3123,7 @@
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);
}
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Sun Jan 1 16:06:18 2012
@@ -970,12 +970,8 @@
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 @@
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;
}
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sun Jan 1 16:06:18 2012
@@ -583,8 +583,7 @@
// 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 @@
// 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 @@
ObjCProtocolDecl *PDecl
= ObjCProtocolDecl::Create(Context, CurContext, Ident,
IdentList[i].second, AtProtocolLoc,
- PrevDecl, /*isForwardDecl=*/true);
+ PrevDecl);
PushOnScopeChains(PDecl, TUScope);
CheckObjCDeclScope(PDecl);
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Sun Jan 1 16:06:18 2012
@@ -764,8 +764,6 @@
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 @@
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(),
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Sun Jan 1 16:06:18 2012
@@ -518,8 +518,6 @@
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();
Modified: cfe/trunk/tools/libclang/IndexingContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.h?rev=147419&r1=147418&r2=147419&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.h (original)
+++ cfe/trunk/tools/libclang/IndexingContext.h Sun Jan 1 16:06:18 2012
@@ -142,7 +142,7 @@
ObjCProtocolDeclInfo(const ObjCProtocolDecl *D)
: ObjCContainerDeclInfo(Info_ObjCProtocol,
/*isForwardRef=*/false,
- /*isRedeclaration=*/D->isInitiallyForwardDecl(),
+ /*isRedeclaration=*/D->getPreviousDeclaration(),
/*isImplementation=*/false) { }
static bool classof(const DeclInfo *D) {
More information about the cfe-commits
mailing list