hokein created this revision.
hokein added a reviewer: sammccall.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay, ioeric, 
ilya-biryukov, kristof.beyls, javed.absar.
Herald added a project: clang.

The assertion is triggered when the Decl is null. I didn't have a small
reproduce testcase, but this failure happened internally.

Details for the assertion:

F0207 09:55:09.069385   47308 logging.cc:84] assert.h assertion failed at 
llvm/include/llvm/Support/Casting.h:105 in static bool 
llvm::isa_impl_cl<clang::TranslationUnitDecl, const clang::      Decl 
*>::doit(const From *) [To = clang::TranslationUnitDecl, From = const 
clang::Decl *]: Val && "isa<> used on a null pointer"
 15 *** Check failure stack trace: ***
 19     @     0x55615c1f7e06  __assert_fail
 20     @     0x55615a6297d8  clang::clangd::(anonymous 
namespace)::SelectionVisitor::TraverseDecl()
 21     @     0x55615a62f48d  
clang::RecursiveASTVisitor<>::TraverseTemplateTemplateParmDecl()
 22     @     0x55615a62b264  clang::RecursiveASTVisitor<>::TraverseDecl()
 23     @     0x55615a62979c  clang::clangd::(anonymous 
namespace)::SelectionVisitor::TraverseDecl()
 24     @     0x55615a63060c  
clang::RecursiveASTVisitor<>::TraverseClassTemplatePartialSpecializationDecl()
 25     @     0x55615a62ae45  clang::RecursiveASTVisitor<>::TraverseDecl()


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D57879

Files:
  clangd/Selection.cpp


Index: clangd/Selection.cpp
===================================================================
--- clangd/Selection.cpp
+++ clangd/Selection.cpp
@@ -51,7 +51,7 @@
   //  - those that can't be stored in DynTypedNode.
   // We're missing some interesting things like Attr due to the latter.
   bool TraverseDecl(Decl *X) {
-    if (isa<TranslationUnitDecl>(X))
+    if (X && isa<TranslationUnitDecl>(X))
       return Base::TraverseDecl(X); // Already pushed by constructor.
     return traverseNode(X, [&] { return Base::TraverseDecl(X); });
   }


Index: clangd/Selection.cpp
===================================================================
--- clangd/Selection.cpp
+++ clangd/Selection.cpp
@@ -51,7 +51,7 @@
   //  - those that can't be stored in DynTypedNode.
   // We're missing some interesting things like Attr due to the latter.
   bool TraverseDecl(Decl *X) {
-    if (isa<TranslationUnitDecl>(X))
+    if (X && isa<TranslationUnitDecl>(X))
       return Base::TraverseDecl(X); // Already pushed by constructor.
     return traverseNode(X, [&] { return Base::TraverseDecl(X); });
   }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to