summaryrefslogtreecommitdiff
path: root/platform/windows/platform_windows.cpp
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-05-28 18:53:17 -0400
committerGlenn Smith <glenn@vector35.com>2024-06-04 00:29:48 -0400
commit6520026964065327558472841838510176646568 (patch)
tree6a124b7d6aa5efdfafc43fbb2ccaf3af23d35ff2 /platform/windows/platform_windows.cpp
parent5c7ab961657c6bcfc58c84cf93f850bdb102a425 (diff)
Add AdjustTypeParserArguments callback to platform
Implementing the solution to #4868
Diffstat (limited to 'platform/windows/platform_windows.cpp')
-rw-r--r--platform/windows/platform_windows.cpp80
1 files changed, 80 insertions, 0 deletions
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<TypeParser> parser,
+ std::vector<std::string>& arguments,
+ std::vector<std::pair<std::string, std::string>>& 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<TypeParser> parser,
+ std::vector<std::string>& arguments,
+ std::vector<std::pair<std::string, std::string>>& 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<TypeParser> parser,
+ std::vector<std::string>& arguments,
+ std::vector<std::pair<std::string, std::string>>& 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<TypeParser> parser,
+ std::vector<std::string>& arguments,
+ std::vector<std::pair<std::string, std::string>>& 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";
+ }
+ }
+ }
};