mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 19:49:36 +00:00
[ELF] - Eliminate ObjFile<ELFT>::getLineInfo. NFC.
Flow is the same, but a bit shorter after this change. llvm-svn: 337183
This commit is contained in:
parent
e420cd8d05
commit
484aabc818
@ -221,14 +221,6 @@ Optional<DILineInfo> ObjFile<ELFT>::getDILineInfo(InputSectionBase *S,
|
||||
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)
|
||||
|
@ -194,9 +194,6 @@ public:
|
||||
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);
|
||||
|
||||
|
@ -221,9 +221,8 @@ std::string InputSectionBase::getLocation(uint64_t Offset) {
|
||||
.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.
|
||||
|
Loading…
Reference in New Issue
Block a user