1// RUN: %offload-tblgen -gen-print-header -I %S/../../../liboffload/API %s | %fcheck-generic 2 3// Check that ranged function parameters are implemented correctly. These 4// are pointers to an array of an arbitrary size. Their size is described as a 5// range between two values. This is typically between 0 and a parameter such 6// as NumItems. The range information helps the printing code print the entire 7// range of the output rather than just the pointer or the first element. 8 9include "APIDefs.td" 10 11def : Handle { 12 let name = "some_handle_t"; 13 let desc = "An example handle type"; 14} 15 16def : Function { 17 let name = "FunctionA"; 18 let desc = "Function A description"; 19 let details = [ "Function A detailed information" ]; 20 let params = [ 21 Param<"size_t", "OutCount", "the number of things to write out", PARAM_IN>, 22 RangedParam<"some_handle_t*", "OutPtr", "pointer to the output things.", PARAM_OUT, 23 Range<"0", "OutCount">> 24 ]; 25 let returns = []; 26} 27 28// CHECK: inline std::ostream &operator<<(std::ostream &os, const struct function_a_params_t *params) { 29// CHECK: os << ".OutPtr = "; 30// CHECK: for (size_t i = 0; i < *params->pOutCount; i++) { 31// CHECK: if (i > 0) { 32// CHECK: os << ", "; 33// CHECK: } 34// CHECK: printPtr(os, (*params->pOutPtr)[i]); 35// CHECK: } 36// CHECK: os << "}"; 37