diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 7 | ||||
-rw-r--r-- | clang/test/Sema/overloadable.c | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index fcc87011c7b..b8d99ba52cf 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/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<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">; diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 75674b08ef5..24009768f46 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/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<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; } diff --git a/clang/test/Sema/overloadable.c b/clang/test/Sema/overloadable.c index b93c39fc1a2..bdd471477b4 100644 --- a/clang/test/Sema/overloadable.c +++ b/clang/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}} |