1 // RUN: %clang_cc1 -x c -triple x86_64-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s
3 #define __tag1 __attribute__((btf_decl_tag("tag1")))
4 #define __tag2 __attribute__((btf_decl_tag("tag2")))
5 #define __tag3 __attribute__((btf_decl_tag("tag3")))
7 #define __tag_no_arg __attribute__((btf_decl_tag()))
8 #define __tag_2_arg __attribute__((btf_decl_tag("tag1", "tag2")))
9 #define __invalid __attribute__((btf_decl_tag(1)))
11 struct __tag1 __tag2 t1
;
17 struct __tag2 __tag3 t2
{
22 int g2 __tag_no_arg
; // expected-error {{'btf_decl_tag' attribute takes one argument}}
23 int g3 __tag_2_arg
; // expected-error {{'btf_decl_tag' attribute takes one argument}}
24 int i1 __invalid
; // expected-error {{expected string literal as argument of 'btf_decl_tag' attribute}}
28 } __tag1
; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, non-static data members, and typedefs}}
32 } __tag_no_arg
; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, non-static data members, and typedefs}}
36 } __tag_2_arg
; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, non-static data members, and typedefs}}
38 int __tag1 __tag2
foo(struct t1
*arg
, struct t2
*arg2
);
39 int __tag2 __tag3
foo(struct t1
*arg
, struct t2
*arg2
);
40 int __tag1
foo(struct t1
*arg __tag1
, struct t2
*arg2
) {
41 return arg
->a
+ arg2
->a
;
44 typedef unsigned * __u1 __tag1 __tag2
;
48 int convert2(__t2
*arg
) {