mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-08 20:06:03 +03:00
DebugInfo: Use location of variable declaration instead of current stop point.
There might be no valid stop point but the variable should always have a location. This fixes an ICE compiling core.demangle.
This commit is contained in:
parent
227f16bcce
commit
95c897ab3e
2 changed files with 8 additions and 6 deletions
|
@ -73,7 +73,7 @@ ldc::DIScope ldc::DIBuilder::GetCurrentScope()
|
|||
return fn->diLexicalBlocks.top();
|
||||
}
|
||||
|
||||
void ldc::DIBuilder::Declare(llvm::Value *var, ldc::DILocalVariable divar
|
||||
void ldc::DIBuilder::Declare(const Loc &loc, llvm::Value *var, ldc::DILocalVariable divar
|
||||
#if LDC_LLVM_VER >= 306
|
||||
, ldc::DIExpression diexpr
|
||||
#endif
|
||||
|
@ -84,10 +84,12 @@ void ldc::DIBuilder::Declare(llvm::Value *var, ldc::DILocalVariable divar
|
|||
diexpr,
|
||||
#endif
|
||||
#if LDC_LLVM_VER >= 307
|
||||
IR->ir->getCurrentDebugLocation(),
|
||||
llvm::DebugLoc::get(loc.linnum, loc.charnum, GetCurrentScope()),
|
||||
#endif
|
||||
IR->scopebb());
|
||||
instr->setDebugLoc(IR->ir->getCurrentDebugLocation());
|
||||
#if LDC_LLVM_VER < 307
|
||||
instr->setDebugLoc(llvm::DebugLoc::get(loc.linnum, loc.charnum, GetCurrentScope()));
|
||||
#endif
|
||||
}
|
||||
|
||||
ldc::DIFile ldc::DIBuilder::CreateFile(Loc& loc)
|
||||
|
@ -932,9 +934,9 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
|
|||
|
||||
// declare
|
||||
#if LDC_LLVM_VER >= 306
|
||||
Declare(ll, debugVariable, addr.empty() ? DBuilder.createExpression() : DBuilder.createExpression(addr));
|
||||
Declare(vd->loc, ll, debugVariable, addr.empty() ? DBuilder.createExpression() : DBuilder.createExpression(addr));
|
||||
#else
|
||||
Declare(ll, debugVariable);
|
||||
Declare(vd->loc, ll, debugVariable);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue