[analyzer][NFC] Use DynamicRecursiveASTVisitor in two WebKit checkers (#246951)
RetainPtrCtorAdoptChecker and ForwardDeclChecker were the only checkers
in clang/lib/StaticAnalyzer still instantiating the CRTP
RecursiveASTVisitor. All the sibling WebKit checkers (RawPtrRef*,
NoDeleteChecker, RefCntblBaseVirtualDtorChecker, ...) already use
DynamicRecursiveASTVisitor, which is precompiled in clangAST and avoids
instantiating the full traversal in every user.
These two TUs were by far the most expensive in the analyzer. Converting
them to the same pattern as their siblings drops their compile cost from
~36.0G and ~34.6G to ~12.8G and ~11.6G retired instructions (release
with assertions, arm64, CMake PCH enabled, median of 3 runs):
RetainPtrCtorAdoptChecker.cpp -64%
ForwardDeclChecker.cpp -66%
which is about -1.8% of the total compile cost of all 196 static
analyzer translation units.
No functional change intended: the same Visit*/Traverse* hooks are
overridden with the same bodies, ShouldVisitTemplateInstantiations is
still true and ShouldVisitImplicitCode is still false.
Assisted-by: Claude Code