diff options
-rw-r--r-- | clang/include/clang/Basic/DiagnosticKinds.def | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 3 | ||||
-rw-r--r-- | clang/test/SemaObjC/alias-test-2.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/check-dup-objc-decls-1.m | 8 | ||||
-rw-r--r-- | clang/test/SemaObjC/class-def-test-1.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/forward-class-1.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/protocol-test-2.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/undef-superclass-1.m | 4 |
8 files changed, 19 insertions, 16 deletions
diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def index 860888f026d..cbf7590058e 100644 --- a/clang/include/clang/Basic/DiagnosticKinds.def +++ b/clang/include/clang/Basic/DiagnosticKinds.def @@ -453,11 +453,11 @@ DIAG(err_objc_concat_string, ERROR, DIAG(err_undef_superclass, ERROR, "cannot find interface declaration for %0, superclass of %1") DIAG(err_duplicate_class_def, ERROR, - "duplicate interface declaration for class '%0'") + "duplicate interface definition for class '%0'") DIAG(warn_undef_protocolref, WARNING, "cannot find protocol definition for %0") DIAG(err_duplicate_protocol_def, ERROR, - "duplicate protocol declaration of %0") + "duplicate protocol definition of %0") DIAG(err_undef_interface, ERROR, "cannot find interface declaration for %0") DIAG(warn_dup_category_def, WARNING, diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 7ffae4725c8..c030a370e40 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -76,6 +76,8 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, // Class already seen. Is it a forward declaration? if (!IDecl->isForwardDecl()) { Diag(AtInterfaceLoc, diag::err_duplicate_class_def) << IDecl->getName(); + Diag(IDecl->getLocation(), diag::note_previous_definition); + // Return the previous class interface. // FIXME: don't leak the objects passed in! return IDecl; @@ -188,6 +190,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, // Protocol already seen. Better be a forward protocol declaration if (!PDecl->isForwardDecl()) { Diag(ProtocolLoc, diag::err_duplicate_protocol_def) << ProtocolName; + Diag(PDecl->getLocation(), diag::note_previous_definition); // Just return the protocol we already had. // FIXME: don't leak the objects passed in! return PDecl; diff --git a/clang/test/SemaObjC/alias-test-2.m b/clang/test/SemaObjC/alias-test-2.m index 5f3bfcbba75..bdaeefe5a36 100644 --- a/clang/test/SemaObjC/alias-test-2.m +++ b/clang/test/SemaObjC/alias-test-2.m @@ -3,13 +3,13 @@ // Note: GCC doesn't produce any of the following errors. @interface Super @end // expected-error {{previous definition is here}} -@interface MyWpModule @end +@interface MyWpModule @end // expected-note {{previous definition is here}} @compatibility_alias MyAlias MyWpModule; @compatibility_alias AliasForSuper Super; -@interface MyAlias : AliasForSuper // expected-error {{duplicate interface declaration for class 'MyWpModule'}} +@interface MyAlias : AliasForSuper // expected-error {{duplicate interface definition for class 'MyWpModule'}} @end @implementation MyAlias : AliasForSuper // expected-error {{conflicting super class name 'Super'}} diff --git a/clang/test/SemaObjC/check-dup-objc-decls-1.m b/clang/test/SemaObjC/check-dup-objc-decls-1.m index a634d0e6da4..28c6068afd0 100644 --- a/clang/test/SemaObjC/check-dup-objc-decls-1.m +++ b/clang/test/SemaObjC/check-dup-objc-decls-1.m @@ -29,11 +29,11 @@ void Gorf() // expected-error {{redefinition of 'Gorf' as different kind of symb @protocol P -im1; @end @protocol Q -im2; @end -@interface A<P> @end -@interface A<Q> @end // expected-error {{duplicate interface declaration for class 'A'}} +@interface A<P> @end // expected-note {{previous definition is here}} +@interface A<Q> @end // expected-error {{duplicate interface definition for class 'A'}} -@protocol PP<P> @end -@protocol PP<Q> @end // expected-error {{duplicate protocol declaration of 'PP'}} +@protocol PP<P> @end // expected-note {{previous definition is here}} +@protocol PP<Q> @end // expected-error {{duplicate protocol definition of 'PP'}} @interface A(Cat)<P> @end // expected-note {{previous definition is here}} @interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}} diff --git a/clang/test/SemaObjC/class-def-test-1.m b/clang/test/SemaObjC/class-def-test-1.m index 3dc687b99a6..cf0ef53cae2 100644 --- a/clang/test/SemaObjC/class-def-test-1.m +++ b/clang/test/SemaObjC/class-def-test-1.m @@ -10,9 +10,9 @@ typedef int INTF; // expected-error {{previous definition is here}} @interface OBJECT @end // expected-error {{previous definition is here}} -@interface INTF1 : OBJECT @end +@interface INTF1 : OBJECT @end // expected-note {{previous definition is here}} -@interface INTF1 : OBJECT @end // expected-error {{duplicate interface declaration for class 'INTF1'}} +@interface INTF1 : OBJECT @end // expected-error {{duplicate interface definition for class 'INTF1'}} typedef int OBJECT; // expected-error {{previous definition is here}} \ expected-error {{redefinition of 'OBJECT' as different kind of symbol}} diff --git a/clang/test/SemaObjC/forward-class-1.m b/clang/test/SemaObjC/forward-class-1.m index 2b9369ba5f8..5eb36e704ae 100644 --- a/clang/test/SemaObjC/forward-class-1.m +++ b/clang/test/SemaObjC/forward-class-1.m @@ -14,11 +14,11 @@ @interface INTF1 : FOO @end -@interface INTF2 : INTF1 +@interface INTF2 : INTF1 // expected-note {{previous definition is here}} @end @class INTF1, INTF2; -@interface INTF2 : INTF1 // expected-error {{duplicate interface declaration for class 'INTF2'}} +@interface INTF2 : INTF1 // expected-error {{duplicate interface definition for class 'INTF2'}} @end diff --git a/clang/test/SemaObjC/protocol-test-2.m b/clang/test/SemaObjC/protocol-test-2.m index 1a7fc9ce3cc..e5fff2da630 100644 --- a/clang/test/SemaObjC/protocol-test-2.m +++ b/clang/test/SemaObjC/protocol-test-2.m @@ -15,10 +15,10 @@ @protocol p1 @end -@protocol PROTO<p1> +@protocol PROTO<p1> // expected-note {{previous definition is here}} @end -@protocol PROTO<p1> // expected-error {{duplicate protocol declaration of 'PROTO'}} +@protocol PROTO<p1> // expected-error {{duplicate protocol definition of 'PROTO'}} @end @protocol PROTO3<p1, p1> diff --git a/clang/test/SemaObjC/undef-superclass-1.m b/clang/test/SemaObjC/undef-superclass-1.m index 7e12463654f..ba233f8c4e6 100644 --- a/clang/test/SemaObjC/undef-superclass-1.m +++ b/clang/test/SemaObjC/undef-superclass-1.m @@ -7,7 +7,7 @@ @interface SUPER @end -@interface INTF1 : SUPER +@interface INTF1 : SUPER // expected-note {{previous definition is here}} @end @interface INTF2 : INTF1 @@ -16,7 +16,7 @@ @interface INTF3 : Y // expected-error {{cannot find interface declaration for 'Y', superclass of 'INTF3'}} @end -@interface INTF1 // expected-error {{duplicate interface declaration for class 'INTF1'}} +@interface INTF1 // expected-error {{duplicate interface definition for class 'INTF1'}} @end @implementation SUPER |