Fix build with LLVM top-of-tree

This commit is contained in:
Matt Pharr
2013-07-17 09:25:00 -07:00
parent 8c9e873c10
commit f1cce0ef5f
2 changed files with 10 additions and 0 deletions

View File

@@ -4914,7 +4914,12 @@ WriteCXXFile(llvm::Module *module, const char *fn, int vectorWidth,
pm.add(new llvm::TargetData(module));
#endif
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
int flags = 0;
#else
llvm::sys::fs::OpenFlags flags = llvm::sys::fs::F_None;
#endif
std::string error;
llvm::tool_output_file *of = new llvm::tool_output_file(fn, error, flags);
if (error.size()) {

View File

@@ -1064,7 +1064,12 @@ Module::writeObjectFileOrAssembly(llvm::TargetMachine *targetMachine,
llvm::TargetMachine::CodeGenFileType fileType = (outputType == Object) ?
llvm::TargetMachine::CGFT_ObjectFile : llvm::TargetMachine::CGFT_AssemblyFile;
bool binary = (fileType == llvm::TargetMachine::CGFT_ObjectFile);
#if defined(LLVM_3_1) || defined(LLVM_3_2) || defined(LLVM_3_3)
unsigned int flags = binary ? llvm::raw_fd_ostream::F_Binary : 0;
#else
llvm::sys::fs::OpenFlags flags = binary ? llvm::sys::fs::F_Binary :
llvm::sys::fs::F_None;
#endif
std::string error;
llvm::tool_output_file *of = new llvm::tool_output_file(outFileName, error, flags);