Skip to content

[ELF] Improve comment of InputSection::file and update getFile. NFC #79550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
9 changes: 5 additions & 4 deletions lld/ELF/InputSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class InputSectionBase : public SectionBase {

static bool classof(const SectionBase *s) { return s->kind() != Output; }

// The file which contains this section. Its dynamic type is always
// ObjFile<ELFT>, but in order to avoid ELFT, we use InputFile as
// its static type.
// The file which contains this section. Its dynamic type is usually
// ObjFile<ELFT>, but may be an InputFile of InternalKind (for a synthetic
// section).
InputFile *file;

// Input sections are part of an output section. Special sections
Expand All @@ -132,8 +132,9 @@ class InputSectionBase : public SectionBase {
// Section index of the relocation section if exists.
uint32_t relSecIdx = 0;

// Getter when the dynamic type is ObjFile<ELFT>.
template <class ELFT> ObjFile<ELFT> *getFile() const {
return cast_or_null<ObjFile<ELFT>>(file);
return cast<ObjFile<ELFT>>(file);
}

// Used by --optimize-bb-jumps and RISC-V linker relaxation temporarily to
Expand Down