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 | 4957e4057d1c8bcdf62c0b2901b4e69d0f7ae2cb (patch) | |
tree | e19bb6a455de5ebfc818630c1e22bf903082c268 /libclc | |
parent | 9d3f89a7bbbb2072bb44ea99c4c76bd46ad2ae3f (diff) | |
download | bcm5719-llvm-4957e4057d1c8bcdf62c0b2901b4e69d0f7ae2cb.tar.gz bcm5719-llvm-4957e4057d1c8bcdf62c0b2901b4e69d0f7ae2cb.zip |
prepare-builtins: Fix build with LLVM 3.7
llvm-svn: 240552
Diffstat (limited to 'libclc')
-rw-r--r-- | libclc/utils/prepare-builtins.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libclc/utils/prepare-builtins.cpp b/libclc/utils/prepare-builtins.cpp index a3c33839065..42bce7570ef 100644 --- a/libclc/utils/prepare-builtins.cpp +++ b/libclc/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(); |