diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-10-07 07:05:08 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-10-07 07:05:08 +0000 |
| commit | 65cc87ffc26d955c5a5238cc4221095f3d1940d4 (patch) | |
| tree | 69da3df8ffd74b9e98de23983bf290be7c51fc31 | |
| parent | 65fc0f1fca30e256a8e67c5cf0a24fbb73befb2a (diff) | |
| download | bcm5719-llvm-65cc87ffc26d955c5a5238cc4221095f3d1940d4.tar.gz bcm5719-llvm-65cc87ffc26d955c5a5238cc4221095f3d1940d4.zip | |
The identifier shouldn't be added to the scope, the decl should.
This fixes strange assertions that just started triggering.
llvm-svn: 42721
| -rw-r--r-- | clang/Sema/SemaDecl.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp index 94230a79ee8..d870ab4d21a 100644 --- a/clang/Sema/SemaDecl.cpp +++ b/clang/Sema/SemaDecl.cpp @@ -1039,16 +1039,18 @@ Sema::ActOnForwardProtocolDeclaration(Scope *S, SourceLocation AtProtocolLoc, llvm::SmallVector<ObjcProtocolDecl*, 32> Protocols; for (unsigned i = 0; i != NumElts; ++i) { - ObjcProtocolDecl *PDecl = getObjCProtocolDecl(S, IdentList[i], - AtProtocolLoc); - if (!PDecl) { // Already seen? - PDecl = new ObjcProtocolDecl(SourceLocation(), 0, IdentList[i], true); + IdentifierInfo *P = IdentList[i]; + ObjcProtocolDecl *PDecl = getObjCProtocolDecl(S, P, AtProtocolLoc); + if (!PDecl) { // Not already seen? + // FIXME: Pass in the location of the identifier! + PDecl = new ObjcProtocolDecl(AtProtocolLoc, 0, P, true); // Chain & install the protocol decl into the identifier. PDecl->setNext(IdentList[i]->getFETokenInfo<ScopedDecl>()); IdentList[i]->setFETokenInfo(PDecl); + + // Remember that this needs to be removed when the scope is popped. + S->AddDecl(PDecl); } - // Remember that this needs to be removed when the scope is popped. - S->AddDecl(IdentList[i]); Protocols.push_back(PDecl); } @@ -1364,9 +1366,10 @@ Sema::ActOnForwardClassDeclaration(Scope *S, SourceLocation AtClassLoc, // Chain & install the interface decl into the identifier. IDecl->setNext(IdentList[i]->getFETokenInfo<ScopedDecl>()); IdentList[i]->setFETokenInfo(IDecl); + + // Remember that this needs to be removed when the scope is popped. + S->AddDecl(IDecl); } - // Remember that this needs to be removed when the scope is popped. - S->AddDecl(IdentList[i]); Interfaces.push_back(IDecl); } |

