summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Basic/DiagnosticKinds.def2
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp4
-rw-r--r--clang/test/Sema/category-1.m26
3 files changed, 25 insertions, 7 deletions
diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def
index 7b88fce2ff6..92c0bde30ae 100644
--- a/clang/include/clang/Basic/DiagnosticKinds.def
+++ b/clang/include/clang/Basic/DiagnosticKinds.def
@@ -425,7 +425,7 @@ DIAG(err_duplicate_protocol_def, ERROR,
"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'")
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index efef3fc1bee..795e356cc37 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -406,13 +406,13 @@ Sema::DeclTy *Sema::ActOnStartCategoryInterface(
/// 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;
}
diff --git a/clang/test/Sema/category-1.m b/clang/test/Sema/category-1.m
index 40993e8762f..15f6b166c5b 100644
--- a/clang/test/Sema/category-1.m
+++ b/clang/test/Sema/category-1.m
@@ -7,7 +7,7 @@
@interface MyClass1 (Category1) <p1> // expected-warning {{cannot find protocol definition for 'p1', referenced by 'Category1'}}
@end
-@interface MyClass1 (Category1) // expected-error {{duplicate interface declaration for category 'MyClass1(Category1)'}}
+@interface MyClass1 (Category1) // expected-warning {{duplicate interface declaration for category 'MyClass1(Category1)'}}
@end
@interface MyClass1 (Category3)
@@ -20,9 +20,9 @@
@interface MyClass1 (Category8) @end
-@interface MyClass1 (Category4) @end // expected-error {{duplicate interface declaration for category 'MyClass1(Category4)'}}
-@interface MyClass1 (Category7) @end // expected-error {{duplicate interface declaration for category 'MyClass1(Category7)'}}
-@interface MyClass1 (Category8) @end // expected-error {{duplicate interface declaration for category 'MyClass1(Category8)'}}
+@interface MyClass1 (Category4) @end // expected-warning {{duplicate interface declaration for category 'MyClass1(Category4)'}}
+@interface MyClass1 (Category7) @end // expected-warning {{duplicate interface declaration for category 'MyClass1(Category7)'}}
+@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'}}
+@interface XCRemoteComputerManager
+@end
+
+@interface XCRemoteComputerManager()
+@end
+
+@interface XCRemoteComputerManager()
+@end
+
+@interface XCRemoteComputerManager(x)
+@end
+
+@interface XCRemoteComputerManager(x) // expected-warning {{duplicate interface declaration for category 'XCRemoteComputerManager(x)'}}
+@end
+
+@implementation XCRemoteComputerManager
+@end
+
OpenPOWER on IntegriCloud