mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
[ASan] Use llvm::getDISubprogram() to get function entry debug location.
It can be more robust than copying debug info from first non-alloca instruction in the entry basic block. We use the same strategy in coverage instrumentation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240738 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2da1484e97
commit
863c0d000e
@ -1674,12 +1674,6 @@ void FunctionStackPoisoner::SetShadowToStackAfterReturnInlined(
|
||||
}
|
||||
}
|
||||
|
||||
static DebugLoc getFunctionEntryDebugLocation(Function &F) {
|
||||
for (const auto &Inst : F.getEntryBlock())
|
||||
if (!isa<AllocaInst>(Inst)) return Inst.getDebugLoc();
|
||||
return DebugLoc();
|
||||
}
|
||||
|
||||
PHINode *FunctionStackPoisoner::createPHI(IRBuilder<> &IRB, Value *Cond,
|
||||
Value *ValueIfTrue,
|
||||
Instruction *ThenTerm,
|
||||
@ -1732,7 +1726,9 @@ void FunctionStackPoisoner::poisonStack() {
|
||||
if (AllocaVec.size() == 0) return;
|
||||
|
||||
int StackMallocIdx = -1;
|
||||
DebugLoc EntryDebugLocation = getFunctionEntryDebugLocation(F);
|
||||
DebugLoc EntryDebugLocation;
|
||||
if (auto SP = getDISubprogram(&F))
|
||||
EntryDebugLocation = DebugLoc::get(SP->getScopeLine(), 0, SP);
|
||||
|
||||
Instruction *InsBefore = AllocaVec[0];
|
||||
IRBuilder<> IRB(InsBefore);
|
||||
|
Loading…
Reference in New Issue
Block a user