diff options
| author | Amy Huang <akhuang@google.com> | 2019-06-20 17:15:21 +0000 | 
|---|---|---|
| committer | Amy Huang <akhuang@google.com> | 2019-06-20 17:15:21 +0000 | 
| commit | 7fac5c8d940c91e1e7b8b704186b4649170b029f (patch) | |
| tree | bf0d0c3cbafe46a0b6ddfa6873fbc6349d275dcb /llvm/lib | |
| parent | 01511192b23f531b8d378fa522d46647ce7b41a7 (diff) | |
| download | bcm5719-llvm-7fac5c8d940c91e1e7b8b704186b4649170b029f.tar.gz bcm5719-llvm-7fac5c8d940c91e1e7b8b704186b4649170b029f.zip  | |
Store a pointer to the return value in a static alloca and let the debugger use that
as the variable address for NRVO variables.
Subscribers: hiraditya, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D63361
llvm-svn: 363952
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 14 | 
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 33a69e8beb7..1590e29b744 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1142,9 +1142,15 @@ void CodeViewDebug::collectVariableInfoFromMFTable(      // If the variable has an attached offset expression, extract it.      // FIXME: Try to handle DW_OP_deref as well.      int64_t ExprOffset = 0; -    if (VI.Expr) -      if (!VI.Expr->extractIfOffset(ExprOffset)) +    bool Deref = false; +    if (VI.Expr) { +      // If there is one DW_OP_deref element, use offset of 0 and keep going. +      if (VI.Expr->getNumElements() == 1 && +          VI.Expr->getElement(0) == llvm::dwarf::DW_OP_deref) +        Deref = true; +      else if (!VI.Expr->extractIfOffset(ExprOffset))          continue; +    }      // Get the frame register used and the offset.      unsigned FrameReg = 0; @@ -1154,6 +1160,7 @@ void CodeViewDebug::collectVariableInfoFromMFTable(      // Calculate the label ranges.      LocalVarDefRange DefRange =          createDefRangeMem(CVReg, FrameOffset + ExprOffset); +      for (const InsnRange &Range : Scope->getRanges()) {        const MCSymbol *Begin = getLabelBeforeInsn(Range.first);        const MCSymbol *End = getLabelAfterInsn(Range.second); @@ -1164,6 +1171,9 @@ void CodeViewDebug::collectVariableInfoFromMFTable(      LocalVariable Var;      Var.DIVar = VI.Var;      Var.DefRanges.emplace_back(std::move(DefRange)); +    if (Deref) +      Var.UseReferenceType = true; +      recordLocalVariable(std::move(Var), Scope);    }  }  | 

