From 14d8dbd37d06d880f010662613d501ec32c4c121 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 20 Mar 2015 18:48:45 +0000 Subject: [PATCH] SanitizerCoverage: Check for null DebugLocs After a WIP patch to make `DIDescriptor` accessors more strict, this started asserting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232832 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/SanitizerCoverage.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/lib/Transforms/Instrumentation/SanitizerCoverage.cpp index 9c74b5ea5c2..9f534e4f51d 100644 --- a/lib/Transforms/Instrumentation/SanitizerCoverage.cpp +++ b/lib/Transforms/Instrumentation/SanitizerCoverage.cpp @@ -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 Indices; -- 2.34.1