[cfe-commits] r51976 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaDeclObjC.cpp test/Sema/category-1.m
Steve Naroff
snaroff at apple.com
Wed Jun 4 21:33:45 PDT 2008
Author: snaroff
Date: Wed Jun 4 23:33:44 2008
New Revision: 51976
URL: http://llvm.org/viewvc/llvm-project?rev=51976&view=rev
Log:
Fix trivial crasher and downgrade an error to warning (to match GCC).
Modified:
cfe/trunk/include/clang/Basic/DiagnosticKinds.def
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/Sema/category-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=51976&r1=51975&r2=51976&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jun 4 23:33:44 2008
@@ -425,7 +425,7 @@
"duplicate protocol declaration of '%0'")
DIAG(err_undef_interface, ERROR,
"cannot find interface declaration for '%0'")
-DIAG(err_dup_category_def, ERROR,
+DIAG(warn_dup_category_def, WARNING,
"duplicate interface declaration for category '%0(%1)'")
DIAG(warn_undef_interface, WARNING,
"cannot find interface declaration for '%0'")
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=51976&r1=51975&r2=51976&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Jun 4 23:33:44 2008
@@ -406,13 +406,13 @@
/// Check that class of this category is already completely declared.
if (!IDecl || IDecl->isForwardDecl())
Diag(ClassLoc, diag::err_undef_interface, ClassName->getName());
- else {
+ else if (CategoryName) {
/// Check for duplicate interface declaration for this category
ObjCCategoryDecl *CDeclChain;
for (CDeclChain = IDecl->getCategoryList(); CDeclChain;
CDeclChain = CDeclChain->getNextClassCategory()) {
if (CDeclChain->getIdentifier() == CategoryName) {
- Diag(CategoryLoc, diag::err_dup_category_def, ClassName->getName(),
+ Diag(CategoryLoc, diag::warn_dup_category_def, ClassName->getName(),
CategoryName->getName());
break;
}
Modified: cfe/trunk/test/Sema/category-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/category-1.m?rev=51976&r1=51975&r2=51976&view=diff
==============================================================================
--- cfe/trunk/test/Sema/category-1.m (original)
+++ cfe/trunk/test/Sema/category-1.m Wed Jun 4 23:33:44 2008
@@ -7,7 +7,7 @@
@interface MyClass1 (Category1) <p1> // expected-warning {{cannot find protocol definition for 'p1', referenced by 'Category1'}}
@end
- at interface MyClass1 (Category1) // expected-error {{duplicate interface declaration for category 'MyClass1(Category1)'}}
+ at interface MyClass1 (Category1) // expected-warning {{duplicate interface declaration for category 'MyClass1(Category1)'}}
@end
@interface MyClass1 (Category3)
@@ -20,9 +20,9 @@
@interface MyClass1 (Category8) @end
- at interface MyClass1 (Category4) @end // expected-error {{duplicate interface declaration for category 'MyClass1(Category4)'}}
- at interface MyClass1 (Category7) @end // expected-error {{duplicate interface declaration for category 'MyClass1(Category7)'}}
- at interface MyClass1 (Category8) @end // expected-error {{duplicate interface declaration for category 'MyClass1(Category8)'}}
+ at interface MyClass1 (Category4) @end // expected-warning {{duplicate interface declaration for category 'MyClass1(Category4)'}}
+ at interface MyClass1 (Category7) @end // expected-warning {{duplicate interface declaration for category 'MyClass1(Category7)'}}
+ at interface MyClass1 (Category8) @end // expected-warning {{duplicate interface declaration for category 'MyClass1(Category8)'}}
@protocol p3 @end
@@ -35,4 +35,22 @@
@interface MyClass2 (Category) @end // expected-error {{cannot find interface declaration for 'MyClass2'}}
+ at interface XCRemoteComputerManager
+ at end
+
+ at interface XCRemoteComputerManager()
+ at end
+
+ at interface XCRemoteComputerManager()
+ at end
+
+ at interface XCRemoteComputerManager(x)
+ at end
+
+ at interface XCRemoteComputerManager(x) // expected-warning {{duplicate interface declaration for category 'XCRemoteComputerManager(x)'}}
+ at end
+
+ at implementation XCRemoteComputerManager
+ at end
+
More information about the cfe-commits
mailing list