summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Object/ObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Object/ObjectFile.cpp')
-rw-r--r--contrib/llvm/lib/Object/ObjectFile.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/llvm/lib/Object/ObjectFile.cpp b/contrib/llvm/lib/Object/ObjectFile.cpp
index 92f9c1f..f36388b 100644
--- a/contrib/llvm/lib/Object/ObjectFile.cpp
+++ b/contrib/llvm/lib/Object/ObjectFile.cpp
@@ -11,9 +11,10 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/MachO.h"
-#include "llvm/Object/ObjectFile.h"
+#include "llvm/Object/Wasm.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -78,6 +79,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type) {
switch (Type) {
case sys::fs::file_magic::unknown:
case sys::fs::file_magic::bitcode:
+ case sys::fs::file_magic::coff_cl_gl_object:
case sys::fs::file_magic::archive:
case sys::fs::file_magic::macho_universal_binary:
case sys::fs::file_magic::windows_resource:
@@ -104,6 +106,8 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type) {
case sys::fs::file_magic::coff_import_library:
case sys::fs::file_magic::pecoff_executable:
return errorOrToExpected(createCOFFObjectFile(Object));
+ case sys::fs::file_magic::wasm_object:
+ return createWasmObjectFile(Object);
}
llvm_unreachable("Unexpected Object File Type");
}
@@ -118,8 +122,8 @@ ObjectFile::createObjectFile(StringRef ObjectPath) {
Expected<std::unique_ptr<ObjectFile>> ObjOrErr =
createObjectFile(Buffer->getMemBufferRef());
- if (!ObjOrErr)
- ObjOrErr.takeError();
+ if (Error Err = ObjOrErr.takeError())
+ return std::move(Err);
std::unique_ptr<ObjectFile> Obj = std::move(ObjOrErr.get());
return OwningBinary<ObjectFile>(std::move(Obj), std::move(Buffer));
OpenPOWER on IntegriCloud