forked from OSchip/llvm-project
![]() Tests that need ASTs have to deal with the awkward control flow of FrontendAction in some way. There are a few idioms used: - don't bother with unit tests, use clang -dump-ast - create an ASTConsumer by hand, which is bulky - use ASTMatchFinder - works pretty well if matchers are actually needed, very strange if they are not - use ASTUnit - this yields nice straight-line code, but ASTUnit is a terrifically complicated library not designed for this purpose TestAST provides a very simple way to write straight-line tests: specify the code/flags and it provides an AST that is kept alive until the object is destroyed. It's loosely modeled after TestTU in clangd, which we've successfully used for a variety of tests. I've updated a couple of clang tests to use this helper, IMO they're clearer. Differential Revision: https://reviews.llvm.org/D123668 |
||
---|---|---|
.. | ||
RecursiveASTVisitorTests | ||
Syntax | ||
ASTSelectionTest.cpp | ||
CMakeLists.txt | ||
CastExprTest.cpp | ||
CommentHandlerTest.cpp | ||
CompilationDatabaseTest.cpp | ||
DependencyScannerTest.cpp | ||
DiagnosticsYamlTest.cpp | ||
ExecutionTest.cpp | ||
FixItTest.cpp | ||
HeaderIncludesTest.cpp | ||
LexicallyOrderedRecursiveASTVisitorTest.cpp | ||
LookupTest.cpp | ||
QualTypeNamesTest.cpp | ||
RangeSelectorTest.cpp | ||
RecursiveASTVisitorTestDeclVisitor.cpp | ||
RecursiveASTVisitorTestPostOrderVisitor.cpp | ||
RecursiveASTVisitorTestTypeLocVisitor.cpp | ||
RefactoringActionRulesTest.cpp | ||
RefactoringCallbacksTest.cpp | ||
RefactoringTest.cpp | ||
ReplacementTest.h | ||
ReplacementsYamlTest.cpp | ||
RewriterTest.cpp | ||
RewriterTestContext.h | ||
SourceCodeBuildersTest.cpp | ||
SourceCodeTest.cpp | ||
StandardLibraryTest.cpp | ||
StencilTest.cpp | ||
TestVisitor.h | ||
ToolingTest.cpp | ||
TransformerTest.cpp |