struct ConversionFixItGenerator

Declaration

struct ConversionFixItGenerator { /* full declaration omitted */ };

Description

The class facilities generation and storage of conversion FixIts. Hints for new conversions are added using TryToFixConversion method. The default type conversion checker can be reset.

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:32

Member Variables

public std::vector<FixItHint> Hints
The list of Hints generated so far.
public unsigned int NumConversionsFixed
The number of Conversions fixed. This can be different from the size of the Hints vector since we allow multiple FixIts per conversion.
public clang::OverloadFixItKind Kind
The type of fix applied. If multiple conversions are fixed, corresponds to the kid of the very first conversion.
public clang::ConversionFixItGenerator:: TypeComparisonFuncTy CompareTypes
The type comparison function used to decide if expression FromExpr of type FromTy can be converted to ToTy. For example, one could check if an implicit conversion exists. Returns true if comparison exists.

Method Overview

Methods

ConversionFixItGenerator(
    clang::ConversionFixItGenerator::
        TypeComparisonFuncTy Foo)

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:61

Parameters

clang::ConversionFixItGenerator:: TypeComparisonFuncTy Foo

ConversionFixItGenerator()

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:65

void clear()

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:79

static bool compareTypesSimple(
    clang::CanQualType From,
    clang::CanQualType To,
    clang::Sema& S,
    clang::SourceLocation Loc,
    clang::ExprValueKind FromVK)

Description

Performs a simple check to see if From type can be converted to To type.

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:34

Parameters

clang::CanQualType From
clang::CanQualType To
clang::Sema& S
clang::SourceLocation Loc
clang::ExprValueKind FromVK

bool isNull()

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:84

void setConversionChecker(
    clang::ConversionFixItGenerator::
        TypeComparisonFuncTy Foo)

Description

Resets the default conversion checker method.

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:70

Parameters

clang::ConversionFixItGenerator:: TypeComparisonFuncTy Foo

bool tryToFixConversion(
    const clang::Expr* FromExpr,
    const clang::QualType FromQTy,
    const clang::QualType ToQTy,
    clang::Sema& S)

Description

If possible, generates and stores a fix for the given conversion.

Declared at: clang/include/clang/Sema/SemaFixItUtils.h:75

Parameters

const clang::Expr* FromExpr
const clang::QualType FromQTy
const clang::QualType ToQTy
clang::Sema& S