clang 8.0.0

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::ConversionFixItGenerator Struct Reference

The class facilities generation and storage of conversion FixIts. More...

`#include "clang/Sema/SemaFixItUtils.h"`

Collaboration diagram for clang::ConversionFixItGenerator:
[legend]

## Public Types
typedef bool(* | TypeComparisonFuncTy) (const CanQualType FromTy, const CanQualType ToTy, Sema &S, SourceLocation Loc, ExprValueKind FromVK)

## Public Member Functions
| ConversionFixItGenerator (TypeComparisonFuncTy Foo)
| ConversionFixItGenerator ()
void | setConversionChecker (TypeComparisonFuncTy Foo)
| Resets the default conversion checker method. More...
bool | tryToFixConversion (const Expr *FromExpr, const QualType FromQTy, const QualType ToQTy, Sema &S)
| If possible, generates and stores a fix for the given conversion. More...
void | clear ()
bool | isNull ()

## Static Public Member Functions
static bool | compareTypesSimple (CanQualType From, CanQualType To, Sema &S, SourceLocation Loc, ExprValueKind FromVK)
| Performs a simple check to see if From type can be converted to To type. More...

## Public Attributes
std::vector< FixItHint > | Hints
| The list of Hints generated so far. More...
unsigned | NumConversionsFixed
| The number of Conversions fixed. More...
OverloadFixItKind | Kind
| The type of fix applied. More...
TypeComparisonFuncTy | CompareTypes
| The type comparison function used to decide if expression FromExpr of type FromTy can be converted to ToTy. More...

## Detailed 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.

Definition at line 33 of file SemaFixItUtils.h.

## Member Typedef Documentation

## ◆ TypeComparisonFuncTy

typedef bool(* clang::ConversionFixItGenerator::TypeComparisonFuncTy) (const CanQualType FromTy, const CanQualType ToTy, Sema &S, SourceLocation Loc, ExprValueKind FromVK)

Definition at line 52 of file SemaFixItUtils.h.

## Constructor & Destructor Documentation

## ◆ ConversionFixItGenerator() [1/2]

clang::ConversionFixItGenerator::ConversionFixItGenerator | ( | TypeComparisonFuncTy | Foo | ) |
| inline

Definition at line 62 of file SemaFixItUtils.h.

## ◆ ConversionFixItGenerator() [2/2]

clang::ConversionFixItGenerator::ConversionFixItGenerator | ( |  | ) |
| inline

Definition at line 66 of file SemaFixItUtils.h.

## Member Function Documentation

## ◆ clear()

void clang::ConversionFixItGenerator::clear | ( |  | ) |
| inline

Definition at line 80 of file SemaFixItUtils.h.

## ◆ compareTypesSimple()

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

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

Definition at line 23 of file SemaFixItUtils.cpp.

## ◆ isNull()

bool clang::ConversionFixItGenerator::isNull | ( |  | ) |
| inline

Definition at line 85 of file SemaFixItUtils.h.

## ◆ setConversionChecker()

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

Resets the default conversion checker method.

Definition at line 71 of file SemaFixItUtils.h.

References tryToFixConversion().

## ◆ tryToFixConversion()

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

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

Definition at line 51 of file SemaFixItUtils.cpp.

Referenced by clang::Sema::DiagnoseAssignmentResult(), and setConversionChecker().

## Member Data Documentation

## ◆ CompareTypes

TypeComparisonFuncTy clang::ConversionFixItGenerator::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.

Definition at line 60 of file SemaFixItUtils.h.

## ◆ Hints

std::vector<FixItHint> clang::ConversionFixItGenerator::Hints

The list of Hints generated so far.

Definition at line 42 of file SemaFixItUtils.h.

## ◆ Kind

OverloadFixItKind clang::ConversionFixItGenerator::Kind

The type of fix applied.

If multiple conversions are fixed, corresponds to the kid of the very first conversion.

Definition at line 50 of file SemaFixItUtils.h.

## ◆ NumConversionsFixed

unsigned clang::ConversionFixItGenerator::NumConversionsFixed

The number of Conversions fixed.

This can be different from the size of the Hints vector since we allow multiple FixIts per conversion.

Definition at line 46 of file SemaFixItUtils.h.

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

- include/clang/Sema/SemaFixItUtils.h
- lib/Sema/SemaFixItUtils.cpp