mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
CMake: Fix LLVM_INTRINSIC_TD_PATH and LDC_INSTALL_PREFIX expansion (#3223)
In -std=gnu* mode, `linux` is a macro that expands to 1. If LLVM_INTRINSIC_TD_PATH (bare string) contains `linux` (e.g. x86_64-linux-gnu), LLVM_INTRINSIC_TD_PATH in gen_gccbuiltins.cpp will be expanded and the whole string will get corrupted. Fix it by switching from bare strings to C++ raw string literals (preserving Windows backslashes).
This commit is contained in:
parent
94743b90fc
commit
91aeb0e674
5 changed files with 19 additions and 20 deletions
|
@ -175,17 +175,13 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#define STR(x) #x
|
||||
#define XSTR(x) STR(x)
|
||||
llvm::SmallString<128> file(XSTR(LLVM_INTRINSIC_TD_PATH));
|
||||
llvm::SmallString<128> file(LLVM_INTRINSIC_TD_PATH);
|
||||
sys::path::append(file, "llvm");
|
||||
sys::path::append(file, "IR");
|
||||
sys::path::append(file, "Intrinsics.td");
|
||||
|
||||
string iStr = string("-I=") + string(XSTR(LLVM_INTRINSIC_TD_PATH));
|
||||
string iStr = string("-I=") + LLVM_INTRINSIC_TD_PATH;
|
||||
string oStr = string("-o=") + argv[1];
|
||||
#undef XSTR
|
||||
#undef STR
|
||||
|
||||
vector<char*> args2(argv, argv + 1);
|
||||
args2.push_back(const_cast<char*>(file.c_str()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue