aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/DeclObjC.cpp5
-rw-r--r--lib/Parse/ParseObjc.cpp3
-rw-r--r--lib/Sema/SemaDeclObjC.cpp14
3 files changed, 10 insertions, 12 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 17b1d28cad..62336b67bd 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -49,10 +49,9 @@ ObjCIvarDecl *ObjCIvarDecl::Create(ASTContext &C, SourceLocation L,
ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, SourceLocation L,
unsigned numRefProtos,
- IdentifierInfo *Id,
- bool ForwardDecl) {
+ IdentifierInfo *Id) {
void *Mem = C.getAllocator().Allocate<ObjCProtocolDecl>();
- return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id, ForwardDecl);
+ return new (Mem) ObjCProtocolDecl(L, numRefProtos, Id);
}
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 77d2adbd32..7345abed99 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -847,7 +847,6 @@ void Parser::ParseObjCClassInstanceVariables(DeclTy *interfaceDecl,
/// "@protocol identifier ;" should be resolved as "@protocol
/// identifier-list ;": objc-interface-decl-list may not start with a
/// semicolon in the first alternative if objc-protocol-refs are omitted.
-
Parser::DeclTy *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_protocol) &&
"ParseObjCAtProtocolDeclaration(): Expected @protocol");
@@ -887,7 +886,7 @@ Parser::DeclTy *Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc) {
if (ExpectAndConsume(tok::semi, diag::err_expected_semi_after, "@protocol"))
return 0;
}
- if (ProtocolRefs.size() > 0)
+ if (!ProtocolRefs.empty())
return Actions.ActOnForwardProtocolDeclaration(AtLoc,
&ProtocolRefs[0],
ProtocolRefs.size());
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 3b8baea519..28a92c7ba2 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -214,12 +214,13 @@ Sema::DeclTy *Sema::ActOnStartProtocolInterface(
PDecl->AllocReferencedProtocols(NumProtoRefs);
} else {
PDecl = ObjCProtocolDecl::Create(Context, AtProtoInterfaceLoc, NumProtoRefs,
- ProtocolName, false);
+ ProtocolName);
+ PDecl->setForwardDecl(false);
ObjCProtocols[ProtocolName] = PDecl;
}
if (NumProtoRefs) {
- /// Check then save referenced protocols
+ /// Check then save referenced protocols.
for (unsigned int i = 0; i != NumProtoRefs; i++) {
ObjCProtocolDecl* RefPDecl = ObjCProtocols[ProtoRefNames[i]];
if (!RefPDecl || RefPDecl->isForwardDecl())
@@ -258,12 +259,11 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
llvm::SmallVector<ObjCProtocolDecl*, 32> Protocols;
for (unsigned i = 0; i != NumElts; ++i) {
- IdentifierInfo *P = IdentList[i];
- ObjCProtocolDecl *PDecl = ObjCProtocols[P];
- if (!PDecl) { // Not already seen?
+ IdentifierInfo *Ident = IdentList[i];
+ ObjCProtocolDecl *&PDecl = ObjCProtocols[Ident];
+ if (PDecl == 0) { // Not already seen?
// FIXME: Pass in the location of the identifier!
- PDecl = ObjCProtocolDecl::Create(Context, AtProtocolLoc, 0, P, true);
- ObjCProtocols[P] = PDecl;
+ PDecl = ObjCProtocolDecl::Create(Context, AtProtocolLoc, 0, Ident);
}
Protocols.push_back(PDecl);