From 4282688e6057ba491db8b8d6121c09cd12501094 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 18 Apr 2021 19:26:21 +0100 Subject: [PATCH] Add calling_convention to odin-doc Type format --- src/docs_format.cpp | 1 + src/docs_writer.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/docs_format.cpp b/src/docs_format.cpp index 8824153ad..e08f75936 100644 --- a/src/docs_format.cpp +++ b/src/docs_format.cpp @@ -134,6 +134,7 @@ struct OdinDocType { i64 elem_counts[OdinDocType_ElemsCap]; // Each of these is esed by some types, not all + OdinDocString calling_convention; OdinDocArray types; OdinDocArray entities; OdinDocTypeIndex polmorphic_params; diff --git a/src/docs_writer.cpp b/src/docs_writer.cpp index 0ae7487fa..2a975e5d0 100644 --- a/src/docs_writer.cpp +++ b/src/docs_writer.cpp @@ -675,6 +675,33 @@ OdinDocTypeIndex odin_doc_type(OdinDocWriter *w, Type *type) { types[0] = odin_doc_type(w, type->Proc.params); types[1] = odin_doc_type(w, type->Proc.results); doc_type.types = odin_write_slice(w, types, gb_count_of(types)); + + String calling_convention = {}; + switch (type->Proc.calling_convention) { + case ProcCC_Invalid: + case ProcCC_Odin: + // no need + break; + case ProcCC_Contextless: + calling_convention = str_lit("contextless"); + break; + case ProcCC_CDecl: + calling_convention = str_lit("cdecl"); + break; + case ProcCC_StdCall: + calling_convention = str_lit("stdcall"); + break; + case ProcCC_FastCall: + calling_convention = str_lit("fastcall"); + break; + case ProcCC_None: + calling_convention = str_lit("none"); + break; + case ProcCC_InlineAsm: + calling_convention = str_lit("inline-assembly"); + break; + } + doc_type.calling_convention = odin_doc_write_string(w, calling_convention); } break; case Type_BitSet: