clang 10.0.0git

Public Member Functions | List of all members
clang::tooling::RefactoringRuleContext Class Reference

The refactoring rule context stores all of the inputs that might be needed by a refactoring action rule. More...

`#include "clang/Tooling/Refactoring/RefactoringRuleContext.h"`

## Public Member Functions
| RefactoringRuleContext (const SourceManager &SM)
const SourceManager & | getSources () const
SourceRange | getSelectionRange () const
| Returns the current source selection range as set by the refactoring engine. More...
void | setSelectionRange (SourceRange R)
bool | hasASTContext () const
ASTContext & | getASTContext () const
void | setASTContext (ASTContext &Context)
llvm::Error | createDiagnosticError (SourceLocation Loc, unsigned DiagID)
| Creates an llvm::Error value that contains a diagnostic. More...
llvm::Error | createDiagnosticError (unsigned DiagID)
void | setASTSelection (std::unique_ptr< SelectedASTNode > Node)

## Detailed Description

The refactoring rule context stores all of the inputs that might be needed by a refactoring action rule.

It can create the specialized `ASTRefactoringOperation` or `PreprocessorRefactoringOperation` values that can be used by the refactoring action rules.

The following inputs are stored by the operation:

- SourceManager: a reference to a valid source manager.
- SelectionRange: an optional source selection ranges that can be used to represent a selection in an editor.

Definition at line 33 of file RefactoringRuleContext.h.

## Constructor & Destructor Documentation

## ◆ RefactoringRuleContext()

clang::tooling::RefactoringRuleContext::RefactoringRuleContext | ( | const SourceManager & | SM | ) |
| inline

Definition at line 35 of file RefactoringRuleContext.h.

## Member Function Documentation

## ◆ createDiagnosticError() [1/2]

llvm::Error clang::tooling::RefactoringRuleContext::createDiagnosticError | ( | SourceLocation | Loc,
|  | unsigned | DiagID
| ) |  |
| inline

Creates an llvm::Error value that contains a diagnostic.

The errors should not outlive the context.

Definition at line 57 of file RefactoringRuleContext.h.

References clang::DiagnosticError::create().

Referenced by createDiagnosticError(), and clang::tooling::RenameOccurrences::initiate().

## ◆ createDiagnosticError() [2/2]

llvm::Error clang::tooling::RefactoringRuleContext::createDiagnosticError | ( | unsigned | DiagID | ) |
| inline

Definition at line 61 of file RefactoringRuleContext.h.

References createDiagnosticError().

## ◆ getASTContext()

ASTContext& clang::tooling::RefactoringRuleContext::getASTContext | ( |  | ) | const
| inline

Definition at line 47 of file RefactoringRuleContext.h.

Referenced by clang::tooling::QualifiedRenameRule::describe(), clang::tooling::RenameOccurrences::initiate(), and clang::tooling::QualifiedRenameRule::initiate().

## ◆ getSelectionRange()

SourceRange clang::tooling::RefactoringRuleContext::getSelectionRange | ( |  | ) | const
| inline

Returns the current source selection range as set by the refactoring engine.

Can be invalid.

Definition at line 41 of file RefactoringRuleContext.h.

## ◆ getSources()

const SourceManager& clang::tooling::RefactoringRuleContext::getSources | ( |  | ) | const
| inline

Definition at line 37 of file RefactoringRuleContext.h.

## ◆ hasASTContext()

bool clang::tooling::RefactoringRuleContext::hasASTContext | ( |  | ) | const
| inline

Definition at line 45 of file RefactoringRuleContext.h.

## ◆ setASTContext()

void clang::tooling::RefactoringRuleContext::setASTContext | ( | ASTContext & | Context | ) |
| inline

Definition at line 52 of file RefactoringRuleContext.h.

## ◆ setASTSelection()

void clang::tooling::RefactoringRuleContext::setASTSelection | ( | std::unique_ptr< SelectedASTNode > | Node | ) |
| inline

Definition at line 65 of file RefactoringRuleContext.h.

## ◆ setSelectionRange()

void clang::tooling::RefactoringRuleContext::setSelectionRange | ( | SourceRange | R | ) |
| inline

Definition at line 43 of file RefactoringRuleContext.h.

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

- include/clang/Tooling/Refactoring/RefactoringRuleContext.h