[cfe-commits] r53883 - in /cfe/trunk: include/clang/Basic/IdentifierTable.h include/clang/Parse/Action.h include/clang/Parse/Parser.h lib/Parse/MinimalAction.cpp lib/Parse/ParseDecl.cpp lib/Parse/ParseObjc.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclObjC.cpp
Chris Lattner
sabre at nondot.org
Mon Jul 21 15:17:28 PDT 2008
Author: lattner
Date: Mon Jul 21 17:17:28 2008
New Revision: 53883
URL: http://llvm.org/viewvc/llvm-project?rev=53883&view=rev
Log:
minor cleanup to the actions interface to pass around SmallVectorImpl instead
of a specific smallvector size.
Fix protocol lists to pass down proper location info, so we get diagnostics
like this:
t.m:3:35: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^
instead of this:
t.m:3:44: error: cannot find protocol definition for 'NSCopying', referenced by 'NSWhatever'
@interface NSWhatever : NSObject <NSCopying>
^
Add a new IdentifierLocPair typedef which is just a pair<IdentifierInfo*, SourceLocation>
Modified:
cfe/trunk/include/clang/Basic/IdentifierTable.h
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/MinimalAction.cpp
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Basic/IdentifierTable.h Mon Jul 21 17:17:28 2008
@@ -29,6 +29,12 @@
namespace clang {
struct LangOptions;
class MultiKeywordSelector; // a private class used by Selector.
+ class IdentifierInfo;
+ class SourceLocation;
+
+ /// IdentifierLocPair - A simple pair of identifier info and location.
+ typedef std::pair<IdentifierInfo*, SourceLocation> IdentifierLocPair;
+
/// IdentifierInfo - One of these records is kept for each identifier that
/// is lexed. This contains information about whether the token was #define'd,
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Mon Jul 21 17:17:28 2008
@@ -207,7 +207,7 @@
/// name of the referenced class.
virtual void ActOnDefs(Scope *S, SourceLocation DeclStart,
IdentifierInfo *ClassName,
- llvm::SmallVector<DeclTy*, 16> &Decls) {}
+ llvm::SmallVectorImpl<DeclTy*> &Decls) {}
virtual DeclTy *ActOnField(Scope *S, SourceLocation DeclStart,
Declarator &D, ExprTy *BitfieldWidth) {
return 0;
@@ -627,7 +627,7 @@
SourceLocation ClassLoc,
IdentifierInfo *SuperName,
SourceLocation SuperLoc,
- IdentifierInfo **ProtocolNames,
+ const IdentifierLocPair *ProtocolNames,
unsigned NumProtocols,
SourceLocation EndProtoLoc,
AttributeList *AttrList) {
@@ -649,7 +649,7 @@
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName,
SourceLocation ProtocolLoc,
- IdentifierInfo **ProtoRefNames,
+ const IdentifierLocPair *ProtoRefNames,
unsigned NumProtoRefs,
SourceLocation EndProtoLoc) {
return 0;
@@ -662,7 +662,7 @@
SourceLocation ClassLoc,
IdentifierInfo *CategoryName,
SourceLocation CategoryLoc,
- IdentifierInfo **ProtoRefNames,
+ const IdentifierLocPair *ProtoRefNames,
unsigned NumProtoRefs,
SourceLocation EndProtoLoc) {
return 0;
@@ -768,7 +768,7 @@
}
virtual DeclTy *ActOnForwardProtocolDeclaration(
SourceLocation AtProtocolLoc,
- IdentifierInfo **IdentList,
+ const IdentifierLocPair*IdentList,
unsigned NumElts) {
return 0;
}
@@ -777,10 +777,9 @@
/// issues error if they are not declared. It returns list of valid
/// protocols found.
virtual void FindProtocolDeclaration(SourceLocation TypeLoc,
- IdentifierInfo **ProtocolId,
+ const IdentifierLocPair *ProtocolId,
unsigned NumProtocols,
- llvm::SmallVector<DeclTy *, 8> &
- Protocols) {
+ llvm::SmallVectorImpl<DeclTy*> &Protocols) {
}
//===----------------------- Obj-C Expressions --------------------------===//
@@ -852,7 +851,8 @@
virtual DeclTy *ActOnStartClassInterface(SourceLocation interLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
- IdentifierInfo **ProtocolNames, unsigned NumProtocols,
+ const IdentifierLocPair *ProtocolNames,
+ unsigned NumProtocols,
SourceLocation EndProtoLoc, AttributeList *AttrList);
};
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Mon Jul 21 17:17:28 2008
@@ -325,7 +325,7 @@
AttributeList *prefixAttrs = 0);
void ParseObjCClassInstanceVariables(DeclTy *interfaceDecl,
SourceLocation atLoc);
- bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<IdentifierInfo*> &,
+ bool ParseObjCProtocolReferences(llvm::SmallVectorImpl<IdentifierLocPair> &,
SourceLocation &endProtoLoc);
void ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
tok::ObjCKeywordKind contextKey);
Modified: cfe/trunk/lib/Parse/MinimalAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/MinimalAction.cpp?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/MinimalAction.cpp (original)
+++ cfe/trunk/lib/Parse/MinimalAction.cpp Mon Jul 21 17:17:28 2008
@@ -91,7 +91,8 @@
MinimalAction::ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
- IdentifierInfo **ProtocolNames, unsigned NumProtocols,
+ const IdentifierLocPair *ProtocolNames,
+ unsigned NumProtocols,
SourceLocation EndProtoLoc, AttributeList *AttrList) {
TypeNameInfo *TI =
new TypeNameInfo(1, ClassName->getFETokenInfo<TypeNameInfo>());
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Jul 21 17:17:28 2008
@@ -413,8 +413,11 @@
ConsumeToken(); // The identifier
if (Tok.is(tok::less)) {
SourceLocation endProtoLoc;
- llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
+ llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc);
+
+ // FIXME: New'ing this here seems wrong, why not have the action do
+ // it?
llvm::SmallVector<DeclTy *, 8> *ProtocolDecl =
new llvm::SmallVector<DeclTy *, 8>;
DS.setProtocolQualifiers(ProtocolDecl);
@@ -553,7 +556,7 @@
case tok::less:
if (!DS.hasTypeSpecifier()) {
SourceLocation endProtoLoc;
- llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
+ llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc);
llvm::SmallVector<DeclTy *, 8> *ProtocolDecl =
new llvm::SmallVector<DeclTy *, 8>;
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Jul 21 17:17:28 2008
@@ -131,7 +131,7 @@
SourceLocation lparenLoc = ConsumeParen();
SourceLocation categoryLoc, rparenLoc;
IdentifierInfo *categoryId = 0;
- llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
+ llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
// For ObjC2, the category name is optional (not an error).
if (Tok.is(tok::identifier)) {
@@ -185,7 +185,7 @@
superClassLoc = ConsumeToken();
}
// Next, we need to check for any protocol references.
- llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
+ llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
SourceLocation endProtoLoc;
if (Tok.is(tok::less)) {
if (ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc))
@@ -337,7 +337,7 @@
/// copy
/// nonatomic
///
-void Parser::ParseObjCPropertyAttribute (ObjCDeclSpec &DS) {
+void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS) {
SourceLocation loc = ConsumeParen(); // consume '('
while (isObjCPropertyAttribute()) {
const IdentifierInfo *II = Tok.getIdentifierInfo();
@@ -715,8 +715,9 @@
/// objc-protocol-refs:
/// '<' identifier-list '>'
///
-bool Parser::ParseObjCProtocolReferences(
- llvm::SmallVectorImpl<IdentifierInfo*> &ProtocolRefs, SourceLocation &endLoc){
+bool Parser::
+ParseObjCProtocolReferences(llvm::SmallVectorImpl<IdentifierLocPair> &Protocols,
+ SourceLocation &endLoc) {
assert(Tok.is(tok::less) && "expected <");
ConsumeToken(); // the "<"
@@ -727,7 +728,8 @@
SkipUntil(tok::greater);
return true;
}
- ProtocolRefs.push_back(Tok.getIdentifierInfo());
+ Protocols.push_back(std::make_pair(Tok.getIdentifierInfo(),
+ Tok.getLocation()));
ConsumeToken();
if (Tok.isNot(tok::comma))
@@ -865,15 +867,17 @@
IdentifierInfo *protocolName = Tok.getIdentifierInfo();
SourceLocation nameLoc = ConsumeToken();
- llvm::SmallVector<IdentifierInfo *, 8> ProtocolRefs;
if (Tok.is(tok::semi)) { // forward declaration of one protocol.
+ IdentifierLocPair ProtoInfo(protocolName, nameLoc);
ConsumeToken();
- ProtocolRefs.push_back(protocolName);
+ return Actions.ActOnForwardProtocolDeclaration(AtLoc, &ProtoInfo, 1);
}
+
if (Tok.is(tok::comma)) { // list of forward declarations.
+ llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
+ ProtocolRefs.push_back(std::make_pair(protocolName, nameLoc));
+
// Parse the list of forward declarations.
- ProtocolRefs.push_back(protocolName);
-
while (1) {
ConsumeToken(); // the ','
if (Tok.isNot(tok::identifier)) {
@@ -881,7 +885,8 @@
SkipUntil(tok::semi);
return 0;
}
- ProtocolRefs.push_back(Tok.getIdentifierInfo());
+ ProtocolRefs.push_back(IdentifierLocPair(Tok.getIdentifierInfo(),
+ Tok.getLocation()));
ConsumeToken(); // the identifier
if (Tok.isNot(tok::comma))
@@ -890,17 +895,19 @@
// Consume the ';'.
if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@protocol"))
return 0;
- }
- if (!ProtocolRefs.empty())
+
return Actions.ActOnForwardProtocolDeclaration(AtLoc,
&ProtocolRefs[0],
ProtocolRefs.size());
+ }
+
// Last, and definitely not least, parse a protocol declaration.
SourceLocation endProtoLoc;
- if (Tok.is(tok::less)) {
- if (ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc))
- return 0;
- }
+ llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
+
+ if (Tok.is(tok::less) &&
+ ParseObjCProtocolReferences(ProtocolRefs, endProtoLoc))
+ return 0;
DeclTy *ProtoType = Actions.ActOnStartProtocolInterface(AtLoc,
protocolName, nameLoc,
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Mon Jul 21 17:17:28 2008
@@ -241,7 +241,7 @@
SourceLocation KWLoc, IdentifierInfo *Name,
SourceLocation NameLoc, AttributeList *Attr);
virtual void ActOnDefs(Scope *S, SourceLocation DeclStart, IdentifierInfo
- *ClassName, llvm::SmallVector<DeclTy*, 16> &Decls);
+ *ClassName, llvm::SmallVectorImpl<DeclTy*> &Decls);
virtual DeclTy *ActOnField(Scope *S, SourceLocation DeclStart,
Declarator &D, ExprTy *BitfieldWidth);
@@ -615,7 +615,8 @@
SourceLocation AtInterafceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *SuperName, SourceLocation SuperLoc,
- IdentifierInfo **ProtocolNames, unsigned NumProtocols,
+ const IdentifierLocPair *ProtocolNames,
+ unsigned NumProtocols,
SourceLocation EndProtoLoc, AttributeList *AttrList);
virtual DeclTy *ActOnCompatiblityAlias(
@@ -626,14 +627,16 @@
virtual DeclTy *ActOnStartProtocolInterface(
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
- IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs,
+ const IdentifierLocPair *ProtoRefNames,
+ unsigned NumProtoRefs,
SourceLocation EndProtoLoc);
virtual DeclTy *ActOnStartCategoryInterface(
SourceLocation AtInterfaceLoc,
IdentifierInfo *ClassName, SourceLocation ClassLoc,
IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
- IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs,
+ const IdentifierLocPair *ProtoRefNames,
+ unsigned NumProtoRefs,
SourceLocation EndProtoLoc);
virtual DeclTy *ActOnStartClassImplementation(
@@ -654,14 +657,13 @@
unsigned NumElts);
virtual DeclTy *ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
- IdentifierInfo **IdentList,
+ const IdentifierLocPair *IdentList,
unsigned NumElts);
virtual void FindProtocolDeclaration(SourceLocation TypeLoc,
- IdentifierInfo **ProtocolId,
+ const IdentifierLocPair *ProtocolId,
unsigned NumProtocols,
- llvm::SmallVector<DeclTy *, 8> &
- Protocols);
+ llvm::SmallVectorImpl<DeclTy *> &Protocols);
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property,
ObjCPropertyDecl *SuperProperty,
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jul 21 17:17:28 2008
@@ -1789,7 +1789,7 @@
/// Collect the instance variables declared in an Objective-C object. Used in
/// the creation of structures from objects using the @defs directive.
static void CollectIvars(ObjCInterfaceDecl *Class,
- llvm::SmallVector<Sema::DeclTy*, 16> &ivars) {
+ llvm::SmallVectorImpl<Sema::DeclTy*> &ivars) {
if (Class->getSuperClass())
CollectIvars(Class->getSuperClass(), ivars);
ivars.append(Class->ivar_begin(), Class->ivar_end());
@@ -1799,7 +1799,7 @@
/// instance variables of ClassName into Decls.
void Sema::ActOnDefs(Scope *S, SourceLocation DeclStart,
IdentifierInfo *ClassName,
- llvm::SmallVector<DeclTy*, 16> &Decls) {
+ llvm::SmallVectorImpl<DeclTy*> &Decls) {
// Check that ClassName is a valid class
ObjCInterfaceDecl *Class = getObjCInterfaceDecl(ClassName);
if (!Class) {
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=53883&r1=53882&r2=53883&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Jul 21 17:17:28 2008
@@ -68,12 +68,13 @@
}
}
-Sema::DeclTy *Sema::ActOnStartClassInterface(
- SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName, SourceLocation ClassLoc,
- IdentifierInfo *SuperName, SourceLocation SuperLoc,
- IdentifierInfo **ProtocolNames, unsigned NumProtocols,
- SourceLocation EndProtoLoc, AttributeList *AttrList) {
+Sema::DeclTy *Sema::
+ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
+ IdentifierInfo *ClassName, SourceLocation ClassLoc,
+ IdentifierInfo *SuperName, SourceLocation SuperLoc,
+ const IdentifierLocPair *ProtocolNames,
+ unsigned NumProtocols,
+ SourceLocation EndProtoLoc, AttributeList *AttrList) {
assert(ClassName && "Missing class identifier");
// Check for another declaration kind with the same name.
@@ -133,14 +134,14 @@
if (NumProtocols) {
llvm::SmallVector<ObjCProtocolDecl*, 8> RefProtos;
for (unsigned int i = 0; i != NumProtocols; i++) {
- ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtocolNames[i]];
+ ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtocolNames[i].first];
if (!RefPDecl)
- Diag(EndProtoLoc, diag::err_undef_protocolref,
- ProtocolNames[i]->getName(), ClassName->getName());
+ Diag(ProtocolNames[i].second, diag::err_undef_protocolref,
+ ProtocolNames[i].first->getName(), ClassName->getName());
else {
if (RefPDecl->isForwardDecl())
- Diag(EndProtoLoc, diag::warn_undef_protocolref,
- ProtocolNames[i]->getName(), ClassName->getName());
+ Diag(ProtocolNames[i].second, diag::warn_undef_protocolref,
+ ProtocolNames[i].first->getName(), ClassName->getName());
RefProtos.push_back(RefPDecl);
}
}
@@ -194,7 +195,7 @@
Sema::DeclTy *Sema::ActOnStartProtocolInterface(
SourceLocation AtProtoInterfaceLoc,
IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc,
- IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs,
+ const IdentifierLocPair *ProtoRefNames, unsigned NumProtoRefs,
SourceLocation EndProtoLoc) {
assert(ProtocolName && "Missing protocol identifier");
ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolName];
@@ -219,14 +220,14 @@
/// Check then save referenced protocols.
llvm::SmallVector<ObjCProtocolDecl*, 8> Protocols;
for (unsigned int i = 0; i != NumProtoRefs; i++) {
- ObjCProtocolDecl *RefPDecl = ObjCProtocols[ProtoRefNames[i]];
+ ObjCProtocolDecl *RefPDecl = ObjCProtocols[ProtoRefNames[i].first];
if (!RefPDecl)
- Diag(ProtocolLoc, diag::err_undef_protocolref,
- ProtoRefNames[i]->getName(), ProtocolName->getName());
+ Diag(ProtoRefNames[i].second, diag::err_undef_protocolref,
+ ProtoRefNames[i].first->getName(), ProtocolName->getName());
else {
if (RefPDecl->isForwardDecl())
- Diag(ProtocolLoc, diag::warn_undef_protocolref,
- ProtoRefNames[i]->getName(), ProtocolName->getName());
+ Diag(ProtoRefNames[i].second, diag::warn_undef_protocolref,
+ ProtoRefNames[i].first->getName(), ProtocolName->getName());
Protocols.push_back(RefPDecl);
}
}
@@ -242,16 +243,15 @@
/// declarations in its 'Protocols' argument.
void
Sema::FindProtocolDeclaration(SourceLocation TypeLoc,
- IdentifierInfo **ProtocolId,
+ const IdentifierLocPair *ProtocolId,
unsigned NumProtocols,
- llvm::SmallVector<DeclTy *,8> &Protocols) {
+ llvm::SmallVectorImpl<DeclTy*> &Protocols) {
for (unsigned i = 0; i != NumProtocols; ++i) {
- ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolId[i]];
- if (!PDecl)
- Diag(TypeLoc, diag::err_undeclared_protocol,
- ProtocolId[i]->getName());
- else
+ if (ObjCProtocolDecl *PDecl = ObjCProtocols[ProtocolId[i].first])
Protocols.push_back(PDecl);
+ else
+ Diag(ProtocolId[i].second, diag::err_undeclared_protocol,
+ ProtocolId[i].first->getName());
}
}
@@ -382,16 +382,15 @@
/// ActOnForwardProtocolDeclaration -
Action::DeclTy *
Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
- IdentifierInfo **IdentList, unsigned NumElts) {
+ const IdentifierLocPair *IdentList,
+ unsigned NumElts) {
llvm::SmallVector<ObjCProtocolDecl*, 32> Protocols;
for (unsigned i = 0; i != NumElts; ++i) {
- IdentifierInfo *Ident = IdentList[i];
+ IdentifierInfo *Ident = IdentList[i].first;
ObjCProtocolDecl *&PDecl = ObjCProtocols[Ident];
- if (PDecl == 0) { // Not already seen?
- // FIXME: Pass in the location of the identifier!
- PDecl = ObjCProtocolDecl::Create(Context, AtProtocolLoc, Ident);
- }
+ if (PDecl == 0) // Not already seen?
+ PDecl = ObjCProtocolDecl::Create(Context, IdentList[i].second, Ident);
Protocols.push_back(PDecl);
}
@@ -399,12 +398,14 @@
&Protocols[0], Protocols.size());
}
-Sema::DeclTy *Sema::ActOnStartCategoryInterface(
- SourceLocation AtInterfaceLoc,
- IdentifierInfo *ClassName, SourceLocation ClassLoc,
- IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
- IdentifierInfo **ProtoRefNames, unsigned NumProtoRefs,
- SourceLocation EndProtoLoc) {
+Sema::DeclTy *Sema::
+ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
+ IdentifierInfo *ClassName, SourceLocation ClassLoc,
+ IdentifierInfo *CategoryName,
+ SourceLocation CategoryLoc,
+ const IdentifierLocPair *ProtoRefNames,
+ unsigned NumProtoRefs,
+ SourceLocation EndProtoLoc) {
ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName);
ObjCCategoryDecl *CDecl =
@@ -433,14 +434,14 @@
llvm::SmallVector<ObjCProtocolDecl*, 32> RefProtocols;
/// Check and then save the referenced protocols.
for (unsigned int i = 0; i != NumProtoRefs; i++) {
- ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i]];
+ ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i].first];
if (!RefPDecl)
- Diag(CategoryLoc, diag::err_undef_protocolref,
- ProtoRefNames[i]->getName(), CategoryName->getName());
+ Diag(ProtoRefNames[i].second, diag::err_undef_protocolref,
+ ProtoRefNames[i].first->getName(), CategoryName->getName());
else {
if (RefPDecl->isForwardDecl())
- Diag(CategoryLoc, diag::warn_undef_protocolref,
- ProtoRefNames[i]->getName(), CategoryName->getName());
+ Diag(ProtoRefNames[i].second, diag::warn_undef_protocolref,
+ ProtoRefNames[i].first->getName(), CategoryName->getName());
RefProtocols.push_back(RefPDecl);
}
}
More information about the cfe-commits
mailing list