From 0765cbb56ac448b1a35a9d1dfeb45e9641cf22a6 Mon Sep 17 00:00:00 2001 From: Aaron Ballman <aaron@aaronballman.com> Date: Sun, 24 Nov 2013 21:48:06 +0000 Subject: [PATCH] Switching the common attribute over to using the generic diagnostic, and removing the now-unused diagnostic. Updates a test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195581 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticSemaKinds.td | 2 -- lib/Sema/SemaDeclAttr.cpp | 3 ++- test/SemaCXX/attr-common.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 59a2c19a3a3..fcc87011c7b 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1855,8 +1855,6 @@ def err_format_attribute_result_not : Error<"function does not return %0">; def err_format_attribute_implicit_this_format_string : Error< "format attribute cannot specify the implicit this argument as the format " "string">; -def err_common_not_supported_cplusplus : Error< - "common attribute is not supported in C++">; def err_init_method_bad_return_type : Error< "init methods must return an object pointer type, not %0">; def err_attribute_invalid_size : Error< diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 4a8b5289317..2fc491b7589 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1854,7 +1854,8 @@ static void handleNoCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) { static void handleCommonAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (S.LangOpts.CPlusPlus) { - S.Diag(Attr.getLoc(), diag::err_common_not_supported_cplusplus); + S.Diag(Attr.getLoc(), diag::err_attribute_not_supported_in_lang) + << Attr.getName() << AttributeLangSupport::Cpp; return; } diff --git a/test/SemaCXX/attr-common.cpp b/test/SemaCXX/attr-common.cpp index 58b30133f52..fb98639d1b2 100644 --- a/test/SemaCXX/attr-common.cpp +++ b/test/SemaCXX/attr-common.cpp @@ -1,3 +1,3 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -__attribute__((common)) int x; // expected-error {{common attribute is not supported in C++}} +__attribute__((common)) int x; // expected-error {{'common' attribute is not supported in C++}} -- GitLab