[clang] Fix a crash introduced by 3d5e9ab by adding a nullptr check. (PR #90301)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 27 14:44:49 PDT 2024
================
@@ -54,7 +54,7 @@ class UncountedCallArgsChecker
bool shouldVisitImplicitCode() const { return false; }
bool TraverseDecl(Decl *D) {
- if (isa<ClassTemplateDecl>(D) && isRefType(safeGetName(D)))
+ if (D && isa<ClassTemplateDecl>(D) && isRefType(safeGetName(D)))
return true;
return RecursiveASTVisitor<LocalVisitor>::TraverseDecl(D);
}
----------------
mizvekov wrote:
Shouldn't this be overriding `TraverseTemplateInstantiations(ClassTemplateDecl *D)` instead?
`RecursiveASTVisitor<LocalVisitor>::TraverseDecl` will ensure you won't be visiting null nodes.
https://github.com/llvm/llvm-project/pull/90301
More information about the cfe-commits
mailing list