aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Object/Binary.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Object/Binary.h')
-rw-r--r--include/llvm/Object/Binary.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/llvm/Object/Binary.h b/include/llvm/Object/Binary.h
index 00d06e3c7437..bdbe94301dc7 100644
--- a/include/llvm/Object/Binary.h
+++ b/include/llvm/Object/Binary.h
@@ -14,6 +14,7 @@
#ifndef LLVM_OBJECT_BINARY_H
#define LLVM_OBJECT_BINARY_H
+#include "llvm/ADT/Triple.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
@@ -133,6 +134,16 @@ public:
return !(TypeID == ID_ELF32B || TypeID == ID_ELF64B ||
TypeID == ID_MachO32B || TypeID == ID_MachO64B);
}
+
+ Triple::ObjectFormatType getTripleObjectFormat() const {
+ if (isCOFF())
+ return Triple::COFF;
+ if (isMachO())
+ return Triple::MachO;
+ if (isELF())
+ return Triple::ELF;
+ return Triple::UnknownObjectFormat;
+ }
};
/// @brief Create a Binary from Source, autodetecting the file type.