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

Stephen Kelly via All-commits all-commits at lists.llvm.org
Wed Mar 10 14:39:12 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d627a27d264b47eda3f15f086ff419dfe053ebf7
      https://github.com/llvm/llvm-project/commit/d627a27d264b47eda3f15f086ff419dfe053ebf7
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-03-10 (Wed, 10 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