r195188 - Removing a custom error diagnostic and replacing it with a stock one. Added a test case to ensure the diagnostic was firing properly.
Aaron Ballman
aaron at aaronballman.com
Tue Nov 19 17:35:23 PST 2013
Author: aaronballman
Date: Tue Nov 19 19:35:23 2013
New Revision: 195188
URL: http://llvm.org/viewvc/llvm-project?rev=195188&view=rev
Log:
Removing a custom error diagnostic and replacing it with a stock one. Added a test case to ensure the diagnostic was firing properly.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/types.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=195188&r1=195187&r2=195188&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Nov 19 19:35:23 2013
@@ -1868,8 +1868,6 @@ def err_attribute_zero_size : Error<"zer
def err_attribute_size_too_large : Error<"vector size too large">;
def err_typecheck_vector_not_convertable : Error<
"can't convert between vector values of different size (%0 and %1)">;
-def err_typecheck_ext_vector_not_typedef : Error<
- "ext_vector_type only applies to types, not variables">;
def err_ext_vector_component_exceeds_length : Error<
"vector component access exceeds type %0">;
def err_ext_vector_component_name_illegal : Error<
@@ -2041,7 +2039,7 @@ def warn_attribute_wrong_decl_type : War
"variables, functions and tag types|thread-local variables|"
"variables and fields|variables, data members and tag types|"
"types and namespaces|Objective-C interfaces|methods and properties|"
- "struct or union|struct, union or class}1">,
+ "struct or union|struct, union or class|types}1">,
InGroup<IgnoredAttributes>;
def err_attribute_wrong_decl_type : Error<
"%0 attribute only applies to %select{functions|unions|"
@@ -2052,7 +2050,7 @@ def err_attribute_wrong_decl_type : Erro
"variables, functions and tag types|thread-local variables|"
"variables and fields|variables, data members and tag types|"
"types and namespaces|Objective-C interfaces|methods and properties|"
- "struct or union|struct, union or class}1">;
+ "struct or union|struct, union or class|types}1">;
def warn_type_attribute_wrong_type : Warning<
"'%0' only applies to %select{function|pointer|"
"Objective-C object or block pointer}1 types; type here is %2">,
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195188&r1=195187&r2=195188&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Nov 19 19:35:23 2013
@@ -57,7 +57,8 @@ enum AttributeDeclKind {
ExpectedObjectiveCInterface,
ExpectedMethodOrProperty,
ExpectedStructOrUnion,
- ExpectedStructOrUnionOrClass
+ ExpectedStructOrUnionOrClass,
+ ExpectedType
};
//===----------------------------------------------------------------------===//
@@ -1249,7 +1250,8 @@ static void handleExtVectorTypeAttr(Sema
if (TD == 0) {
// __attribute__((ext_vector_type(N))) can only be applied to typedefs
// and type-ids.
- S.Diag(Attr.getLoc(), diag::err_typecheck_ext_vector_not_typedef);
+ S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type) <<
+ Attr.getName() << ExpectedType;
return;
}
Modified: cfe/trunk/test/Sema/types.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/types.c?rev=195188&r1=195187&r2=195188&view=diff
==============================================================================
--- cfe/trunk/test/Sema/types.c (original)
+++ cfe/trunk/test/Sema/types.c Tue Nov 19 19:35:23 2013
@@ -72,3 +72,4 @@ typedef int __attribute__ ((ext_vector_t
// no support for vector enum type
enum { e_2 } x3 __attribute__((vector_size(64))); // expected-error {{invalid vector element type}}
+int x4 __attribute__((ext_vector_type(64))); // expected-error {{'ext_vector_type' attribute only applies to types}}
More information about the cfe-commits
mailing list