[dsymutil] Make the triple detection more strict.
MachOObjectFile offers a method for detecting the correct triple, use
it instead of the previous approximation. This doesn't matter right
now, but it will become important for mach-o universal (fat) binaries.
llvm-svn: 243095
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index 8f3ca6c..cda4349 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -103,13 +103,6 @@
CurrentDebugMapObject = &Result->addDebugMapObject(Path, Timestamp);
}
-static Triple getTriple(const object::MachOObjectFile &Obj) {
- Triple TheTriple("unknown-unknown-unknown");
- TheTriple.setArch(Triple::ArchType(Obj.getArch()));
- TheTriple.setObjectFormat(Triple::MachO);
- return TheTriple;
-}
-
/// This main parsing routine tries to open the main binary and if
/// successful iterates over the STAB entries. The real parsing is
/// done in handleStabSymbolTableEntry.
@@ -120,7 +113,7 @@
const MachOObjectFile &MainBinary = *MainBinOrError;
loadMainBinarySymbols();
- Result = make_unique<DebugMap>(getTriple(MainBinary));
+ Result = make_unique<DebugMap>(BinaryHolder::getTriple(MainBinary));
MainBinaryStrings = MainBinary.getStringTableData();
for (const SymbolRef &Symbol : MainBinary.symbols()) {
const DataRefImpl &DRI = Symbol.getRawDataRefImpl();