]> granicus.if.org Git - clang/commitdiff
make some objc redefinition warnings more consistent: call definitions
authorChris Lattner <sabre@nondot.org>
Sun, 23 Nov 2008 22:46:27 +0000 (22:46 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 23 Nov 2008 22:46:27 +0000 (22:46 +0000)
"definitions", not declarations.  Point out the location of the
original definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59919 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticKinds.def
lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/alias-test-2.m
test/SemaObjC/check-dup-objc-decls-1.m
test/SemaObjC/class-def-test-1.m
test/SemaObjC/forward-class-1.m
test/SemaObjC/protocol-test-2.m
test/SemaObjC/undef-superclass-1.m

index 860888f026dee39ddb9383ddeda59106f4e72878..cbf7590058eaaddbb5f45795c7197ae739a5811c 100644 (file)
@@ -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,
index 7ffae4725c8951722dfff53e299b6c48836ce456..c030a370e40de5fd18ddc5dd3e676b678de93c8e 100644 (file)
@@ -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;
index 5f3bfcbba7539479927bbcc7a513084186e720ab..bdaeefe5a368549ac84ba4cca68f63581f8e326a 100644 (file)
@@ -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'}}
index a634d0e6da4d9bd2b1fb1704aa02afb6cc3915e8..28c6068afd021df41c6e56d5721158f7838c98a6 100644 (file)
@@ -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'}}
index 3dc687b99a6d8fb47dd724dc9d1b2720ef350e40..cf0ef53cae2ff7b350fc30635194b09affdc1c6f 100644 (file)
@@ -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}}
index 2b9369ba5f8a572743e245e6bb1fda3d39be390f..5eb36e704aed8cbcbf7a9ce768b13d7333f3b069 100644 (file)
 @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
index 1a7fc9ce3ccf0c6bc29339cb40eeacc4a86f5f34..e5fff2da630d7e136be6dd68add3fbd9a4f5ecb6 100644 (file)
 
 @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>
index 7e12463654f3d3085fbf867972ccb73b4d63dfd8..ba233f8c4e61123c5ac06d71fa58be8ff2f37f96 100644 (file)
@@ -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