From 9f55983d966bbf3e6916b5cf5b35acfab2944887 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 10 Sep 2012 16:51:09 +0000 Subject: [PATCH] objective-C: Improving diagnostocs for missing call to super's annotated methods. // rdar://6386358 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163517 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticSemaKinds.td | 2 +- lib/Sema/SemaDecl.cpp | 4 ++-- test/SemaObjC/super-dealloc-attribute.m | 2 +- test/SemaObjC/warn-missing-super.m | 4 ++-- test/SemaObjCXX/warn-missing-super.mm | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index a222e0aad3..16afa972c5 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -739,7 +739,7 @@ def error_property_implemented : Error<"property %0 is already implemented">; def warn_objc_property_attr_mutually_exclusive : Warning< "property attributes '%0' and '%1' are mutually exclusive">, InGroup, DefaultIgnore; -def warn_objc_missing_super_dealloc : Warning< +def warn_objc_missing_super_call : Warning< "method possibly missing a [super %0] call">, InGroup; def error_dealloc_bad_result_type : Error< diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 5ed06d6daa..03b33af755 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -7832,8 +7832,8 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, computeNRVO(Body, getCurFunction()); } if (getCurFunction()->ObjCShouldCallSuperDealloc) { - Diag(MD->getLocEnd(), diag::warn_objc_missing_super_dealloc) - << MD->getDeclName(); + Diag(MD->getLocEnd(), diag::warn_objc_missing_super_call) + << MD->getSelector().getAsString(); getCurFunction()->ObjCShouldCallSuperDealloc = false; } if (getCurFunction()->ObjCShouldCallSuperFinalize) { diff --git a/test/SemaObjC/super-dealloc-attribute.m b/test/SemaObjC/super-dealloc-attribute.m index c2da8e92af..3adf791165 100644 --- a/test/SemaObjC/super-dealloc-attribute.m +++ b/test/SemaObjC/super-dealloc-attribute.m @@ -26,6 +26,6 @@ - (void)XXX { [super MyDealloc]; -} // expected-warning {{method possibly missing a [super 'XXX'] call}} +} // expected-warning {{method possibly missing a [super XXX] call}} @end diff --git a/test/SemaObjC/warn-missing-super.m b/test/SemaObjC/warn-missing-super.m index ba65ec8c8d..02b81651d7 100644 --- a/test/SemaObjC/warn-missing-super.m +++ b/test/SemaObjC/warn-missing-super.m @@ -41,11 +41,11 @@ __attribute__((objc_root_class)) @end // RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck %s -// CHECK: warn-missing-super.m:24:1: warning: method possibly missing a [super 'dealloc'] call +// CHECK: warn-missing-super.m:24:1: warning: method possibly missing a [super dealloc] call // CHECK: 1 warning generated. // RUN: %clang_cc1 -fsyntax-only -fobjc-gc %s 2>&1 | FileCheck --check-prefix=CHECK-GC %s -// CHECK-GC: warn-missing-super.m:24:1: warning: method possibly missing a [super 'dealloc'] call +// CHECK-GC: warn-missing-super.m:24:1: warning: method possibly missing a [super dealloc] call // CHECK-GC: warn-missing-super.m:26:1: warning: method possibly missing a [super finalize] call // CHECK-GC: 2 warnings generated. diff --git a/test/SemaObjCXX/warn-missing-super.mm b/test/SemaObjCXX/warn-missing-super.mm index 7383781535..cd2a6cca76 100644 --- a/test/SemaObjCXX/warn-missing-super.mm +++ b/test/SemaObjCXX/warn-missing-super.mm @@ -15,5 +15,5 @@ template struct shared_ptr { - (void)dealloc { constexpr shared_ptr dummy; -} // expected-warning {{method possibly missing a [super 'dealloc'] call}} +} // expected-warning {{method possibly missing a [super dealloc] call}} @end -- 2.40.0