Update the MemoryBuffer API to use ErrorOr.
[oota-llvm.git] / tools / lto / lto.cpp
index b3f5938b00d3b7761069aab3fd323f7167510b7f..b401f9a7f1916cf6d9454fd8af39aeb2e4b01551 100644 (file)
@@ -88,10 +88,10 @@ bool lto_module_is_object_file(const char* path) {
 
 bool lto_module_is_object_file_for_target(const char* path,
                                           const char* target_triplet_prefix) {
-  std::unique_ptr<MemoryBuffer> buffer;
-  if (MemoryBuffer::getFile(path, buffer))
+  ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer = MemoryBuffer::getFile(path);
+  if (!Buffer)
     return false;
-  return LTOModule::isBitcodeForTarget(buffer.get(), target_triplet_prefix);
+  return LTOModule::isBitcodeForTarget(Buffer->get(), target_triplet_prefix);
 }
 
 bool lto_module_is_object_file_in_memory(const void* mem, size_t length) {