Patch for method implementation. It populates ObjcImplementationDecl object with method implementation declarations .
It checks and warns on those methods declared in class interface and not implemented.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42412 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 9da15fa..d8361b0 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -882,12 +882,22 @@
if (Tok.getKind() == tok::l_brace)
ParseObjCClassInstanceVariables(ImplClsType/*FIXME*/); // we have ivars
- return 0;
+ return ImplClsType;
}
Parser::DeclTy *Parser::ParseObjCAtEndDeclaration(SourceLocation atLoc) {
assert(Tok.isObjCAtKeyword(tok::objc_end) &&
"ParseObjCAtEndDeclaration(): Expected @end");
ConsumeToken(); // the "end" identifier
+ if (ObjcImpDecl) {
+ // Checking is not necessary except that a parse error might have caused
+ // @implementation not to have been parsed to completion and ObjcImpDecl
+ // could be 0.
+ /// Insert collected methods declarations into the @interface object.
+ Actions.ObjcAddMethodsToClass(ObjcImpDecl,
+ &AllImplMethods[0],AllImplMethods.size());
+ ObjcImpDecl = 0;
+ AllImplMethods.clear();
+ }
return 0;
}
@@ -1056,7 +1066,7 @@
assert(Tok.getKind() == tok::minus &&
"ParseObjCInstanceMethodDefinition(): Expected '-'");
// FIXME: @optional/@protocol??
- ParseObjCMethodPrototype(ObjcImpDecl);
+ AllImplMethods.push_back(ParseObjCMethodPrototype(ObjcImpDecl));
// parse optional ';'
if (Tok.getKind() == tok::semi)
ConsumeToken();
@@ -1075,7 +1085,7 @@
assert(Tok.getKind() == tok::plus &&
"ParseObjCClassMethodDefinition(): Expected '+'");
// FIXME: @optional/@protocol??
- ParseObjCMethodPrototype(ObjcImpDecl);
+ AllImplMethods.push_back(ParseObjCMethodPrototype(ObjcImpDecl));
// parse optional ';'
if (Tok.getKind() == tok::semi)
ConsumeToken();