RecursiveASTVisitor is very expensive to instantiate and results in
needlessly slow compilation. For these availability check fixits, we
don't need to instantiate the full complexity of the declaration walking
machinery, we can use a plain StmtVisitor.
This change reduces time to compile SemaDeclAttr.cpp and saves object
file size:
before | after | |
time (s) | 1m7.821s | 0m52.459s |
obj (kb) | 13280 | 11364 |
So, 15s and 1.9 MB of object file. If clang had presubmits checks, I'd
add a check that warned on new inclusions of RecursiveASTVisitor.h. =/
I won't promise that this doesn't change functionality, since RAV walks
through quite a number of things that StmtVisitor doesn't, like blocks
and lambdas.
I noticed that SemaOpenMP has a very similar utility called
LocalVarRefChecker, so there is definitely some opportunity for
refactoring further after this.