class RefactoringRuleContext

Declaration

class RefactoringRuleContext { /* full declaration omitted */ };

Description

The refactoring rule context stores all of the inputs that might be needed by a refactoring action rule. It can create the specialized\c ASTRefactoringOperation or \c 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.

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:33

Member Variables

private const clang::SourceManager& SM
The source manager for the translation unit / file on which a refactoring action might operate on.
private clang::SourceRange SelectionRange
An optional source selection range that's commonly used to represent a selection in an editor.
private clang::ASTContext* AST = nullptr
An optional AST for the translation unit on which a refactoring action might operate on.
private PartialDiagnostic::DiagStorageAllocator DiagStorage
The allocator for diagnostics.
private std::unique_ptr<SelectedASTNode> ASTNodeSelection

Method Overview

Methods

RefactoringRuleContext(
    const clang::SourceManager& SM)

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:35

Parameters

const clang::SourceManager& SM

llvm::Error createDiagnosticError(
    clang::SourceLocation Loc,
    unsigned int DiagID)

Description

Creates an llvm::Error value that contains a diagnostic. The errors should not outlive the context.

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:57

Parameters

clang::SourceLocation Loc
unsigned int DiagID

llvm::Error createDiagnosticError(
    unsigned int DiagID)

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:61

Parameters

unsigned int DiagID

clang::ASTContext& getASTContext() const

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:47

clang::SourceRange getSelectionRange() const

Description

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

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:41

const clang::SourceManager& getSources() const

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:37

bool hasASTContext() const

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:45

void setASTContext(clang::ASTContext& Context)

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:52

Parameters

clang::ASTContext& Context

void setASTSelection(
    std::unique_ptr<SelectedASTNode> Node)

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:65

Parameters

std::unique_ptr<SelectedASTNode> Node

void setSelectionRange(clang::SourceRange R)

Declared at: clang/include/clang/Tooling/Refactoring/RefactoringRuleContext.h:43

Parameters

clang::SourceRange R