]> granicus.if.org Git - clang/commitdiff
Reusing an existing attribute diagnostic
authorOren Ben Simhon <oren.ben.simhon@intel.com>
Wed, 3 May 2017 14:05:00 +0000 (14:05 +0000)
committerOren Ben Simhon <oren.ben.simhon@intel.com>
Wed, 3 May 2017 14:05:00 +0000 (14:05 +0000)
In a previous patch, a new generic error diagnostic for inconsistent attributes was added.
In this commit I reuse this diagnostic for ns_returns_retained attribute check.

Differential Revision: https://reviews.llvm.org/D32697

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302024 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/SemaObjCXX/arc-overloading.mm

index 68f7bc9a187dfd93e4cdac65f3a3944fa5f30c58..6a3a2124a5ffc4f18d7d48dcea9a97cd83b98793 100644 (file)
@@ -2820,9 +2820,6 @@ def warn_cconv_structors : Warning<
 def err_regparm_mismatch : Error<"function declared with regparm(%0) "
   "attribute was previously declared "
   "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
-def err_returns_retained_mismatch : Error<
-  "function declared with the ns_returns_retained attribute "
-  "was previously declared without the ns_returns_retained attribute">;
 def err_function_attribute_mismatch : Error<
   "function declared with %0 attribute "
   "was previously declared without the %0 attribute">;
index 054ccb64cbec255aedf3334b69fe5e403a5a891f..d4c0783638d11b1460863248db6b1fb4020cc9ca 100644 (file)
@@ -2951,7 +2951,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD,
   // Merge ns_returns_retained attribute.
   if (OldTypeInfo.getProducesResult() != NewTypeInfo.getProducesResult()) {
     if (NewTypeInfo.getProducesResult()) {
-      Diag(New->getLocation(), diag::err_returns_retained_mismatch);
+      Diag(New->getLocation(), diag::err_function_attribute_mismatch)
+          << "'ns_returns_retained'";
       Diag(OldLocation, diag::note_previous_declaration);
       return true;
     }
index a74941721172b49fea2a9254cac7f6f8f9f75274..3ac9c51293b73fab4ce9666dceae00234390a848 100644 (file)
@@ -199,4 +199,4 @@ class rdar10142572 {
 };
 
 id rdar10142572::f() { return 0; } // okay: merged down
-id __attribute__((ns_returns_retained)) rdar10142572::g() { return 0; } // expected-error{{function declared with the ns_returns_retained attribute was previously declared without the ns_returns_retained attribute}}
+id __attribute__((ns_returns_retained)) rdar10142572::g() { return 0; } // expected-error{{function declared with 'ns_returns_retained' attribute was previously declared without the 'ns_returns_retained' attribute}}