From 9a5c448a31bacc08e73fcae4636094f9b6e2be6a Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Wed, 29 Jan 2020 02:01:42 +0100 Subject: [PATCH] [clangd] Fix null check in FindTarget. I've hit this stack trace a few times but don't have a good reproducer. The code is unsafe by inspection, though. --- clang-tools-extra/clangd/FindTarget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp index 2392586..13e4819 100644 --- a/clang-tools-extra/clangd/FindTarget.cpp +++ b/clang-tools-extra/clangd/FindTarget.cpp @@ -231,7 +231,7 @@ public: } void add(const Decl *Dcl, RelSet Flags) { - const NamedDecl *D = llvm::dyn_cast(Dcl); + const NamedDecl *D = llvm::dyn_cast_or_null(Dcl); if (!D) return; debug(*D, Flags); -- 2.7.4