llvm-project/clang/unittests/Tooling
Dmitri Gribenko 5689b38c6a 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
2020-07-06 13:38:01 +02:00
..
RecursiveASTVisitorTests Removed a RecursiveASTVisitor feature to visit operator kinds with different methods 2020-07-06 13:38:01 +02:00
Syntax Add parenthesized expression to SyntaxTree 2020-07-02 06:28:41 +00:00
ASTSelectionTest.cpp Use std::foo_t rather than std::foo in clang. 2020-02-11 10:37:08 -08:00
CMakeLists.txt Compile the RecursiveASTVisitor callbacks test with "/bigobj" 2020-06-29 17:04:45 +02:00
CastExprTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CommentHandlerTest.cpp [Tooling] Migrated APIs that take ownership of objects to unique_ptr 2019-08-30 09:29:34 +00:00
CompilationDatabaseTest.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
DependencyScannerTest.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
DiagnosticsYamlTest.cpp [clang-tidy] Add diagnostics level to YAML output 2020-06-15 07:40:53 -07:00
ExecutionTest.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
FixItTest.cpp [LibTooling] Add "SourceCode" library for functions relating to source-code manipulation. 2019-04-05 14:05:03 +00:00
HeaderIncludesTest.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
LexicallyOrderedRecursiveASTVisitorTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LookupTest.cpp Fix gcc "-Wdangling-else" warning. NFCI. 2019-04-30 10:57:37 +00:00
QualTypeNamesTest.cpp Renamed traverseDecl to TraverseDecl in a test 2020-01-17 17:12:23 +01:00
RangeSelectorTest.cpp [libTooling] Rename overloaded `range` range selector. 2020-06-26 14:23:25 +00:00
RecursiveASTVisitorTestDeclVisitor.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RecursiveASTVisitorTestPostOrderVisitor.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
RecursiveASTVisitorTestTypeLocVisitor.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RefactoringActionRulesTest.cpp [test] Delete trailing spaces from YAML tests 2019-07-12 05:59:28 +00:00
RefactoringCallbacksTest.cpp Set traversal explicitly where needed in tests 2020-05-21 22:34:38 +01:00
RefactoringTest.cpp Add Metadata to Transformer tooling 2020-06-30 15:03:07 +00:00
ReplacementTest.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ReplacementsYamlTest.cpp [test] Delete trailing spaces from YAML tests 2019-07-12 05:59:28 +00:00
RewriterTest.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RewriterTestContext.h Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
SourceCodeBuildersTest.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
SourceCodeTest.cpp [libTooling] Fix `maybeExtendRange` to support `CharRange`s. 2020-07-01 20:40:48 +00:00
StencilTest.cpp [libTooling] Improve error message from failure in selection Stencil 2020-06-26 16:17:28 +00:00
TestVisitor.h [Tooling] Migrated APIs that take ownership of objects to unique_ptr 2019-08-30 09:29:34 +00:00
ToolingTest.cpp Strip -showIncludes in getClangStripDependencyFileAdjuster() 2020-04-27 11:20:08 -07:00
TransformerTest.cpp Add Metadata to Transformer tooling 2020-06-30 15:03:07 +00:00