[IR/Diagnostic] Assert that DebugLoc is valid before accessing.
authorDavide Italiano <davide@freebsd.org>
Mon, 4 May 2015 18:08:35 +0000 (18:08 +0000)
committerDavide Italiano <davide@freebsd.org>
Mon, 4 May 2015 18:08:35 +0000 (18:08 +0000)
PR: 23380
Differential Revision: http://reviews.llvm.org/D9464
Reviewed by: dexonsmith

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236435 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/DiagnosticInfo.cpp

index b161d07ac9853f100276a6beedb45850cc65cf17..45be100ae0534621c263620816d5f1958bf7ca5f 100644 (file)
@@ -136,6 +136,7 @@ void DiagnosticInfoOptimizationBase::getLocation(StringRef *Filename,
                                                  unsigned *Line,
                                                  unsigned *Column) const {
   DILocation *L = getDebugLoc();
+  assert(L != nullptr && "debug location is invalid");
   *Filename = L->getFilename();
   *Line = L->getLine();
   *Column = L->getColumn();