[Libclc-dev] [PATCH] prepare-builtins: Fix build with LLVM 3.5
Aaron Watry
awatry at gmail.com
Mon Jul 7 10:46:11 PDT 2014
getFileOrSTDIN changed its 2nd argument from a ptr to a size and
also changed its return type from an error code to ErrorOr<ptr>.
Signed-off-by: Aaron Watry <awatry at gmail.com>
---
utils/prepare-builtins.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index 20890ed..53e84e4 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -47,16 +47,21 @@ int main(int argc, char **argv) {
std::auto_ptr<Module> M;
{
- UNIQUE_PTR<MemoryBuffer> BufferPtr;
- if (ERROR_CODE ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
- ErrorMessage = ec.message();
- else {
#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR > 4)
- ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(BufferPtr.get(), Context);
+ ErrorOr<UNIQUE_PTR<MemoryBuffer>> FileOrErr = MemoryBuffer::getFileOrSTDIN(InputFilename);
+ if (FileOrErr.getError())
+ ErrorMessage = FileOrErr.getError().message();
+ else {
+ ErrorOr<Module *> ModuleOrErr = parseBitcodeFile(FileOrErr.get().get(), Context);
if (ERROR_CODE ec = ModuleOrErr.getError())
ErrorMessage = ec.message();
M.reset(ModuleOrErr.get());
#else
+ UNIQUE_PTR<MemoryBuffer> BufferPtr;
+ ERROR_CODE ec;
+ if (ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr))
+ ErrorMessage = ec.message();
+ else {
M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage));
#endif
}
--
1.9.1
More information about the Libclc-dev
mailing list