llvm-project/clang/unittests
Stephen Kelly 19740652c4 [AST] Add generator for source location introspection
Generate a json file containing descriptions of AST classes and their
public accessors which return SourceLocation or SourceRange.

Use the JSON file to generate a C++ API and implementation for accessing
the source locations and method names for accessing them for a given AST
node.

This new API can be used to implement 'srcloc' output in clang-query:

  http://ce.steveire.com/z/m_kTIo

The JSON file can also be used to generate bindings for other languages,
such as Python and Javascript:

  https://steveire.wordpress.com/2019/04/30/the-future-of-ast-matching

In this first version of this feature, only the accessors for Stmt
classes are generated, not Decls, TypeLocs etc.  Those can be added
after this change is reviewed, as this change is mostly about
infrastructure of these code generators.

Also in this version, the platforms/cmake configurations are excluded as
much as possible so that support can be added iteratively.  Currently a
break on any platform causes a revert of the entire feature.  This way,
the `OR WIN32` can be removed in a future commit and if it breaks the
buildbots, only that commit gets reverted, making the entire process
easier to manage.

Differential Revision: https://reviews.llvm.org/D93164
2021-03-15 10:52:44 +00:00
..
AST [clang][DeclPrinter] Pass Context into StmtPrinter whenever possible 2021-02-23 09:42:19 +01:00
ASTMatchers Revert "Revert "Revert "Implement nullPointerConstant() using a better API.""" 2021-02-22 14:37:03 +01:00
Analysis [analyzer] Introduce MacroExpansionContext to libAnalysis 2021-02-22 11:11:57 +01:00
Basic [clang][cli] Generate and round-trip language options 2021-02-09 10:18:55 +01:00
CodeGen Reland "Move the test compiler setup in a common place. NFCI" 2020-11-16 13:22:10 +00:00
CrossTU [analyzer][CTU] API for CTU macro expansions 2021-02-22 11:12:22 +01:00
DirectoryWatcher [DirectoryWatcher] Increase timeout to make test less flaky 2021-03-05 17:49:14 -08:00
Driver [Driver][test] Fix ClangDriverTest 2021-03-04 22:44:37 -08:00
Format clang-format: use `pb` as a canonical raw string delimiter for google style 2021-03-09 09:07:14 +01:00
Frontend [clang][modules] Use extensible RTTI for ModuleFileExtension 2021-03-05 11:11:05 +01:00
Index [clang] Do not consider the template arguments of bases to be bases themselves 2020-09-01 19:18:03 -04:00
Introspection [AST] Add generator for source location introspection 2021-03-15 10:52:44 +00:00
Lex [clang] Make sure argument expansion locations are correct in presence of predefined buffer 2020-04-22 21:01:52 +02:00
Rename [OpenMP] "UnFix" layering problem with FrontendOpenMP 2020-04-07 14:41:18 -05:00
Rewrite [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug 2019-08-15 21:17:48 +00:00
Sema [clang][CodeComplete] Fix crash on ParenListExprs 2021-02-08 13:16:49 +01:00
Serialization Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
StaticAnalyzer [Analyzer] Fix for `ExprEngine::computeObjectUnderConstruction()` for base and delegating consturctor initializers 2020-09-25 13:28:22 +02:00
Tooling [clang] Mark re-injected tokens appropriately during pragma handling 2021-03-12 18:18:17 +01:00
libclang [libclang] Add CXRewriter to libclang API 2020-09-04 14:17:03 -07:00
CMakeLists.txt [AST] Add generator for source location introspection 2021-03-15 10:52:44 +00:00