]> granicus.if.org Git - clang/commitdiff
Replacing a custom diagnostic with a more standard one. No functional change intended.
authorAaron Ballman <aaron@aaronballman.com>
Tue, 26 Nov 2013 16:14:15 +0000 (16:14 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 26 Nov 2013 16:14:15 +0000 (16:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195770 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDeclAttr.cpp
test/Sema/overloadable.c

index fcc87011c7b12f0f6aec071a31ec125e9d0013b1..b8d99ba52cf6bd7d8d8b026da7768720b34af457 100644 (file)
@@ -2405,8 +2405,6 @@ def warn_iboutletcollection_property_assign : Warning<
   "IBOutletCollection properties should be copy/strong and not assign">,
   InGroup<ObjCInvalidIBOutletProperty>;
   
-def err_attribute_overloadable_not_function : Error<
-  "'overloadable' attribute can only be applied to a function">;
 def err_attribute_overloadable_missing : Error<
   "%select{overloaded function|redeclaration of}0 %1 must have the "
   "'overloadable' attribute">;
index 75674b08ef5886af3af1afb057a7a531d5834a6f..24009768f46b16d824b4d62cf611a9d4b869bce4 100644 (file)
@@ -2563,10 +2563,11 @@ static void handleObjCNSObject(Sema &S, Decl *D, const AttributeList &Attr) {
                               Attr.getAttributeSpellingListIndex()));
 }
 
-static void
-handleOverloadableAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+static void handleOverloadableAttr(Sema &S, Decl *D,
+                                   const AttributeList &Attr) {
   if (!isa<FunctionDecl>(D)) {
-    S.Diag(Attr.getLoc(), diag::err_attribute_overloadable_not_function);
+    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
+      << Attr.getName() << ExpectedFunction;
     return;
   }
 
index b93c39fc1a2dc6ca1b887ee3e6d86617a311efa6..bdd471477b47afbecd2cf06800c25e5888e4f7e7 100644 (file)
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute can only be applied to a function}}
+int var __attribute__((overloadable)); // expected-error{{'overloadable' attribute only applies to functions}}
 void params(void) __attribute__((overloadable(12))); // expected-error {{'overloadable' attribute takes no arguments}}
 
 int *f(int) __attribute__((overloadable)); // expected-note 2{{previous overload of function is here}}