Reviewed by Dmitri Gribenko.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195675
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!checkAttributeNumArgs(S, Attr, 1))
return;
+ if (!isa<VarDecl>(D)) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_wrong_decl_type)
+ << Attr.getName() << ExpectedVariable;
+ return;
+ }
+
IdentifierInfo *PointerKind = Attr.getArgAsIdent(0)->Ident;
TypeSourceInfo *MatchingCTypeLoc = 0;
S.GetTypeFromParser(Attr.getMatchingCType(), &MatchingCTypeLoc);
__attribute__(( type_tag_for_datatype(mpi,int,layout_compatible,not_a_flag) )); // expected-error {{invalid comparison flag 'not_a_flag'}}
+void datatype_wrong7(void) __attribute__((type_tag_for_datatype(datatype_wrong7, int))); // expected-error {{'type_tag_for_datatype' attribute only applies to variables}}
+
// Using a tag with kind A in a place where the function requires kind B should
// warn.
F_func(float_ptr, 0xFFFFFFFFFFFFFFFFULL); // expected-warning {{argument type 'float *' doesn't match specified 'f' type tag that requires 'int *'}}
F_func(float_ptr, 0xFFFFFFFFULL);
}
-
-