clang 22.0.0git
RewriteRule.cpp File Reference
#include "clang/Tooling/Transformer/RewriteRule.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Stmt.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Tooling/Transformer/SourceCode.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include <map>
#include <string>
#include <utility>
#include <vector>

Go to the source code of this file.

Functions

static Expected< SmallVector< transformer::Edit, 1 > > translateEdits (const MatchResult &Result, ArrayRef< ASTEdit > ASTEdits)
static TextGenerator makeText (std::string S)
static std::string formatHeaderPath (StringRef Header, IncludeFormat Format)
template<typename T>
llvm::Expected< SmallVector< clang::transformer::Edit, 1 > > rewriteDescendantsImpl (const T &Node, RewriteRule Rule, const MatchResult &Result)
static bool hasValidKind (const DynTypedMatcher &M)
static std::vector< DynTypedMatcher > taggedMatchers (StringRef TagBase, const SmallVectorImpl< std::pair< size_t, RewriteRule::Case > > &Cases, TraversalKind DefaultTraversalKind)

Function Documentation

◆ formatHeaderPath()

std::string formatHeaderPath ( StringRef Header,
IncludeFormat Format )
static

◆ hasValidKind()

bool hasValidKind ( const DynTypedMatcher & M)
static

Definition at line 368 of file RewriteRule.cpp.

Referenced by clang::transformer::detail::buildMatchers().

◆ makeText()

TextGenerator makeText ( std::string S)
static

Definition at line 157 of file RewriteRule.cpp.

Referenced by clang::transformer::addInclude(), and clang::transformer::remove().

◆ rewriteDescendantsImpl()

template<typename T>
llvm::Expected< SmallVector< clang::transformer::Edit, 1 > > rewriteDescendantsImpl ( const T & Node,
RewriteRule Rule,
const MatchResult & Result )

Definition at line 299 of file RewriteRule.cpp.

References clang::ast_matchers::MatchFinder::match(), and clang::T.

◆ taggedMatchers()

std::vector< DynTypedMatcher > taggedMatchers ( StringRef TagBase,
const SmallVectorImpl< std::pair< size_t, RewriteRule::Case > > & Cases,
TraversalKind DefaultTraversalKind )
static

Definition at line 377 of file RewriteRule.cpp.

Referenced by clang::transformer::detail::buildMatchers().

◆ translateEdits()

Expected< SmallVector< transformer::Edit, 1 > > translateEdits ( const MatchResult & Result,
ArrayRef< ASTEdit > ASTEdits )
static