mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-13 03:13:13 +01:00
Merge pull request #473 from klickverbot/assemble-temp-file
Use PathV1 for creating temporary files on pre-3.4 LLVM.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user