[PATCH] D93164: [AST] Add generator for source location introspection

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 12 10:24:25 PST 2020


steveire created this revision.
steveire added reviewers: aaron.ballman, njames93.
Herald added a subscriber: mgorny.
steveire requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93164

Files:
  clang/lib/Tooling/CMakeLists.txt
  clang/lib/Tooling/DumpTool/APIData.h
  clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.cpp
  clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.h
  clang/lib/Tooling/DumpTool/CMakeLists.txt
  clang/lib/Tooling/DumpTool/ClangSrcLocDump.cpp
  clang/lib/Tooling/DumpTool/generate_cxx_src_locs.py
  clang/unittests/CMakeLists.txt
  clang/unittests/Introspection/CMakeLists.txt
  clang/unittests/Introspection/IntrospectionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93164.311397.patch
Type: text/x-patch
Size: 30664 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201212/87bd9a15/attachment-0001.bin>


More information about the cfe-commits mailing list