Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/test/tools/dsymutil/ARM/swiftmodule.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#
# CHECK-NOT: Skipping compiled textual Swift interface: {{.*}}/Inputs/Binary.swiftmodule
# CHECK: Skipping compiled textual Swift interface: {{.*}}/Inputs/FromInterface.swiftmodule
# CHECK-NOT: Skipping compiled textual Swift interface: {{.*}}/Inputs/FromInterface.swiftmodule

#
---
Expand All @@ -26,4 +27,8 @@ objects:
timestamp: 0
type: 50
symbols: []
- filename: '../Inputs/FromInterface.swiftmodule'
timestamp: 0
type: 50
symbols: []
...
5 changes: 5 additions & 0 deletions llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/BinaryFormat/MachO.h"
Expand Down Expand Up @@ -769,6 +770,7 @@ bool DwarfLinkerForBinary::linkImpl(
MaxDWARFVersion = std::max(Unit.getVersion(), MaxDWARFVersion);
};

llvm::StringSet<> SwiftModules;
for (const auto &Obj : Map.objects()) {
// N_AST objects (swiftmodule files) should get dumped directly into the
// appropriate DWARF section.
Expand All @@ -777,6 +779,9 @@ bool DwarfLinkerForBinary::linkImpl(
outs() << "DEBUG MAP OBJECT: " << Obj->getObjectFilename() << "\n";

StringRef File = Obj->getObjectFilename();
if (!SwiftModules.insert(File).second)
continue;

auto ErrorOrMem = MemoryBuffer::getFile(File);
if (!ErrorOrMem) {
reportWarning("Could not open '" + File + "'");
Expand Down