[lld] 519b369 - [LLD][COFF][NFC] Store impSym as DefinedImportData in ImportFile. (#107162)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 02:49:53 PDT 2024
Author: Jacek Caban
Date: 2024-09-04T11:49:50+02:00
New Revision: 519b36925cf2e1a59f76bd509471d2e1830169f0
URL: https://github.com/llvm/llvm-project/commit/519b36925cf2e1a59f76bd509471d2e1830169f0
DIFF: https://github.com/llvm/llvm-project/commit/519b36925cf2e1a59f76bd509471d2e1830169f0.diff
LOG: [LLD][COFF][NFC] Store impSym as DefinedImportData in ImportFile. (#107162)
Added:
Modified:
lld/COFF/InputFiles.cpp
lld/COFF/InputFiles.h
lld/COFF/SymbolTable.cpp
lld/COFF/SymbolTable.h
Removed:
################################################################################
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index e1ea4ebeabc9b8..50bc62312a6f87 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -1059,8 +1059,7 @@ void ImportFile::parse() {
// address pointed by the __imp_ symbol. (This allows you to call
// DLL functions just like regular non-DLL functions.)
if (hdr->getType() == llvm::COFF::IMPORT_CODE)
- thunkSym = ctx.symtab.addImportThunk(
- name, cast_or_null<DefinedImportData>(impSym), hdr->Machine);
+ thunkSym = ctx.symtab.addImportThunk(name, impSym, hdr->Machine);
}
BitcodeFile::BitcodeFile(COFFLinkerContext &ctx, MemoryBufferRef mb,
diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index a332ac87b265e6..8b3303a8d87f45 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -346,7 +346,7 @@ class ImportFile : public InputFile {
static bool classof(const InputFile *f) { return f->kind() == ImportKind; }
MachineTypes getMachineType() const override;
- Symbol *impSym = nullptr;
+ DefinedImportData *impSym = nullptr;
Symbol *thunkSym = nullptr;
std::string dllName;
diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp
index a5f155bc05bc9e..bb7583bb9a7df4 100644
--- a/lld/COFF/SymbolTable.cpp
+++ b/lld/COFF/SymbolTable.cpp
@@ -771,12 +771,12 @@ Symbol *SymbolTable::addCommon(InputFile *f, StringRef n, uint64_t size,
return s;
}
-Symbol *SymbolTable::addImportData(StringRef n, ImportFile *f) {
+DefinedImportData *SymbolTable::addImportData(StringRef n, ImportFile *f) {
auto [s, wasInserted] = insert(n, nullptr);
s->isUsedInRegularObj = true;
if (wasInserted || isa<Undefined>(s) || s->isLazy()) {
replaceSymbol<DefinedImportData>(s, n, f);
- return s;
+ return cast<DefinedImportData>(s);
}
reportDuplicate(s, f);
diff --git a/lld/COFF/SymbolTable.h b/lld/COFF/SymbolTable.h
index b5f95d2ad7f112..51c6c79ec14463 100644
--- a/lld/COFF/SymbolTable.h
+++ b/lld/COFF/SymbolTable.h
@@ -102,7 +102,7 @@ class SymbolTable {
Symbol *addCommon(InputFile *f, StringRef n, uint64_t size,
const llvm::object::coff_symbol_generic *s = nullptr,
CommonChunk *c = nullptr);
- Symbol *addImportData(StringRef n, ImportFile *f);
+ DefinedImportData *addImportData(StringRef n, ImportFile *f);
Symbol *addImportThunk(StringRef name, DefinedImportData *s,
uint16_t machine);
void addLibcall(StringRef name);
More information about the llvm-commits
mailing list