From: Aaron Ballman Date: Tue, 23 Jul 2013 14:54:24 +0000 (+0000) Subject: Removed a redundant diagnostic and replaced it with a more standard one. Added a... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73883c3d9bf1a03e5c0240e5a8755d5bea07c386;p=clang Removed a redundant diagnostic and replaced it with a more standard one. Added a test case for the diagnostic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186942 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 3f63a50f56..2e4917e938 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -1837,8 +1837,6 @@ def err_ext_vector_component_exceeds_length : Error< "vector component access exceeds type %0">; def err_ext_vector_component_name_illegal : Error< "illegal vector component name '%0'">; -def err_attribute_address_space_not_int : Error< - "address space attribute requires an integer constant">; def err_attribute_address_space_negative : Error< "address space is negative">; def err_attribute_address_space_too_high : Error< diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 2e7f0acc1f..d47cb9b386 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -3840,8 +3840,8 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type, llvm::APSInt addrSpace(32); if (ASArgExpr->isTypeDependent() || ASArgExpr->isValueDependent() || !ASArgExpr->isIntegerConstantExpr(addrSpace, S.Context)) { - S.Diag(Attr.getLoc(), diag::err_attribute_address_space_not_int) - << ASArgExpr->getSourceRange(); + S.Diag(Attr.getLoc(), diag::err_attribute_argument_not_int) + << Attr.getName()->getName() << ASArgExpr->getSourceRange(); Attr.setInvalid(); return; } diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c index ebc510134b..69e0b2851d 100644 --- a/test/Sema/address_spaces.c +++ b/test/Sema/address_spaces.c @@ -66,3 +66,4 @@ void access_as_field() } typedef int PR4997 __attribute__((address_space(Foobar))); // expected-error {{use of undeclared identifier 'Foobar'}} +__attribute__((address_space("12"))) int *i; // expected-error {{'address_space' attribute requires integer constant}}