@@ -513,7 +513,7 @@ int64_t RelocationScanner::computeMipsAddend(const RelTy &rel, RelExpr expr,
513513// Custom error message if Sym is defined in a discarded section.
514514template <class ELFT >
515515static void maybeReportDiscarded (Ctx &ctx, ELFSyncStream &msg, Undefined &sym) {
516- auto *file = dyn_cast_or_null <ObjFile<ELFT>>(sym.file );
516+ auto *file = dyn_cast <ObjFile<ELFT>>(sym.file );
517517 if (!file || !sym.discardedSecIdx )
518518 return ;
519519 ArrayRef<typename ELFT::Shdr> objSections =
@@ -569,11 +569,11 @@ static const Symbol *getAlternativeSpelling(Ctx &ctx, const Undefined &sym,
569569 std::string &pre_hint,
570570 std::string &post_hint) {
571571 DenseMap<StringRef, const Symbol *> map;
572- if (sym.file && sym. file ->kind () == InputFile::ObjKind) {
572+ if (sym.file ->kind () == InputFile::ObjKind) {
573573 auto *file = cast<ELFFileBase>(sym.file );
574574 // If sym is a symbol defined in a discarded section, maybeReportDiscarded()
575575 // will give an error. Don't suggest an alternative spelling.
576- if (file && sym.discardedSecIdx != 0 &&
576+ if (sym.discardedSecIdx != 0 &&
577577 file->getSections ()[sym.discardedSecIdx ] == &InputSection::discarded)
578578 return nullptr ;
579579
@@ -743,9 +743,8 @@ static void reportUndefinedSymbol(Ctx &ctx, const UndefinedDiag &undef,
743743 std::string pre_hint = " : " , post_hint;
744744 if (const Symbol *corrected =
745745 getAlternativeSpelling (ctx, sym, pre_hint, post_hint)) {
746- msg << " \n >>> did you mean" << pre_hint << corrected << post_hint;
747- if (corrected->file )
748- msg << " \n >>> defined in: " << corrected->file ;
746+ msg << " \n >>> did you mean" << pre_hint << corrected << post_hint
747+ << " \n >>> defined in: " << corrected->file ;
749748 }
750749 }
751750
0 commit comments