[cfe-commits] r42721 - /cfe/trunk/Sema/SemaDecl.cpp
Chris Lattner
sabre at nondot.org
Sun Oct 7 00:05:08 PDT 2007
Author: lattner
Date: Sun Oct 7 02:05:08 2007
New Revision: 42721
URL: http://llvm.org/viewvc/llvm-project?rev=42721&view=rev
Log:
The identifier shouldn't be added to the scope, the decl should.
This fixes strange assertions that just started triggering.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=42721&r1=42720&r2=42721&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Sun Oct 7 02:05:08 2007
@@ -1039,16 +1039,18 @@
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 @@
// 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);
}
More information about the cfe-commits
mailing list