[PATCH] Assert that DebugLoc is valid

Davide Italiano dccitaliano at gmail.com
Sat May 2 18:29:58 PDT 2015


Hi dexonsmith,

Noticed when trying to fix PR23380.
I think it's better to assert than segfaulting one line below.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9464

Files:
  lib/IR/DiagnosticInfo.cpp

Index: lib/IR/DiagnosticInfo.cpp
===================================================================
--- lib/IR/DiagnosticInfo.cpp
+++ lib/IR/DiagnosticInfo.cpp
@@ -136,6 +136,7 @@
                                                  unsigned *Line,
                                                  unsigned *Column) const {
   DILocation *L = getDebugLoc();
+  assert(L != nullptr && "debug location is invalid");
   *Filename = L->getFilename();
   *Line = L->getLine();
   *Column = L->getColumn();

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9464.24864.patch
Type: text/x-patch
Size: 500 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150503/37bf9760/attachment.bin>


More information about the llvm-commits mailing list