Skip to content

Commit 96b17f8

Browse files
committed
Use objfile_sp->GetArchitecture().GetTriple().isAppleMachO() instead
1 parent 8bf38e2 commit 96b17f8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "lldb/Target/StackFrame.h"
3939

4040
#include "LogChannelDWARF.h"
41-
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
4241
#include "SymbolFileDWARF.h"
4342
#include "lldb/lldb-private-enumerations.h"
4443

@@ -247,7 +246,7 @@ llvm::StringRef SymbolFileDWARFDebugMap::GetPluginDescriptionStatic() {
247246
}
248247

249248
SymbolFile *SymbolFileDWARFDebugMap::CreateInstance(ObjectFileSP objfile_sp) {
250-
if (objfile_sp->GetPluginName() != ObjectFileMachO::GetPluginNameStatic())
249+
if (objfile_sp->GetArchitecture().GetTriple().isAppleMachO())
251250
return nullptr;
252251
return new SymbolFileDWARFDebugMap(std::move(objfile_sp));
253252
}

lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFDebugMapTests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class SymbolFileDWARFDebugMapTests : public testing::Test {
2525
SubsystemRAII<ObjectFileELF, ObjectFileMachO> subsystems;
2626
};
2727

28+
#ifdef __APPLE__
2829
TEST_F(SymbolFileDWARFDebugMapTests, CreateInstanceReturnNonNullForMachOFile) {
2930
// Make sure we don't crash parsing a null unit DIE.
3031
const char *yamldata = R"(
@@ -77,7 +78,9 @@ TEST_F(SymbolFileDWARFDebugMapTests, CreateInstanceReturnNonNullForMachOFile) {
7778
SymbolFileDWARFDebugMap::CreateInstance(object_file->shared_from_this());
7879
ASSERT_NE(debug_map, nullptr);
7980
}
81+
#endif
8082

83+
#ifdef __linux__
8184
TEST_F(SymbolFileDWARFDebugMapTests, CreateInstanceReturnNullForNonMachOFile) {
8285
// Make sure we don't crash parsing a null unit DIE.
8386
const char *yamldata = R"(
@@ -140,3 +143,4 @@ TEST_F(SymbolFileDWARFDebugMapTests, CreateInstanceReturnNullForNonMachOFile) {
140143
SymbolFileDWARFDebugMap::CreateInstance(object_file->shared_from_this());
141144
ASSERT_EQ(debug_map, nullptr);
142145
}
146+
#endif

0 commit comments

Comments
 (0)