Skip to content

Commit

Permalink
[ELF] De-template getAlternativeSpelling. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Jan 17, 2022
1 parent cc35161 commit b8d4eb8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lld/ELF/Relocations.cpp
Expand Up @@ -605,12 +605,12 @@ static bool canSuggestExternCForCXX(StringRef ref, StringRef def) {
// Suggest an alternative spelling of an "undefined symbol" diagnostic. Returns
// the suggested symbol, which is either in the symbol table, or in the same
// file of sym.
template <class ELFT>
static const Symbol *getAlternativeSpelling(const Undefined &sym,
std::string &pre_hint,
std::string &post_hint) {
DenseMap<StringRef, const Symbol *> map;
if (auto *file = dyn_cast_or_null<ObjFile<ELFT>>(sym.file)) {
if (sym.file && sym.file->kind() == InputFile::ObjKind) {
auto *file = cast<ELFFileBase>(sym.file);
// If sym is a symbol defined in a discarded section, maybeReportDiscarded()
// will give an error. Don't suggest an alternative spelling.
if (file && sym.discardedSecIdx != 0 &&
Expand Down Expand Up @@ -763,8 +763,8 @@ static void reportUndefinedSymbol(const UndefinedDiag &undef,

if (correctSpelling) {
std::string pre_hint = ": ", post_hint;
if (const Symbol *corrected = getAlternativeSpelling<ELFT>(
cast<Undefined>(sym), pre_hint, post_hint)) {
if (const Symbol *corrected =
getAlternativeSpelling(cast<Undefined>(sym), pre_hint, post_hint)) {
msg += "\n>>> did you mean" + pre_hint + toString(*corrected) + post_hint;
if (corrected->file)
msg += "\n>>> defined in: " + toString(corrected->file);
Expand Down

0 comments on commit b8d4eb8

Please sign in to comment.