Flow is the same, but a bit shorter after this change.
llvm-svn: 337183
return None;
}
-// Returns source line information for a given offset using DWARF debug info.
-template <class ELFT>
-std::string ObjFile<ELFT>::getLineInfo(InputSectionBase *S, uint64_t Offset) {
- if (Optional<DILineInfo> Info = getDILineInfo(S, Offset))
- return Info->FileName + ":" + std::to_string(Info->Line);
- return "";
-}
-
// Returns "<internal>", "foo.a(bar.o)" or "baz.o".
std::string lld::toString(const InputFile *F) {
if (!F)
return getSymbol(SymIndex);
}
- // Returns source line information for a given offset.
- // If no information is available, returns "".
- std::string getLineInfo(InputSectionBase *S, uint64_t Offset);
llvm::Optional<llvm::DILineInfo> getDILineInfo(InputSectionBase *, uint64_t);
llvm::Optional<std::pair<std::string, unsigned>> getVariableLoc(StringRef Name);
.str();
// First check if we can get desired values from debugging information.
- std::string LineInfo = getFile<ELFT>()->getLineInfo(this, Offset);
- if (!LineInfo.empty())
- return LineInfo;
+ if (Optional<DILineInfo> Info = getFile<ELFT>()->getDILineInfo(this, Offset))
+ return Info->FileName + ":" + std::to_string(Info->Line);
// File->SourceFile contains STT_FILE symbol that contains a
// source file name. If it's missing, we use an object file name.