class ReplaceNodeWithTemplate

Declaration

class ReplaceNodeWithTemplate : public RefactoringCallback { /* full declaration omitted */ };

Description

Replace the text of an AST node bound to \c FromId with the result of evaluating the template in \c ToTemplate. Expressions of the form ${NodeName} in \c ToTemplate will be replaced by the text of the node bound to ${NodeName}. The string "$$" will be replaced by "$".

Declared at: clang/include/clang/Tooling/RefactoringCallbacks.h:94

Inherits from: RefactoringCallback

Member Variables

private std::string FromId
private std::vector<TemplateElement> Template

Inherited from RefactoringCallback:

protected Replace

Method Overview

  • private ReplaceNodeWithTemplate(llvm::StringRef FromId, std::vector<TemplateElement> Template)
  • public static llvm::Expected<std::unique_ptr<ReplaceNodeWithTemplate>> create(llvm::StringRef FromId, llvm::StringRef ToTemplate)
  • public void run(const ast_matchers::MatchFinder::MatchResult & Result)

Inherited from RefactoringCallback:

Inherited from MatchFinder::MatchCallback:

Methods

ReplaceNodeWithTemplate(
    llvm::StringRef FromId,
    std::vector<TemplateElement> Template)

Declared at: clang/include/clang/Tooling/RefactoringCallbacks.h:105

Parameters

llvm::StringRef FromId
std::vector<TemplateElement> Template

static llvm::Expected<
    std::unique_ptr<ReplaceNodeWithTemplate>>
create(llvm::StringRef FromId,
       llvm::StringRef ToTemplate)

Declared at: clang/include/clang/Tooling/RefactoringCallbacks.h:97

Parameters

llvm::StringRef FromId
llvm::StringRef ToTemplate

void run(
    const ast_matchers::MatchFinder::MatchResult&
        Result)

Description

Called on every match by the \c MatchFinder.

Declared at: clang/include/clang/Tooling/RefactoringCallbacks.h:98

Parameters

const ast_matchers::MatchFinder::MatchResult& Result