Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 9452d6e

Browse files
committed
[LLVMSymbolize] Simplify SymbolizableObjectFile::symbolizeInlinedCode(). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251672 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 5f6abbd commit 9452d6e

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

include/llvm/DebugInfo/DIContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ class DIInliningInfo {
5757
assert(Index < Frames.size());
5858
return Frames[Index];
5959
}
60+
DILineInfo *getMutableFrame(unsigned Index) {
61+
assert(Index < Frames.size());
62+
return &Frames[Index];
63+
}
6064
uint32_t getNumberOfFrames() const {
6165
return Frames.size();
6266
}

lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,26 +217,18 @@ DIInliningInfo SymbolizableObjectFile::symbolizeInlinedCode(
217217
if (InlinedContext.getNumberOfFrames() == 0)
218218
InlinedContext.addFrame(DILineInfo());
219219

220-
if (FNKind != FunctionNameKind::LinkageName || !UseSymbolTable)
221-
return InlinedContext;
222-
223220
// Override the function name in lower frame with name from symbol table.
224-
// We can't directly change the last element of DIInliningInfo, so copy
225-
// all frames into new context, replacing function name in the last one.
226-
DIInliningInfo PatchedInlinedContext;
227-
for (uint32_t i = 0, n = InlinedContext.getNumberOfFrames(); i < n; i++) {
228-
DILineInfo LineInfo = InlinedContext.getFrame(i);
229-
if (i == n - 1) {
230-
std::string FunctionName;
231-
uint64_t Start, Size;
232-
if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
233-
FunctionName, Start, Size)) {
234-
LineInfo.FunctionName = FunctionName;
235-
}
221+
if (FNKind == FunctionNameKind::LinkageName && UseSymbolTable) {
222+
std::string FunctionName;
223+
uint64_t Start, Size;
224+
if (getNameFromSymbolTable(SymbolRef::ST_Function, ModuleOffset,
225+
FunctionName, Start, Size)) {
226+
InlinedContext.getMutableFrame(InlinedContext.getNumberOfFrames() - 1)
227+
->FunctionName = FunctionName;
236228
}
237-
PatchedInlinedContext.addFrame(LineInfo);
238229
}
239-
return PatchedInlinedContext;
230+
231+
return InlinedContext;
240232
}
241233

242234
DIGlobal SymbolizableObjectFile::symbolizeData(uint64_t ModuleOffset) const {

0 commit comments

Comments
 (0)