[Lldb-commits] [PATCH] D57880: Add assert for 'bad' code path in GetUniqueNamespaceDeclaration

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 7 01:57:29 PST 2019


teemperor created this revision.
teemperor added a reviewer: shafik.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.

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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D57880

Files:
  source/Symbol/ClangASTContext.cpp


Index: source/Symbol/ClangASTContext.cpp
===================================================================
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -1941,7 +1941,8 @@
         assert(namespace_decl ==
                parent_namespace_decl->getAnonymousNamespace());
       } else {
-        // BAD!!!
+        assert(false && "GetUniqueNamespaceDeclaration called with no name and "
+                        "no namespace as decl_ctx");
       }
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57880.185724.patch
Type: text/x-patch
Size: 498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190207/e1a4268a/attachment.bin>


More information about the lldb-commits mailing list