From de7e17f65a88b16b76f4060a9733ca6abc9d7627 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Mon, 4 May 2015 18:08:35 +0000 Subject: [PATCH] [IR/Diagnostic] Assert that DebugLoc is valid before accessing. 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/IR/DiagnosticInfo.cpp b/lib/IR/DiagnosticInfo.cpp index b161d07ac98..45be100ae05 100644 --- a/lib/IR/DiagnosticInfo.cpp +++ b/lib/IR/DiagnosticInfo.cpp @@ -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(); -- 2.34.1