From e89849f12f1bd6947ddf368bea6b6308a46b4574 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 26 Nov 2013 16:14:15 +0000 Subject: [PATCH] Replacing a custom diagnostic with a more standard one. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195770 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticSemaKinds.td | 2 -- lib/Sema/SemaDeclAttr.cpp | 7 ++++--- test/Sema/overloadable.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index fcc87011c7..b8d99ba52c 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -2405,8 +2405,6 @@ def warn_iboutletcollection_property_assign : Warning< "IBOutletCollection properties should be copy/strong and not assign">, InGroup; -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">; diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 75674b08ef..24009768f4 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -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(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; } diff --git a/test/Sema/overloadable.c b/test/Sema/overloadable.c index b93c39fc1a..bdd471477b 100644 --- a/test/Sema/overloadable.c +++ b/test/Sema/overloadable.c @@ -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}} -- 2.50.1