@@ -8103,12 +8103,12 @@ class ExprEvaluatorBase
81038103 }
81048104
81058105 bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E) {
8106- CCEDiag(E, diag::note_constexpr_invalid_cast) << 0 ;
8106+ CCEDiag(E, diag::note_constexpr_invalid_cast) << diag::CastKind::Reinterpret ;
81078107 return static_cast<Derived*>(this)->VisitCastExpr(E);
81088108 }
81098109 bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E) {
81108110 if (!Info.Ctx.getLangOpts().CPlusPlus20)
8111- CCEDiag(E, diag::note_constexpr_invalid_cast) << 1 ;
8111+ CCEDiag(E, diag::note_constexpr_invalid_cast) << diag::CastKind::Dynamic ;
81128112 return static_cast<Derived*>(this)->VisitCastExpr(E);
81138113 }
81148114 bool VisitBuiltinBitCastExpr(const BuiltinBitCastExpr *E) {
@@ -8833,7 +8833,7 @@ class LValueExprEvaluator
88338833
88348834 case CK_LValueBitCast:
88358835 this->CCEDiag(E, diag::note_constexpr_invalid_cast)
8836- << 2 << Info.Ctx.getLangOpts().CPlusPlus;
8836+ << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
88378837 if (!Visit(E->getSubExpr()))
88388838 return false;
88398839 Result.Designator.setInvalid();
@@ -9670,10 +9670,10 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
96709670 << E->getType()->getPointeeType();
96719671 else
96729672 CCEDiag(E, diag::note_constexpr_invalid_cast)
9673- << 3 << SubExpr->getType();
9673+ << diag::CastKind::CastFrom << SubExpr->getType();
96749674 } else
96759675 CCEDiag(E, diag::note_constexpr_invalid_cast)
9676- << 2 << Info.Ctx.getLangOpts().CPlusPlus;
9676+ << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
96779677 Result.Designator.setInvalid();
96789678 }
96799679 }
@@ -9712,7 +9712,7 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
97129712
97139713 case CK_IntegralToPointer: {
97149714 CCEDiag(E, diag::note_constexpr_invalid_cast)
9715- << 2 << Info.Ctx.getLangOpts().CPlusPlus;
9715+ << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
97169716
97179717 APValue Value;
97189718 if (!EvaluateIntegerOrLValue(SubExpr, Value, Info))
@@ -11177,7 +11177,7 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) {
1117711177 // Give up if the input isn't an int, float, or vector. For example, we
1117811178 // reject "(v4i16)(intptr_t)&a".
1117911179 Info.FFDiag(E, diag::note_constexpr_invalid_cast)
11180- << 2 << Info.Ctx.getLangOpts().CPlusPlus;
11180+ << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
1118111181 return false;
1118211182 }
1118311183
@@ -15196,7 +15196,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
1519615196
1519715197 case CK_PointerToIntegral: {
1519815198 CCEDiag(E, diag::note_constexpr_invalid_cast)
15199- << 2 << Info.Ctx.getLangOpts().CPlusPlus << E->getSourceRange();
15199+ << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus << E->getSourceRange();
1520015200
1520115201 LValue LV;
1520215202 if (!EvaluatePointer(SubExpr, LV, Info))
0 commit comments