[cfe-commits] r59919 - in /cfe/trunk: 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

Chris Lattner sabre at nondot.org
Sun Nov 23 14:46:27 PST 2008


Author: lattner
Date: Sun Nov 23 16:46:27 2008
New Revision: 59919

URL: http://llvm.org/viewvc/llvm-project?rev=59919&view=rev
Log:
make some objc redefinition warnings more consistent: call definitions 
"definitions", not declarations.  Point out the location of the 
original definition.

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sun Nov 23 16:46:27 2008
@@ -453,11 +453,11 @@
 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,

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Sun Nov 23 16:46:27 2008
@@ -76,6 +76,8 @@
     // 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 @@
     // 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;

Modified: cfe/trunk/test/SemaObjC/alias-test-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/alias-test-2.m?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/alias-test-2.m (original)
+++ cfe/trunk/test/SemaObjC/alias-test-2.m Sun Nov 23 16:46:27 2008
@@ -3,13 +3,13 @@
 // Note: GCC doesn't produce any of the following errors.
 @interface Super @end // expected-error {{previous definition is here}}
 
- at interface MyWpModule @end
+ at interface MyWpModule @end  // expected-note {{previous definition is here}}
 
 @compatibility_alias  MyAlias MyWpModule;
 
 @compatibility_alias  AliasForSuper Super;
 
- at interface MyAlias : AliasForSuper // expected-error {{duplicate interface declaration for class 'MyWpModule'}}
+ at interface MyAlias : AliasForSuper // expected-error {{duplicate interface definition for class 'MyWpModule'}}
 @end
 
 @implementation MyAlias : AliasForSuper // expected-error {{conflicting super class name 'Super'}}

Modified: cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m (original)
+++ cfe/trunk/test/SemaObjC/check-dup-objc-decls-1.m Sun Nov 23 16:46:27 2008
@@ -29,11 +29,11 @@
 
 @protocol P -im1; @end
 @protocol Q -im2; @end
- at interface A<P> @end
- at interface A<Q> @end  // expected-error {{duplicate interface declaration for class 'A'}}
+ at interface A<P> @end  // expected-note {{previous definition is here}}
+ at interface A<Q> @end  // expected-error {{duplicate interface definition for class 'A'}}
 
- at protocol PP<P> @end
- at protocol PP<Q> @end  // expected-error {{duplicate protocol declaration of 'PP'}}
+ at protocol PP<P> @end  // expected-note {{previous definition is here}}
+ at 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'}}

Modified: cfe/trunk/test/SemaObjC/class-def-test-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/class-def-test-1.m?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/class-def-test-1.m (original)
+++ cfe/trunk/test/SemaObjC/class-def-test-1.m Sun Nov 23 16:46:27 2008
@@ -10,9 +10,9 @@
 
 @interface OBJECT @end	// expected-error {{previous definition is here}}
 
- at interface INTF1 : OBJECT @end
+ at interface INTF1 : OBJECT @end // expected-note {{previous definition is here}}
 
- at interface INTF1 : OBJECT @end // expected-error {{duplicate interface declaration for class 'INTF1'}}
+ at 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}}

Modified: cfe/trunk/test/SemaObjC/forward-class-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/forward-class-1.m?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/forward-class-1.m (original)
+++ cfe/trunk/test/SemaObjC/forward-class-1.m Sun Nov 23 16:46:27 2008
@@ -14,11 +14,11 @@
 @interface INTF1 : FOO	
 @end
 
- at interface INTF2 : INTF1
+ at interface INTF2 : INTF1 // expected-note {{previous definition is here}}
 @end
 
 
 @class INTF1, INTF2;
 
- at interface INTF2 : INTF1 // expected-error {{duplicate interface declaration for class 'INTF2'}}
+ at interface INTF2 : INTF1 // expected-error {{duplicate interface definition for class 'INTF2'}}
 @end

Modified: cfe/trunk/test/SemaObjC/protocol-test-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-test-2.m?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-test-2.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-test-2.m Sun Nov 23 16:46:27 2008
@@ -15,10 +15,10 @@
 
 @protocol p1 @end
 
- at protocol PROTO<p1>
+ at protocol PROTO<p1>     // expected-note {{previous definition is here}}
 @end
 
- at protocol PROTO<p1>	// expected-error {{duplicate protocol declaration of 'PROTO'}}
+ at protocol PROTO<p1>	// expected-error {{duplicate protocol definition of 'PROTO'}}
 @end
 
 @protocol PROTO3<p1, p1>

Modified: cfe/trunk/test/SemaObjC/undef-superclass-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/undef-superclass-1.m?rev=59919&r1=59918&r2=59919&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/undef-superclass-1.m (original)
+++ cfe/trunk/test/SemaObjC/undef-superclass-1.m Sun Nov 23 16:46:27 2008
@@ -7,7 +7,7 @@
 
 @interface SUPER @end
 
- at interface INTF1 : SUPER
+ at 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
 
- at interface INTF1  // expected-error {{duplicate interface declaration for class 'INTF1'}}
+ at interface INTF1  // expected-error {{duplicate interface definition for class 'INTF1'}}
 @end
 
 @implementation SUPER





More information about the cfe-commits mailing list