r186942 - Removed a redundant diagnostic and replaced it with a more standard one. Added a test case for the diagnostic.

Aaron Ballman aaron at aaronballman.com
Tue Jul 23 07:54:24 PDT 2013


Author: aaronballman
Date: Tue Jul 23 09:54:24 2013
New Revision: 186942

URL: http://llvm.org/viewvc/llvm-project?rev=186942&view=rev
Log:
Removed a redundant diagnostic and replaced it with a more standard one.  Added a test case for the diagnostic.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/Sema/address_spaces.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=186942&r1=186941&r2=186942&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jul 23 09:54:24 2013
@@ -1837,8 +1837,6 @@ def err_ext_vector_component_exceeds_len
   "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<

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=186942&r1=186941&r2=186942&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Jul 23 09:54:24 2013
@@ -3840,8 +3840,8 @@ static void HandleAddressSpaceTypeAttrib
   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;
   }

Modified: cfe/trunk/test/Sema/address_spaces.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/address_spaces.c?rev=186942&r1=186941&r2=186942&view=diff
==============================================================================
--- cfe/trunk/test/Sema/address_spaces.c (original)
+++ cfe/trunk/test/Sema/address_spaces.c Tue Jul 23 09:54:24 2013
@@ -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}}





More information about the cfe-commits mailing list