[LibTooling] Add Stencil library for format-string style codegen.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 18 Apr 2019 17:23:01 +0000 (17:23 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Thu, 18 Apr 2019 17:23:01 +0000 (17:23 +0000)
commite955f8bac48ed7a5e287b4092f175e65f7c80aba
treef4983cc9542cc08de07116f839aaa1e318f5330c
parent549048f39006eb253f9c3bd13215643d3f95e100
[LibTooling] Add Stencil library for format-string style codegen.

Summary:
This file defines the *Stencil* abstraction: a code-generating object, parameterized by named references to (bound) AST nodes.  Given a match result, a stencil can be evaluated to a string of source code.

A stencil is similar in spirit to a format string: it is composed of a series of raw text strings, references to nodes (the parameters) and helper code-generation operations.

See thread on cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling" for background.

Reviewers: sbenza

Reviewed By: sbenza

Subscribers: ilya-biryukov, mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 358691
clang/include/clang/Tooling/Refactoring/Stencil.h [new file with mode: 0644]
clang/lib/Tooling/Refactoring/CMakeLists.txt
clang/lib/Tooling/Refactoring/Stencil.cpp [new file with mode: 0644]
clang/unittests/Tooling/CMakeLists.txt
clang/unittests/Tooling/StencilTest.cpp [new file with mode: 0644]