Skip to content

Commit 2378a6e

Browse files
sam-mccallhokein
authored andcommitted
[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 9a5c448)
1 parent a634a80 commit 2378a6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang-tools-extra/clangd/FindTarget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ struct TargetFinder {
229229
}
230230

231231
void add(const Decl *Dcl, RelSet Flags) {
232-
const NamedDecl *D = llvm::dyn_cast<NamedDecl>(Dcl);
232+
const NamedDecl *D = llvm::dyn_cast_or_null<NamedDecl>(Dcl);
233233
if (!D)
234234
return;
235235
debug(*D, Flags);

0 commit comments

Comments
 (0)