clang 20.0.0git
Static Public Member Functions | List of all members
clang::tooling::ExtractFunction Class Referencefinal

An "Extract Function" refactoring moves code into a new function that's then called from the place where the original code was. More...

#include "clang/Tooling/Refactoring/Extract/Extract.h"

Inheritance diagram for clang::tooling::ExtractFunction:
Inheritance graph
[legend]

Static Public Member Functions

static Expected< ExtractFunctioninitiate (RefactoringRuleContext &Context, CodeRangeASTSelection Code, std::optional< std::string > DeclName)
 Initiates the extract function refactoring operation.
 
static const RefactoringDescriptordescribe ()
 

Additional Inherited Members

- Public Member Functions inherited from clang::tooling::SourceChangeRefactoringRule
void invoke (RefactoringResultConsumer &Consumer, RefactoringRuleContext &Context) final
 Initiates and performs a specific refactoring action.
 
- Public Member Functions inherited from clang::tooling::RefactoringActionRuleBase
virtual ~RefactoringActionRuleBase ()
 
virtual void invoke (RefactoringResultConsumer &Consumer, RefactoringRuleContext &Context)=0
 Initiates and performs a specific refactoring action.
 

Detailed Description

An "Extract Function" refactoring moves code into a new function that's then called from the place where the original code was.

Definition at line 21 of file Extract.h.

Member Function Documentation

◆ describe()

const RefactoringDescriptor & clang::tooling::ExtractFunction::describe ( )
static

Definition at line 60 of file Extract.cpp.

◆ initiate()

Expected< ExtractFunction > clang::tooling::ExtractFunction::initiate ( RefactoringRuleContext Context,
CodeRangeASTSelection  Code,
std::optional< std::string >  DeclName 
)
static

Initiates the extract function refactoring operation.

Parameters
CodeThe selected set of statements.
DeclNameThe name of the extract function. If None, "extracted" is used.

Definition at line 70 of file Extract.cpp.

References clang::tooling::CodeRangeASTSelection::isInFunctionLikeBodyOfCode(), and clang::tooling::CodeRangeASTSelection::size().


The documentation for this class was generated from the following files: