mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Use PathV1 for creating temporary files on pre-3.4 LLVM.
GitHub: Fixes #471.
This commit is contained in:
parent
dd2a2a6cf9
commit
50f145640f
1 changed files with 10 additions and 9 deletions
|
@ -20,6 +20,9 @@
|
|||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/Program.h"
|
||||
#if LDC_LLVM_VER < 304
|
||||
#include "llvm/Support/PathV1.h"
|
||||
#endif
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#if LDC_LLVM_VER >= 303
|
||||
#include "llvm/IR/Module.h"
|
||||
|
@ -155,21 +158,19 @@ void writeModule(llvm::Module* m, std::string filename)
|
|||
|
||||
// write native assembly
|
||||
if (global.params.output_s || assembleExternally) {
|
||||
#if LDC_LLVM_VER >= 304
|
||||
LLPath spath = LLPath(filename);
|
||||
llvm::sys::path::replace_extension(spath, global.s_ext);
|
||||
if (!global.params.output_s)
|
||||
{
|
||||
#if LDC_LLVM_VER >= 304
|
||||
llvm::sys::fs::createUniqueFile("ldc-%%%%%%%.s", spath);
|
||||
#else
|
||||
int Dummy;
|
||||
llvm::sys::fs::unique_file("ldc-%%%%%%%.s", Dummy, spath, true
|
||||
#if LDC_LLVM_VER >= 302
|
||||
, 0
|
||||
// Pre-3.4 versions don't have a createUniqueFile overload that does
|
||||
// not open the file.
|
||||
llvm::sys::Path spath(filename);
|
||||
spath.eraseSuffix();
|
||||
spath.appendSuffix(std::string(global.s_ext));
|
||||
spath.createTemporaryFileOnDisk();
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
Logger::println("Writing native asm to: %s\n", spath.c_str());
|
||||
std::string err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue