[llvm] r232832 - SanitizerCoverage: Check for null DebugLocs

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Mar 20 11:48:45 PDT 2015


Author: dexonsmith
Date: Fri Mar 20 13:48:45 2015
New Revision: 232832

URL: http://llvm.org/viewvc/llvm-project?rev=232832&view=rev
Log:
SanitizerCoverage: Check for null DebugLocs

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

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=232832&r1=232831&r2=232832&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Fri Mar 20 13:48:45 2015
@@ -329,8 +329,9 @@ void SanitizerCoverageModule::InjectCove
   }
 
   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;





More information about the llvm-commits mailing list