SanitizerCoverage: Check for null DebugLocs

After a WIP patch to make `DIDescriptor` accessors more strict, this
started asserting.

llvm-svn: 232832
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-20 18:48:45 +00:00
parent 90aa1a9653
commit 18c97fa2a0
1 changed files with 3 additions and 2 deletions

View File

@ -329,8 +329,9 @@ void SanitizerCoverageModule::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
}
bool IsEntryBB = &BB == &F.getEntryBlock();
DebugLoc EntryLoc =
IsEntryBB ? IP->getDebugLoc().getFnDebugLoc(*C) : IP->getDebugLoc();
DebugLoc EntryLoc = IsEntryBB && !IP->getDebugLoc().isUnknown()
? IP->getDebugLoc().getFnDebugLoc(*C)
: IP->getDebugLoc();
IRBuilder<> IRB(IP);
IRB.SetCurrentDebugLocation(EntryLoc);
SmallVector<Value *, 1> Indices;