Skip to content

Commit 1fad3d6

Browse files
committed
lldb-moduleimport-test: handle COFF properly
lldb-moduleimport-test would only check for MachO and ELF object file formats. However, Windows uses COFF object files. Add that to the list of formats that we check. This allows us to inspect content built for Windows.
1 parent 48d8ed0 commit 1fad3d6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "swift/Basic/Dwarf.h"
2626
#include "llvm/Object/ELFObjectFile.h"
2727
#include "swift/Basic/LLVMInitialize.h"
28+
#include "llvm/Object/COFF.h"
2829
#include "llvm/Object/MachO.h"
2930
#include "llvm/Object/ObjectFile.h"
3031
#include "llvm/Support/CommandLine.h"
@@ -133,6 +134,7 @@ collectASTModules(llvm::cl::list<std::string> &InputNames,
133134
auto *Obj = OF->getBinary();
134135
auto *MachO = llvm::dyn_cast<llvm::object::MachOObjectFile>(Obj);
135136
auto *ELF = llvm::dyn_cast<llvm::object::ELFObjectFileBase>(Obj);
137+
auto *COFF = llvm::dyn_cast<llvm::object::COFFObjectFile>(Obj);
136138

137139
if (MachO) {
138140
for (auto &Symbol : Obj->symbols()) {
@@ -164,7 +166,8 @@ collectASTModules(llvm::cl::list<std::string> &InputNames,
164166
llvm::StringRef Name;
165167
Section.getName(Name);
166168
if ((MachO && Name == swift::MachOASTSectionName) ||
167-
(ELF && Name == swift::ELFASTSectionName)) {
169+
(ELF && Name == swift::ELFASTSectionName) ||
170+
(COFF && Name == swift::COFFASTSectionName)) {
168171
uint64_t Size = Section.getSize();
169172
StringRef ContentsReference;
170173
Section.getContents(ContentsReference);

0 commit comments

Comments
 (0)