forked from OSchip/llvm-project
diagnose declaring class extension after its implementation
(radar 7822210). llvm-svn: 100226
This commit is contained in:
parent
cc034c7879
commit
e16cdb407a
|
@ -256,6 +256,10 @@ def warn_property_attribute : Warning<
|
|||
def warn_property_types_are_incompatible : Warning<
|
||||
"property type %0 is incompatible with type %1 inherited from %2">;
|
||||
def err_undef_interface : Error<"cannot find interface declaration for %0">;
|
||||
def err_class_extension_after_impl : Error<
|
||||
"cannot declare class extension for %0 after class implementation">;
|
||||
def note_implementation_declared : Note<
|
||||
"class implementation is declared here">;
|
||||
def warn_dup_category_def : Warning<
|
||||
"duplicate definition of category %1 on interface %0">;
|
||||
def err_conflicting_super_class : Error<"conflicting super class name %0">;
|
||||
|
|
|
@ -431,6 +431,11 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
|
|||
// Class extensions require a special treatment. Use an existing one.
|
||||
// Note that 'getClassExtension()' can return NULL.
|
||||
CDecl = IDecl->getClassExtension();
|
||||
if (IDecl->getImplementation()) {
|
||||
Diag(ClassLoc, diag::err_class_extension_after_impl) << ClassName;
|
||||
Diag(IDecl->getImplementation()->getLocation(),
|
||||
diag::note_implementation_declared);
|
||||
}
|
||||
}
|
||||
|
||||
if (!CDecl) {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// rdar://7822210
|
||||
|
||||
@interface A @end
|
||||
|
||||
@implementation A @end // expected-note {{class implementation is declared here}}
|
||||
|
||||
@interface A () // expected-error {{cannot declare class extension for 'A' after class implementation}}
|
||||
-(void) im0;
|
||||
@end
|
||||
|
Loading…
Reference in New Issue