[Lldb-commits] [lldb] r365247 - [lldb] Added assert to VerifyDecl

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 5 14:32:39 PDT 2019


Author: teemperor
Date: Fri Jul  5 14:32:39 2019
New Revision: 365247

URL: http://llvm.org/viewvc/llvm-project?rev=365247&view=rev
Log:
[lldb] Added assert to VerifyDecl

We could VerifyDecl sometimes with a nullptr. It would be nice if we
could get an actual assert here instead of triggering UB.

Modified:
    lldb/trunk/source/Symbol/VerifyDecl.cpp

Modified: lldb/trunk/source/Symbol/VerifyDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/VerifyDecl.cpp?rev=365247&r1=365246&r2=365247&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/VerifyDecl.cpp (original)
+++ lldb/trunk/source/Symbol/VerifyDecl.cpp Fri Jul  5 14:32:39 2019
@@ -9,4 +9,7 @@
 #include "lldb/Symbol/VerifyDecl.h"
 #include "clang/AST/DeclBase.h"
 
-void lldb_private::VerifyDecl(clang::Decl *decl) { decl->getAccess(); }
+void lldb_private::VerifyDecl(clang::Decl *decl) {
+  assert(decl && "VerifyDecl called with nullptr?");
+  decl->getAccess();
+}




More information about the lldb-commits mailing list