From 6520026964065327558472841838510176646568 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Tue, 28 May 2024 18:53:17 -0400 Subject: Add AdjustTypeParserArguments callback to platform Implementing the solution to #4868 --- platform/windows/platform_windows.cpp | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'platform/windows/platform_windows.cpp') diff --git a/platform/windows/platform_windows.cpp b/platform/windows/platform_windows.cpp index cb256660..f104215d 100644 --- a/platform/windows/platform_windows.cpp +++ b/platform/windows/platform_windows.cpp @@ -57,6 +57,26 @@ public: return nullptr; } + + virtual void AdjustTypeParserInput( + Ref parser, + std::vector& arguments, + std::vector>& sourceFiles + ) override + { + if (parser->GetName() != "ClangTypeParser") + { + return; + } + + for (auto& arg: arguments) + { + if (arg.find("--target=") == 0 && arg.find("-unknown-") != std::string::npos) + { + arg = "--target=i386-pc-windows-msvc"; + } + } + } }; @@ -97,6 +117,26 @@ public: return nullptr; } + + virtual void AdjustTypeParserInput( + Ref parser, + std::vector& arguments, + std::vector>& sourceFiles + ) override + { + if (parser->GetName() != "ClangTypeParser") + { + return; + } + + for (auto& arg: arguments) + { + if (arg.find("--target=") == 0 && arg.find("-unknown-") != std::string::npos) + { + arg = "--target=x86_64-pc-windows-msvc"; + } + } + } }; @@ -116,6 +156,26 @@ public: RegisterStdcallCallingConvention(cc); } } + + virtual void AdjustTypeParserInput( + Ref parser, + std::vector& arguments, + std::vector>& sourceFiles + ) override + { + if (parser->GetName() != "ClangTypeParser") + { + return; + } + + for (auto& arg: arguments) + { + if (arg.find("--target=") == 0 && arg.find("-unknown-") != std::string::npos) + { + arg = "--target=armv7-pc-windows-msvc"; + } + } + } }; @@ -142,6 +202,26 @@ public: SetSystemCallConvention(cc); } } + + virtual void AdjustTypeParserInput( + Ref parser, + std::vector& arguments, + std::vector>& sourceFiles + ) override + { + if (parser->GetName() != "ClangTypeParser") + { + return; + } + + for (auto& arg: arguments) + { + if (arg.find("--target=") == 0 && arg.find("-unknown-") != std::string::npos) + { + arg = "--target=aarch64-pc-windows-msvc"; + } + } + } }; -- cgit v1.3.1