[PATCH] D56933: [Tooling][RFC] Introduce Stencil library to simplify source code generation in refactorings.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 13:40:38 PST 2019


ymandel created this revision.
Herald added subscribers: cfe-commits, jfb.

REQUEST FOR COMMENT: this is not intended (yet) as a proper revision. It complements the design document for Transformer:
https://docs.google.com/document/d/1ppw0RhjwsrbBcHYhI85pe6ISDbA6r5d00ot3N8cQWeQ/edit?usp=sharing

This revision introduces the Stencil library, which is designed to complement the AST matchers in support of writing source-to-source transformations. A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to node ids (bound in a corresponding matcher) and helper code-generation operations.  A stencil can be applied to a match result and uses that result to find all nodes referenced in the stencil and then produce a source string.

Stencil is part of the Transformer framework, but can also be used on its own, for example in a ClangTidy.  Please see the Transformer doc and the accompanying tests for example uses.


Repository:
  rC Clang

https://reviews.llvm.org/D56933

Files:
  clang/include/clang/Tooling/Refactoring/Stencil.h
  clang/lib/Tooling/Refactoring/Stencil.cpp
  clang/unittests/Tooling/StencilTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56933.182553.patch
Type: text/x-patch
Size: 53313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/e9433c4b/attachment-0001.bin>


More information about the cfe-commits mailing list