Skip to content

Commit 46e42d4

Browse files
committed
[LLD][COFF][NFC] Store impSym as DefinedImportData in ImportFile.
1 parent 0ef7b1d commit 46e42d4

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

lld/COFF/InputFiles.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,7 @@ void ImportFile::parse() {
10591059
// address pointed by the __imp_ symbol. (This allows you to call
10601060
// DLL functions just like regular non-DLL functions.)
10611061
if (hdr->getType() == llvm::COFF::IMPORT_CODE)
1062-
thunkSym = ctx.symtab.addImportThunk(
1063-
name, cast_or_null<DefinedImportData>(impSym), hdr->Machine);
1062+
thunkSym = ctx.symtab.addImportThunk(name, impSym, hdr->Machine);
10641063
}
10651064

10661065
BitcodeFile::BitcodeFile(COFFLinkerContext &ctx, MemoryBufferRef mb,

lld/COFF/InputFiles.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class ImportFile : public InputFile {
346346
static bool classof(const InputFile *f) { return f->kind() == ImportKind; }
347347
MachineTypes getMachineType() const override;
348348

349-
Symbol *impSym = nullptr;
349+
DefinedImportData *impSym = nullptr;
350350
Symbol *thunkSym = nullptr;
351351
std::string dllName;
352352

lld/COFF/SymbolTable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,12 @@ Symbol *SymbolTable::addCommon(InputFile *f, StringRef n, uint64_t size,
771771
return s;
772772
}
773773

774-
Symbol *SymbolTable::addImportData(StringRef n, ImportFile *f) {
774+
DefinedImportData *SymbolTable::addImportData(StringRef n, ImportFile *f) {
775775
auto [s, wasInserted] = insert(n, nullptr);
776776
s->isUsedInRegularObj = true;
777777
if (wasInserted || isa<Undefined>(s) || s->isLazy()) {
778778
replaceSymbol<DefinedImportData>(s, n, f);
779-
return s;
779+
return cast<DefinedImportData>(s);
780780
}
781781

782782
reportDuplicate(s, f);

lld/COFF/SymbolTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class SymbolTable {
102102
Symbol *addCommon(InputFile *f, StringRef n, uint64_t size,
103103
const llvm::object::coff_symbol_generic *s = nullptr,
104104
CommonChunk *c = nullptr);
105-
Symbol *addImportData(StringRef n, ImportFile *f);
105+
DefinedImportData *addImportData(StringRef n, ImportFile *f);
106106
Symbol *addImportThunk(StringRef name, DefinedImportData *s,
107107
uint16_t machine);
108108
void addLibcall(StringRef name);

0 commit comments

Comments
 (0)