diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2015-06-24 17:03:50 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2015-06-24 17:03:50 +0000 |
commit | 403ad2544225091a3834fcf580b240339c373692 (patch) | |
tree | c4c18ef2da8e12cded4649ed77df3e8103ae9131 | |
parent | 4f09ca6d0de55ebf792858f50ffc65d9cc1c8613 (diff) |
prepare-builtins: Fix build with LLVM 3.7
git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@240552 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | utils/prepare-builtins.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp index a3c3383..42bce75 100644 --- a/utils/prepare-builtins.cpp +++ b/utils/prepare-builtins.cpp @@ -14,6 +14,10 @@ #include <system_error> +#define LLVM_360 \ + (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 6) + + using namespace llvm; static cl::opt<std::string> @@ -30,7 +34,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "libclc builtin preparation tool\n"); std::string ErrorMessage; - std::auto_ptr<Module> M; + Module *M; { ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = @@ -39,15 +43,24 @@ int main(int argc, char **argv) { if (std::error_code ec = BufferOrErr.getError()) ErrorMessage = ec.message(); else { - ErrorOr<Module *> ModuleOrErr = - parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context); +#if LLVM_360 + ErrorOr<Module *> +#else + ErrorOr<std::unique_ptr<Module>> +#endif + ModuleOrErr = + parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context); if (std::error_code ec = ModuleOrErr.getError()) ErrorMessage = ec.message(); - M.reset(ModuleOrErr.get()); +#if LLVM_360 + M = ModuleOrErr.get().get(); +#else + M = ModuleOrErr.get().release(); +#endif } } - if (M.get() == 0) { + if (!M) { errs() << argv[0] << ": "; if (ErrorMessage.size()) errs() << ErrorMessage << "\n"; @@ -81,7 +94,7 @@ int main(int argc, char **argv) { exit(1); } - WriteBitcodeToFile(M.get(), Out->os()); + WriteBitcodeToFile(M, Out->os()); // Declare success. Out->keep(); |