return nullptr;
}
+DebugLoc llvm::getDebugValueLoc(DbgVariableIntrinsic *DII) {
+ // Original dbg.declare must have a location.
+ const DebugLoc &DeclareLoc = DII->getDebugLoc();
+ MDNode *Scope = DeclareLoc.getScope();
+ DILocation *InlinedAt = DeclareLoc.getInlinedAt();
+ // Because no machine insts can come from debug intrinsics, only the scope
+ // and inlinedAt is significant. Zero line numbers are used in case this
+ // DebugLoc leaks into any adjacent instructions. Produce an unknown location
+ // with the correct scope / inlinedAt fields.
+ return DILocation::get(DII->getContext(), 0, 0, Scope, InlinedAt);
+}
+
//===----------------------------------------------------------------------===//
// DebugInfoFinder implementations.
//===----------------------------------------------------------------------===//
return false;
}
-/// Produce a DebugLoc to use for each dbg.declare/inst pair that are promoted
-/// to a dbg.value. Because no machine insts can come from debug intrinsics,
-/// only the scope and inlinedAt is significant. Zero line numbers are used in
-/// case this DebugLoc leaks into any adjacent instructions.
-static DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII, Instruction *Src) {
- // Original dbg.declare must have a location.
- const DebugLoc &DeclareLoc = DII->getDebugLoc();
- MDNode *Scope = DeclareLoc.getScope();
- DILocation *InlinedAt = DeclareLoc.getInlinedAt();
- // Produce an unknown location with the correct scope / inlinedAt fields.
- return DILocation::get(DII->getContext(), 0, 0, Scope, InlinedAt);
-}
-
/// Inserts a llvm.dbg.value intrinsic before a store to an alloca'd value
/// that has an associated llvm.dbg.declare or llvm.dbg.addr intrinsic.
void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
auto *DIExpr = DII->getExpression();
Value *DV = SI->getValueOperand();
- DebugLoc NewLoc = getDebugValueLoc(DII, SI);
+ DebugLoc NewLoc = getDebugValueLoc(DII);
if (!valueCoversEntireFragment(DV->getType(), DII)) {
// FIXME: If storing to a part of the variable described by the dbg.declare,
return;
}
- DebugLoc NewLoc = getDebugValueLoc(DII, nullptr);
+ DebugLoc NewLoc = getDebugValueLoc(DII);
// We are now tracking the loaded value instead of the address. In the
// future if multi-location support is added to the IR, it might be
BasicBlock *BB = APN->getParent();
auto InsertionPt = BB->getFirstInsertionPt();
- DebugLoc NewLoc = getDebugValueLoc(DII, nullptr);
+ DebugLoc NewLoc = getDebugValueLoc(DII);
// The block may be a catchswitch block, which does not have a valid
// insertion point.
// pointer to the variable. Insert a *value* intrinsic that describes
// the variable by dereferencing the alloca.
if (!CI->isLifetimeStartOrEnd()) {
- DebugLoc NewLoc = getDebugValueLoc(DDI, nullptr);
+ DebugLoc NewLoc = getDebugValueLoc(DDI);
auto *DerefExpr =
DIExpression::append(DDI->getExpression(), dwarf::DW_OP_deref);
DIB.insertDbgValueIntrinsic(AI, DDI->getVariable(), DerefExpr,