xref: /llvm-project/offload/test/tools/offload-tblgen/functions_basic.td (revision fd3907ccb583df99e9c19d2fe84e4e7c52d75de9)
1// RUN: %offload-tblgen -gen-api -I %S/../../../liboffload/API %s | %fcheck-generic --check-prefix=CHECK-API
2// RUN: %offload-tblgen -gen-exports -I %S/../../../liboffload/API %s | %fcheck-generic --check-prefix=CHECK-EXPORTS
3// RUN: %offload-tblgen -gen-func-names -I %S/../../../liboffload/API %s | %fcheck-generic --check-prefix=CHECK-FUNC-MACRO
4
5// Check basic support for API functions
6
7include "APIDefs.td"
8
9def : Function {
10    let name = "FunctionA";
11    let desc = "Function A description";
12    let details = [ "Function A detailed information" ];
13    let params = [
14        Param<"uint32_t", "ParamA", "Parameter A description">,
15        Param<"uint32_t*", "ParamB", "Parameter B description">,
16    ];
17    let returns = [
18        Return<"OL_ERRC_INVALID_VALUE", ["When a value is invalid"]>
19    ];
20}
21
22// CHECK-API: /// @brief Function A description
23// CHECK-API: /// @details
24// CHECK-API-NEXT: Function A detailed information
25// CHECK-API: /// @returns
26// CHECK-API: OL_ERRC_INVALID_VALUE
27// CHECK-API-NEXT: When a value is invalid
28
29// CHECK-API: ol_result_t
30// CHECK-API-SAME: FunctionA
31
32// CHECK-API: // Parameter A description
33// CHECK-API-NEXT: uint32_t ParamA
34// CHECK-API: // Parameter B description
35// CHECK-API-NEXT: uint32_t* ParamB
36
37// CHECK-EXPORTS: FunctionA
38
39// CHECK-FUNC-MACRO: OFFLOAD_FUNC(FunctionA)
40