summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2020-01-29 02:01:42 +0100
committerHaojian Wu <hokein.wu@gmail.com>2020-06-10 10:28:44 +0200
commit2378a6e4f136d574c294da72f2dde0225ba05e89 (patch)
tree44dffef40acf13a86eb7fd49c17a9f35ff243cc4
parenta634a80615b1e012f1a61aa0cd1e2e67ef77d0bd (diff)
downloadbcm5719-llvm-2378a6e4f136d574c294da72f2dde0225ba05e89.tar.gz
bcm5719-llvm-2378a6e4f136d574c294da72f2dde0225ba05e89.zip
[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. (cherry picked from commit 9a5c448a31bacc08e73fcae4636094f9b6e2be6a)
-rw-r--r--clang-tools-extra/clangd/FindTarget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/FindTarget.cpp b/clang-tools-extra/clangd/FindTarget.cpp
index 82a2e8c27d5..71bb9d3d506 100644
--- a/clang-tools-extra/clangd/FindTarget.cpp
+++ b/clang-tools-extra/clangd/FindTarget.cpp
@@ -229,7 +229,7 @@ public:
}
void add(const Decl *Dcl, RelSet Flags) {
- const NamedDecl *D = llvm::dyn_cast<NamedDecl>(Dcl);
+ const NamedDecl *D = llvm::dyn_cast_or_null<NamedDecl>(Dcl);
if (!D)
return;
debug(*D, Flags);
OpenPOWER on IntegriCloud