[all-commits] [llvm/llvm-project] 77f7d2: [AST] Add generator for source location introspection

Stephen Kelly via All-commits all-commits at lists.llvm.org
Sun Mar 14 03:55:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77f7d2be214a1de29d583c75739f563593991fc3
      https://github.com/llvm/llvm-project/commit/77f7d2be214a1de29d583c75739f563593991fc3
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-03-14 (Sun, 14 Mar 2021)

  Changed paths:
    A clang/include/clang/Tooling/NodeIntrospection.h
    M clang/lib/Tooling/CMakeLists.txt
    A clang/lib/Tooling/DumpTool/APIData.h
    A clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
    A clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.h
    A clang/lib/Tooling/DumpTool/CMakeLists.txt
    A clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
    A clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
    A clang/lib/Tooling/NodeIntrospection.cpp
    M clang/unittests/CMakeLists.txt
    A clang/unittests/Introspection/CMakeLists.txt
    A clang/unittests/Introspection/IntrospectionTest.cpp

  Log Message:
  -----------
  [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

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.

Differential Revision: https://reviews.llvm.org/D93164




More information about the All-commits mailing list