File indexing completed on 2026-05-10 08:37:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef LLVM_CLANG_SEMA_SEMAFIXITUTILS_H
0013 #define LLVM_CLANG_SEMA_SEMAFIXITUTILS_H
0014
0015 #include "clang/AST/Expr.h"
0016
0017 namespace clang {
0018
0019 enum OverloadFixItKind {
0020 OFIK_Undefined = 0,
0021 OFIK_Dereference,
0022 OFIK_TakeAddress,
0023 OFIK_RemoveDereference,
0024 OFIK_RemoveTakeAddress
0025 };
0026
0027 class Sema;
0028
0029
0030
0031
0032 struct ConversionFixItGenerator {
0033
0034 static bool compareTypesSimple(CanQualType From,
0035 CanQualType To,
0036 Sema &S,
0037 SourceLocation Loc,
0038 ExprValueKind FromVK);
0039
0040
0041 std::vector<FixItHint> Hints;
0042
0043
0044
0045 unsigned NumConversionsFixed;
0046
0047
0048
0049 OverloadFixItKind Kind;
0050
0051 typedef bool (*TypeComparisonFuncTy) (const CanQualType FromTy,
0052 const CanQualType ToTy,
0053 Sema &S,
0054 SourceLocation Loc,
0055 ExprValueKind FromVK);
0056
0057
0058
0059 TypeComparisonFuncTy CompareTypes;
0060
0061 ConversionFixItGenerator(TypeComparisonFuncTy Foo): NumConversionsFixed(0),
0062 Kind(OFIK_Undefined),
0063 CompareTypes(Foo) {}
0064
0065 ConversionFixItGenerator(): NumConversionsFixed(0),
0066 Kind(OFIK_Undefined),
0067 CompareTypes(compareTypesSimple) {}
0068
0069
0070 void setConversionChecker(TypeComparisonFuncTy Foo) {
0071 CompareTypes = Foo;
0072 }
0073
0074
0075 bool tryToFixConversion(const Expr *FromExpr,
0076 const QualType FromQTy, const QualType ToQTy,
0077 Sema &S);
0078
0079 void clear() {
0080 Hints.clear();
0081 NumConversionsFixed = 0;
0082 }
0083
0084 bool isNull() {
0085 return (NumConversionsFixed == 0);
0086 }
0087 };
0088
0089 }
0090 #endif