From f2606cd72f0b1dadf3d4a87bc3da70aefce03a7f Mon Sep 17 00:00:00 2001 From: Guus Waals <_@guusw.nl> Date: Sun, 1 Jun 2025 22:27:11 +0800 Subject: [PATCH] Fix parsing of cc --- tooling/parser.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tooling/parser.cpp b/tooling/parser.cpp index e8c19045..a844d05e 100644 --- a/tooling/parser.cpp +++ b/tooling/parser.cpp @@ -217,8 +217,19 @@ CallingConvention getCallingConvention(TSNode node, const char *source_code) { TSNode child = ts_node_child(node, i); const char *type = ts_node_type(child); - // Look for identifiers that might be calling conventions - if (strcmp(type, "identifier") == 0) { + // Handle Microsoft calling convention modifiers (tree-sitter specific) + if (strcmp(type, "ms_call_modifier") == 0) { + std::string text = extractNodeText(child, source_code); + if (text == "__fastcall" || text == "__FASTCALL") { + return CallingConvention::Fastcall; + } else if (text == "__stdcall" || text == "__STDCALL") { + return CallingConvention::Stdcall; + } else if (text == "__cdecl" || text == "__CDECL") { + return CallingConvention::Cdecl; + } + } + // Look for identifiers that might be calling conventions (fallback) + else if (strcmp(type, "identifier") == 0) { std::string text = extractNodeText(child, source_code); if (text == "__fastcall" || text == "__FASTCALL") { return CallingConvention::Fastcall;