diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2020-07-03 17:01:01 +0200 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2020-07-06 13:38:01 +0200 |
commit | 5689b38c6a4220cc5f6ba68a56486229b10071bf (patch) | |
tree | 274ed449bc2a66c9e1077fa8b4c7adc4c2470fe4 /clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp | |
parent | 8e750b1f0a2b6b5174dc49adf20e6f863c28e3cd (diff) | |
download | llvm-5689b38c6a4220cc5f6ba68a56486229b10071bf.zip llvm-5689b38c6a4220cc5f6ba68a56486229b10071bf.tar.gz llvm-5689b38c6a4220cc5f6ba68a56486229b10071bf.tar.bz2 |
Removed a RecursiveASTVisitor feature to visit operator kinds with different methods
Summary:
This feature was only used in two places, but contributed a non-trivial
amount to the complexity of RecursiveASTVisitor, and was buggy (see my
recent patches where I was fixing the bugs that I noticed). I don't
think the convenience benefit of this feature is worth the complexity.
Besides complexity, another issue with the current state of
RecursiveASTVisitor is the non-uniformity in how it handles different
AST nodes. All AST nodes follow a regular pattern, but operators are
special -- and this special behavior not documented. Correct usage of
RecursiveASTVisitor relies on shadowing member functions with specific
names and signatures. Near misses don't cause any compile-time errors,
incorrectly named or typed methods are just silently ignored. Therefore,
predictability of RecursiveASTVisitor API is quite important.
This change reduces the size of the `clang` binary by 38 KB (0.2%) in
release mode, and by 7 MB (0.3%) in debug mode. The `clang-tidy` binary
is reduced by 205 KB (0.3%) in release mode, and by 5 MB (0.4%) in debug
mode. I don't think these code size improvements are significant enough
to justify this change on its own (for me, the primary motivation is
reducing code complexity), but they I think are a nice side-effect.
Reviewers: rsmith, sammccall, ymandel, aaron.ballman
Reviewed By: rsmith, sammccall, ymandel, aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82921
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp index 67f281b..56d4cce 100644 --- a/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp +++ b/clang-tools-extra/clang-tidy/modernize/LoopConvertUtils.cpp @@ -500,7 +500,7 @@ void ForLoopIndexUseVisitor::addUsage(const Usage &U) { /// int k = *i + 2; /// } /// \endcode -bool ForLoopIndexUseVisitor::TraverseUnaryDeref(UnaryOperator *Uop) { +bool ForLoopIndexUseVisitor::TraverseUnaryOperator(UnaryOperator *Uop) { // If we dereference an iterator that's actually a pointer, count the // occurrence. if (isDereferenceOfUop(Uop, IndexVar)) { |