diff --git a/offload/liboffload/API/Common.td b/offload/liboffload/API/Common.td index 6eaf604c8ebb..9a397812e417 100644 --- a/offload/liboffload/API/Common.td +++ b/offload/liboffload/API/Common.td @@ -127,7 +127,7 @@ def : Struct { def : Typedef { let name = "ol_result_t"; let desc = "Result type returned by all entry points."; - let value = "const ol_error_struct_t*"; + let value = "const struct ol_error_struct_t*"; } def : Macro { diff --git a/offload/tools/offload-tblgen/APIGen.cpp b/offload/tools/offload-tblgen/APIGen.cpp index 5a59d2a37377..1e79c00ae06c 100644 --- a/offload/tools/offload-tblgen/APIGen.cpp +++ b/offload/tools/offload-tblgen/APIGen.cpp @@ -226,31 +226,23 @@ OL_APIEXPORT ol_result_t OL_APICALL {0}WithCodeLoc( void EmitOffloadAPI(const RecordKeeper &Records, raw_ostream &OS) { OS << GenericHeader; OS << FileHeader; - // Generate main API definitions - for (auto *R : Records.getAllDerivedDefinitions("APIObject")) { - if (R->isSubClassOf("Macro")) { - ProcessMacro(MacroRec{R}, OS); - } else if (R->isSubClassOf("Typedef")) { - ProcessTypedef(TypedefRec{R}, OS); - } else if (R->isSubClassOf("Handle")) { - ProcessHandle(HandleRec{R}, OS); - } else if (R->isSubClassOf("Function")) { - ProcessFunction(FunctionRec{R}, OS); - } else if (R->isSubClassOf("Enum")) { - ProcessEnum(EnumRec{R}, OS); - } else if (R->isSubClassOf("Struct")) { - ProcessStruct(StructRec{R}, OS); - } else if (R->isSubClassOf("FptrTypedef")) { - ProcessFptrTypedef(FptrTypedefRec{R}, OS); - } - } - // Generate auxiliary definitions (func param structs etc) + // Generate main API definitions + for (auto *R : Records.getAllDerivedDefinitions("Macro")) + ProcessMacro(MacroRec{R}, OS); + for (auto *R : Records.getAllDerivedDefinitions("Handle")) + ProcessHandle(HandleRec{R}, OS); + for (auto *R : Records.getAllDerivedDefinitions("Enum")) + ProcessEnum(EnumRec{R}, OS); + for (auto *R : Records.getAllDerivedDefinitions("Typedef")) + ProcessTypedef(TypedefRec{R}, OS); + for (auto *R : Records.getAllDerivedDefinitions("FptrTypedef")) + ProcessFptrTypedef(FptrTypedefRec{R}, OS); + for (auto *R : Records.getAllDerivedDefinitions("Struct")) + ProcessStruct(StructRec{R}, OS); for (auto *R : Records.getAllDerivedDefinitions("Function")) { ProcessFuncParamStruct(FunctionRec{R}, OS); - } - - for (auto *R : Records.getAllDerivedDefinitions("Function")) { + ProcessFunction(FunctionRec{R}, OS); ProcessFuncWithCodeLocVariant(FunctionRec{R}, OS); }