diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 3 | ||||
| -rw-r--r-- | llvm/lib/MC/MCCodeView.cpp | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h index 31da1b11fa4..e4bbd61d4ce 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h @@ -78,6 +78,9 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { SmallVector<LocalVariable, 1> InlinedLocals; SmallVector<const DILocation *, 1> ChildSites; const DISubprogram *Inlinee = nullptr; + + /// The ID of the inline site or function used with .cv_loc. Not a type + /// index. unsigned SiteFuncId = 0; }; diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp index d3f2aa2a80c..65cff41abeb 100644 --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -302,7 +302,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, StartLoc.setFileNum(Frag.StartFileId); StartLoc.setLine(Frag.StartLineNum); const MCCVLineEntry *LastLoc = &StartLoc; - bool WithinFunction = true; + bool HaveOpenRange = false; SmallVectorImpl<char> &Buffer = Frag.getContents(); Buffer.clear(); // Clear old contents if we went through relaxation. @@ -310,16 +310,22 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, if (!InlinedFuncIds.count(Loc.getFunctionId())) { // We've hit a cv_loc not attributed to this inline call site. Use this // label to end the PC range. - if (WithinFunction) { + if (HaveOpenRange) { unsigned Length = computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel()); compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer); compressAnnotation(Length, Buffer); } - WithinFunction = false; + HaveOpenRange = false; continue; } - WithinFunction = true; + + // If we've already opened the function and we're at an indirectly inlined + // location, continue until the next directly inlined location. + bool DirectlyInlined = Loc.getFunctionId() == Frag.SiteFuncId; + if (!DirectlyInlined && HaveOpenRange) + continue; + HaveOpenRange = true; if (Loc.getFileNum() != LastLoc->getFileNum()) { // File ids are 1 based, and each file checksum table entry is 8 bytes @@ -358,7 +364,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout, LastLoc = &Loc; } - assert(WithinFunction); + assert(HaveOpenRange); unsigned EndSymLength = computeLabelDiff(Layout, LastLoc->getLabel(), Frag.getFnEndSym()); |

