summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-12 21:07:46 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-12 21:07:46 +0000
commitb97a4025fffa945bdf6cfb1d12f20930295156b3 (patch)
treefb27ef6f1f24d213fb23e4316e3826265ba2c1a6 /clang/lib/Sema/SemaDeclObjC.cpp
parent256ee1963dfc2524830e8faf26319c105c5728c0 (diff)
downloadbcm5719-llvm-b97a4025fffa945bdf6cfb1d12f20930295156b3.tar.gz
bcm5719-llvm-b97a4025fffa945bdf6cfb1d12f20930295156b3.zip
[PCH] When completing an objc forward reference, do not serialize the chain of its categories because
it is going to be rewritten (and the chain will be serialized again), otherwise we may form a cycle in its categories list when deserializing. Also introduce ASTMutationListener::CompletedObjCForwardRef to notify that a forward reference was completed; using Decl's isChangedSinceDeserialization/setChangedSinceDeserialization is bug inducing and kinda gross, we should phase it out. Fixes infinite loop in rdar://10418538. llvm-svn: 144465
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 1632e092e3b..3d1f5bd0640 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -377,18 +377,16 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
return ActOnObjCContainerStartDefinition(IDecl);
} else {
IDecl->setLocation(ClassLoc);
- IDecl->setForwardDecl(false);
IDecl->setAtStartLoc(AtInterfaceLoc);
- // If the forward decl was in a PCH, we need to write it again in a
- // dependent AST file.
- IDecl->setChangedSinceDeserialization(true);
// Since this ObjCInterfaceDecl was created by a forward declaration,
// we now add it to the DeclContext since it wasn't added before
// (see ActOnForwardClassDeclaration).
IDecl->setLexicalDeclContext(CurContext);
CurContext->addDecl(IDecl);
-
+
+ IDecl->completedForwardDecl();
+
if (AttrList)
ProcessDeclAttributeList(TUScope, IDecl, AttrList);
}
@@ -588,19 +586,16 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
// Make sure the cached decl gets a valid start location.
PDecl->setAtStartLoc(AtProtoInterfaceLoc);
PDecl->setLocation(ProtocolLoc);
- PDecl->setForwardDecl(false);
// Since this ObjCProtocolDecl was created by a forward declaration,
// we now add it to the DeclContext since it wasn't added before
PDecl->setLexicalDeclContext(CurContext);
CurContext->addDecl(PDecl);
- // Repeat in dependent AST files.
- PDecl->setChangedSinceDeserialization(true);
+ PDecl->completedForwardDecl();
} else {
PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
ProtocolLoc, AtProtoInterfaceLoc,
/*isForwardDecl=*/false);
PushOnScopeChains(PDecl, TUScope);
- PDecl->setForwardDecl(false);
}
if (AttrList)
ProcessDeclAttributeList(TUScope, PDecl, AttrList);
@@ -925,7 +920,8 @@ Decl *Sema::ActOnStartClassImplementation(
// Mark the interface as being completed, even if it was just as
// @class ....;
// declaration; the user cannot reopen it.
- IDecl->setForwardDecl(false);
+ if (IDecl->isForwardDecl())
+ IDecl->completedForwardDecl();
}
ObjCImplementationDecl* IMPDecl =
OpenPOWER on IntegriCloud