[Libclc-dev] [PATCH v2 libclc 1/2] Fix build against LLVM SVN >= r216393
Michel Dänzer
michel at daenzer.net
Tue Aug 26 20:14:32 PDT 2014
From: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
v2:
* Add and use LLVM_360_AND_NEWER
* Drop .c_str() from OutputFilename
utils/prepare-builtins.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index 726866e..0f3147c 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -12,6 +12,9 @@
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Config/llvm-config.h"
+#define LLVM_360_AND_NEWER \
+ (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6))
+
#define LLVM_350_AND_NEWER \
(LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 5))
@@ -95,6 +98,15 @@ int main(int argc, char **argv) {
return 1;
}
+#if LLVM_360_AND_NEWER
+ std::error_code EC;
+ UNIQUE_PTR<tool_output_file> Out
+ (new tool_output_file(OutputFilename, EC, sys::fs::F_None));
+ if (EC) {
+ errs() << EC.message() << '\n';
+ exit(1);
+ }
+#else
std::string ErrorInfo;
UNIQUE_PTR<tool_output_file> Out
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
@@ -109,6 +121,7 @@ int main(int argc, char **argv) {
errs() << ErrorInfo << '\n';
exit(1);
}
+#endif // LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 6)
WriteBitcodeToFile(M.get(), Out->os());
--
2.1.0
More information about the Libclc-dev
mailing list