diff --git a/ispc.cpp b/ispc.cpp index 6290c0a1..3ff94a99 100644 --- a/ispc.cpp +++ b/ispc.cpp @@ -211,7 +211,11 @@ std::string Target::GetTripleString() const { llvm::Triple triple; // Start with the host triple as the default +#if defined(LLVM_3_1) || defined(LLVM_3_1svn) + triple.setTriple(llvm::sys::getDefaultTargetTriple()); +#else triple.setTriple(llvm::sys::getHostTriple()); +#endif // And override the arch in the host triple based on what the user // specified. Here we need to deal with the fact that LLVM uses one diff --git a/module.cpp b/module.cpp index 5e4bb316..9e208ebf 100644 --- a/module.cpp +++ b/module.cpp @@ -1114,8 +1114,13 @@ Module::execPreprocessor(const char* infilename, llvm::raw_string_ostream* ostre clang::TargetOptions &options = inst.getTargetOpts(); llvm::Triple triple(module->getTargetTriple()); - if (triple.getTriple().empty()) + if (triple.getTriple().empty()) { +#if defined(LLVM_3_1) || defined(LLVM_3_1svn) + triple.setTriple(llvm::sys::getDefaultTargetTriple()); +#else triple.setTriple(llvm::sys::getHostTriple()); +#endif + } options.Triple = triple.getTriple(); clang::TargetInfo *target =