clang  10.0.0svn
Classes | Namespaces | Typedefs | Functions
Stencil.h File Reference

This file defines the Stencil abstraction: a code-generating object, parameterized by named references to (bound) AST nodes. More...

#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/Transformer/MatchConsumer.h"
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include <string>
#include <vector>
Include dependency graph for Stencil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  clang::transformer::StencilPartInterface
 A stencil is represented as a sequence of "parts" that can each individually generate a code string based on a match result. More...
 
class  clang::transformer::StencilPart
 A copyable facade for a std::unique_ptr<StencilPartInterface>. More...
 
class  clang::transformer::Stencil
 A sequence of code fragments, references to parameters and code-generation operations that together can be evaluated to (a fragment of) source code, given a match result. More...
 

Namespaces

 clang
 Dataflow Directional Tag Classes.
 
 clang::transformer
 
 clang::tooling
 
 clang::tooling::stencil
 

Typedefs

using clang::tooling::Stencil = transformer::Stencil
 
using clang::tooling::StencilPart = transformer::StencilPart
 

Functions

template<typename... Ts>
Stencil clang::transformer::cat (Ts &&... Parts)
 Convenience wrapper for Stencil::cat that can be imported with a using decl. More...
 
StencilPart clang::transformer::text (llvm::StringRef Text)
 
StencilPart clang::transformer::selection (RangeSelector Selector)
 
StencilPart clang::transformer::expression (llvm::StringRef Id)
 Generates the source of the expression bound to Id, wrapping it in parentheses if it may parse differently depending on context. More...
 
StencilPart clang::transformer::deref (llvm::StringRef ExprId)
 Constructs an idiomatic dereferencing of the expression bound to ExprId. More...
 
StencilPart clang::transformer::addressOf (llvm::StringRef ExprId)
 Constructs an expression that idiomatically takes the address of the expression bound to ExprId. More...
 
StencilPart clang::transformer::access (llvm::StringRef BaseId, StencilPart Member)
 Constructs a MemberExpr that accesses the named member (Member) of the object bound to BaseId. More...
 
StencilPart clang::transformer::access (llvm::StringRef BaseId, llvm::StringRef Member)
 
StencilPart clang::transformer::ifBound (llvm::StringRef Id, StencilPart TruePart, StencilPart FalsePart)
 Chooses between the two stencil parts, based on whether ID is bound in the match. More...
 
StencilPart clang::transformer::ifBound (llvm::StringRef Id, llvm::StringRef TrueText, llvm::StringRef FalseText)
 Chooses between the two strings, based on whether ID is bound in the match. More...
 
StencilPart clang::transformer::run (MatchConsumer< std::string > C)
 Wraps a MatchConsumer in a StencilPart, so that it can be used in a Stencil. More...
 
StencilPart clang::transformer::dPrint (llvm::StringRef Id)
 For debug use only; semantics are not guaranteed. More...
 
transformer::StencilPart clang::tooling::stencil::node (llvm::StringRef Id)
 

Detailed Description

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.

Definition in file Stencil.h.