forked from OSchip/llvm-project
Making type_tag_for_datatype consistent with its declared subject from Attr.td. Also updated the related testcase.
Reviewed by Dmitri Gribenko. llvm-svn: 195675
This commit is contained in:
parent
458eb55e55
commit
90f8c6fb31
|
@ -4089,6 +4089,12 @@ static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D,
|
|||
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);
|
||||
|
|
|
@ -57,6 +57,8 @@ extern struct A datatype_wrong6
|
|||
__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.
|
||||
|
||||
|
@ -156,5 +158,3 @@ void test_64bit_magic(int *int_ptr, float *float_ptr)
|
|||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue