[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Sema / builtin-bpf-btf-type-id.c
blob70b42c976dedb2f929b61a7b0b84120e890d8590
1 // RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s
3 struct {
4 char f1[100];
5 int f2;
6 } tmp = {};
8 unsigned invalid1(void) { return __builtin_btf_type_id(1, tmp); } // expected-error {{__builtin_btf_type_id argument 2 not a constant}}
9 unsigned invalid2(void) { return __builtin_btf_type_id(1, 1, 1); } // expected-error {{too many arguments to function call, expected 2, have 3}}
11 int valid1(void) { return __builtin_btf_type_id(tmp, 0); }
12 int valid2(void) { return __builtin_btf_type_id(&tmp, 1); }
13 int valid3(void) { return __builtin_btf_type_id(tmp.f1[4], 10); }