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.
+ if (ObjCImpDecl)
Actions.ActOnAtEnd(atLoc, ObjCImpDecl);
- }
-
+ else
+ Diag(atLoc, diag::warn_expected_implementation); // missing @implementation
return ObjCImpDecl;
}
"selector element is not of valid object type (its type is '%0')")
DIAG(err_toomany_element_decls, ERROR,
"Only one element declaration is allowed")
+DIAG(warn_expected_implementation, WARNING,
+ "‘@end’ must appear in an @implementation context")
//===----------------------------------------------------------------------===//
// Semantic Analysis
--- /dev/null
+// RUN: clang -fsyntax-only -verify %s
+@end // expected-warning {{‘@end’ must appear in an @implementation context}}