mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 06:29:05 +00:00
[SanitizerCoverage] Use llvm::getDISubprogram() to get location of the entry basic block.
DebugLoc::getFnDebugLoc() should soon be removed. Also, getDISubprogram() might become more effective soon and wouldn't need to scan debug locations at all, if function-level metadata would be emitted by Clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239586 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/IR/CallSite.h"
|
#include "llvm/IR/CallSite.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
|
#include "llvm/IR/DebugInfo.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
#include "llvm/IR/IRBuilder.h"
|
#include "llvm/IR/IRBuilder.h"
|
||||||
#include "llvm/IR/InlineAsm.h"
|
#include "llvm/IR/InlineAsm.h"
|
||||||
@@ -385,9 +386,14 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsEntryBB = &BB == &F.getEntryBlock();
|
bool IsEntryBB = &BB == &F.getEntryBlock();
|
||||||
DebugLoc EntryLoc = IsEntryBB && IP->getDebugLoc()
|
DebugLoc EntryLoc;
|
||||||
? IP->getDebugLoc().getFnDebugLoc()
|
if (IsEntryBB) {
|
||||||
: IP->getDebugLoc();
|
if (auto SP = getDISubprogram(&F))
|
||||||
|
EntryLoc = DebugLoc::get(SP->getScopeLine(), 0, SP);
|
||||||
|
} else {
|
||||||
|
EntryLoc = IP->getDebugLoc();
|
||||||
|
}
|
||||||
|
|
||||||
IRBuilder<> IRB(IP);
|
IRBuilder<> IRB(IP);
|
||||||
IRB.SetCurrentDebugLocation(EntryLoc);
|
IRB.SetCurrentDebugLocation(EntryLoc);
|
||||||
SmallVector<Value *, 1> Indices;
|
SmallVector<Value *, 1> Indices;
|
||||||
|
Reference in New Issue
Block a user