[Lldb-commits] [lldb] r365157 - Add assert for 'bad' code path in GetUniqueNamespaceDeclaration

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 4 12:49:31 PDT 2019

Author: teemperor
Date: Thu Jul  4 12:49:31 2019
New Revision: 365157

URL: http://llvm.org/viewvc/llvm-project?rev=365157&view=rev
Add assert for 'bad' code path in GetUniqueNamespaceDeclaration

If we call this function with a non-namespace as a second argument (and a nullptr name), we currently
only get a nullptr as a return when we hit the "Bad!!!" code path. This patch just adds an assert as this
seems to be a programming error in the calling code.

Reviewers: shafik

Subscribers: abidh, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D57880


Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=365157&r1=365156&r2=365157&view=diff
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Jul  4 12:49:31 2019
@@ -1954,7 +1954,8 @@ NamespaceDecl *ClangASTContext::GetUniqu
         assert(namespace_decl ==
       } else {
-        // BAD!!!
+        assert(false && "GetUniqueNamespaceDeclaration called with no name and "
+                        "no namespace as decl_ctx");

More information about the lldb-commits mailing list