My Project
|
Classes | |
struct | AppliedConstraint |
class | AttrConstraint |
class | Attribute |
class | CombinedPred |
class | ConcatPred |
class | ConstantAttr |
class | Constraint |
class | CPred |
class | DagLeaf |
class | DagNode |
class | Dialect |
class | EnumAttr |
class | EnumAttrCase |
class | FmtContext |
class | FmtObject |
class | FmtObjectBase |
struct | FmtReplacement |
class | InterfaceOpTrait |
class | InternalOpTrait |
struct | NamedAttribute |
struct | NamedRegion |
struct | NamedTypeConstraint |
class | NativeOpTrait |
class | Operator |
class | OpInterface |
class | OpInterfaceMethod |
class | OpTrait |
class | Pattern |
class | Pred |
class | PredOpTrait |
class | Region |
class | StructAttr |
class | StructFieldAttr |
class | SubstLeavesPred |
class | SymbolInfoMap |
class | Type |
class | TypeConstraint |
Typedefs | |
using | Argument = llvm::PointerUnion< NamedAttribute *, NamedTypeConstraint * > |
using | RecordOperatorMap = DenseMap< const llvm::Record *, std::unique_ptr< Operator > > |
Functions | |
template<typename... Ts> | |
auto | tgfmt (StringRef fmt, const FmtContext *ctx, Ts &&... vals) -> FmtObject< decltype(std::make_tuple(llvm::detail::build_format_adapter(std::forward< Ts >(vals))...))> |
using mlir::tblgen::Argument = typedef llvm::PointerUnion<NamedAttribute *, NamedTypeConstraint *> |
using mlir::tblgen::RecordOperatorMap = typedef DenseMap<const llvm::Record *, std::unique_ptr<Operator> > |
|
inline |
Formats text by substituting placeholders in format string with replacement parameters.
There are two categories of placeholders accepted, both led by a '$' sign:
Replacement parameters for positional placeholders are supplied as the vals
parameter pack with 1:1 mapping. That is, $0 will be replaced by the first parameter in vals
, $1 by the second one, and so on. Note that you can use the positional placeholders in any order and repeat any times, for example, "$2 $1 $1 $0" is accepted.
Replacement parameters for special placeholders are supplied using the ctx
format context.
The fmt
is recorded as a StringRef
inside the returned FmtObject
. The caller needs to make sure the underlying data is available when the FmtObject
is used.
ctx
accepts a nullptr if there is no special placeholder is used.
If no substitution is provided for a placeholder or any error happens during format string parsing or replacement, the placeholder will be outputted as-is with an additional marker '<no-subst-found>', to aid debugging.
To print a '$' literally, escape it with '$$'.
This utility function is inspired by LLVM formatv(), with modifications specially tailored for TableGen C++ generation usage: