1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
diff --git a/templight_driver.cpp b/templight_driver.cpp
index 1731687..c113fce 100644
--- a/templight_driver.cpp
+++ b/templight_driver.cpp
@@ -57,6 +57,9 @@
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
+#ifdef _WIN32
+#include "Windows/WindowsSupport.h"
+#endif
#include "TemplightAction.h"
@@ -475,7 +478,21 @@ void ExecuteTemplightCommand(Driver &TheDriver, DiagnosticsEngine &Diags,
}
-
+// llvm::sys::Process::GetArgumentVector was renamed as of rL330216
+// https://reviews.llvm.org/rL330216
+// This aims to preserves compatibility, but the better way to do it would
+// be to let InitLLVM do the job
+std::error_code GetArgumentVector(
+ SmallVectorImpl<const char *> &ArgsOut, ArrayRef<const char *> ArgsIn,
+ SpecificBumpPtrAllocator<char> &ArgAllocator) {
+#ifdef _WIN32
+ return windows::GetCommandLineArguments(ArgsOut, ArgAllocator);
+#else
+ ArgsOut.append(ArgsIn.begin(), ArgsIn.end());
+ (void)ArgAllocator;
+ return std::error_code();
+#endif
+}
int main(int argc_, const char **argv_) {
llvm::sys::PrintStackTraceOnErrorSignal(argv_[0]);
@@ -486,7 +503,7 @@ int main(int argc_, const char **argv_) {
SmallVector<const char *, 256> argv;
llvm::SpecificBumpPtrAllocator<char> ArgAllocator;
- std::error_code EC = llvm::sys::Process::GetArgumentVector(
+ std::error_code EC = GetArgumentVector(
argv, llvm::makeArrayRef(argv_, argc_), ArgAllocator);
if (EC) {
llvm::errs() << "error: couldn't get arguments: " << EC.message() << '\n';
|