aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-07-24 20:53:26 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-07-24 20:53:26 +0000
commiteee3ef177a171c06f826c331e7a9e256d01eaeb0 (patch)
tree6d361dd21e7528f13178711bc5bcf999d345fd54 /include
parent335608a778db3398aca12e3c855ecfa5ff11c5c9 (diff)
objc: clang should warn if redeclaration of methods
declared in protocol in the class qualified by the protocol have type conflicts. To reduce amount of noise, this is done when class is implemented. // rdar://9352731 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135890 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td19
-rw-r--r--include/clang/Sema/Sema.h10
2 files changed, 20 insertions, 9 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index a4ea1c5ff0..cdfa11203e 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -384,26 +384,31 @@ def note_required_for_protocol_at :
Note<"required for direct or indirect protocol %0">;
def warn_conflicting_ret_types : Warning<
- "conflicting return type in implementation of %0: %1 vs %2">;
+ "conflicting return type in "
+ "%select{implementation|declaration}3 of %0: %1 vs %2">;
def warn_conflicting_ret_type_modifiers : Warning<
"conflicting distributed object modifiers on return type "
- "in implementation of %0">,
+ "in %select{implementation|declaration}1 of %0">,
InGroup<DiagGroup<"distributed-object-modifiers">>;
def warn_non_covariant_ret_types : Warning<
- "conflicting return type in implementation of %0: %1 vs %2">,
+ "conflicting return type in "
+ "%select{implementation|declaration}3 of %0: %1 vs %2">,
InGroup<DiagGroup<"method-signatures">>, DefaultIgnore;
def warn_conflicting_param_types : Warning<
- "conflicting parameter types in implementation of %0: %1 vs %2">;
+ "conflicting parameter types in "
+ "%select{implementation|declaration}3 of %0: %1 vs %2">;
def warn_conflicting_param_modifiers : Warning<
"conflicting distributed object modifiers on parameter type "
- "in implementation of %0">,
+ "in %select{implementation|declaration}1 of %0">,
InGroup<DiagGroup<"distributed-object-modifiers">>;
def warn_non_contravariant_param_types : Warning<
- "conflicting parameter types in implementation of %0: %1 vs %2">,
+ "conflicting parameter types in "
+ "%select{implementation|declaration}3 of %0: %1 vs %2">,
InGroup<DiagGroup<"method-signatures">>, DefaultIgnore;
def warn_conflicting_variadic :Warning<
- "conflicting variadic declaration of method and its implementation">;
+ "conflicting variadic declaration of method and its "
+ "%select{implementation|declaration}0">;
def warn_implements_nscopying : Warning<
"default assign attribute on property %0 which implements "
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 35bcf074ff..41d0e8a176 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -1762,9 +1762,10 @@ public:
void WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method,
bool &IncompleteImpl, unsigned DiagID);
- void WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethod,
+ void WarnConflictingTypedMethods(ObjCMethodDecl *Method,
ObjCMethodDecl *MethodDecl,
- bool IsProtocolMethodDecl);
+ bool IsProtocolMethodDecl,
+ bool IsDeclaration = false);
bool isPropertyReadonly(ObjCPropertyDecl *PropertyDecl,
ObjCInterfaceDecl *IDecl);
@@ -1887,6 +1888,11 @@ public:
bool &IncompleteImpl,
bool ImmediateClass);
+ /// MatchMethodsInClassAndItsProtocol - Check that any redeclaration of
+ /// method in protocol in its qualified class match in their type and
+ /// issue warnings otherwise.
+ void MatchMethodsInClassAndItsProtocol(const ObjCInterfaceDecl *CDecl);
+
private:
/// AddMethodToGlobalPool - Add an instance or factory method to the global
/// pool. See descriptoin of AddInstanceMethodToGlobalPool.