[clang] [Clang][Diagnostics] Update select uses in DiagnosticXKinds.td to use enum_select (PR #130868)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 18 23:17:40 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 08d15e3f64e3a5ec0adeae0df7969c81ab61d44b 9e08ddfb5931d06fa0e725ae7dea8de781489ab7 --extensions cpp,h -- clang/lib/AST/ByteCode/Interp.h clang/lib/AST/ExprConstant.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h
index 8956a69c71..24d596b3a5 100644
--- a/clang/lib/AST/ByteCode/Interp.h
+++ b/clang/lib/AST/ByteCode/Interp.h
@@ -2366,12 +2366,14 @@ static inline bool PtrPtrCast(InterpState &S, CodePtr OpPC, bool SrcIsVoidPtr) {
} else if (!S.getLangOpts().CPlusPlus26) {
const SourceInfo &E = S.Current->getSource(OpPC);
S.CCEDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::CastFrom << "'void *'" << S.Current->getRange(OpPC);
+ << diag::CastKind::CastFrom << "'void *'"
+ << S.Current->getRange(OpPC);
}
} else {
const SourceInfo &E = S.Current->getSource(OpPC);
S.CCEDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::ThisCastOrReinterpret << S.getLangOpts().CPlusPlus << S.Current->getRange(OpPC);
+ << diag::CastKind::ThisCastOrReinterpret << S.getLangOpts().CPlusPlus
+ << S.Current->getRange(OpPC);
}
return true;
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 9eb8c67179..1ca0a12220 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -8103,7 +8103,8 @@ public:
}
bool VisitCXXReinterpretCastExpr(const CXXReinterpretCastExpr *E) {
- CCEDiag(E, diag::note_constexpr_invalid_cast) << diag::CastKind::Reinterpret;
+ CCEDiag(E, diag::note_constexpr_invalid_cast)
+ << diag::CastKind::Reinterpret;
return static_cast<Derived*>(this)->VisitCastExpr(E);
}
bool VisitCXXDynamicCastExpr(const CXXDynamicCastExpr *E) {
@@ -8833,7 +8834,8 @@ public:
case CK_LValueBitCast:
this->CCEDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
+ << diag::CastKind::ThisCastOrReinterpret
+ << Info.Ctx.getLangOpts().CPlusPlus;
if (!Visit(E->getSubExpr()))
return false;
Result.Designator.setInvalid();
@@ -9673,7 +9675,8 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
<< diag::CastKind::CastFrom << SubExpr->getType();
} else
CCEDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
+ << diag::CastKind::ThisCastOrReinterpret
+ << Info.Ctx.getLangOpts().CPlusPlus;
Result.Designator.setInvalid();
}
}
@@ -9712,7 +9715,8 @@ bool PointerExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_IntegralToPointer: {
CCEDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
+ << diag::CastKind::ThisCastOrReinterpret
+ << Info.Ctx.getLangOpts().CPlusPlus;
APValue Value;
if (!EvaluateIntegerOrLValue(SubExpr, Value, Info))
@@ -11177,7 +11181,8 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) {
// Give up if the input isn't an int, float, or vector. For example, we
// reject "(v4i16)(intptr_t)&a".
Info.FFDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus;
+ << diag::CastKind::ThisCastOrReinterpret
+ << Info.Ctx.getLangOpts().CPlusPlus;
return false;
}
@@ -15196,7 +15201,8 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_PointerToIntegral: {
CCEDiag(E, diag::note_constexpr_invalid_cast)
- << diag::CastKind::ThisCastOrReinterpret << Info.Ctx.getLangOpts().CPlusPlus << E->getSourceRange();
+ << diag::CastKind::ThisCastOrReinterpret
+ << Info.Ctx.getLangOpts().CPlusPlus << E->getSourceRange();
LValue LV;
if (!EvaluatePointer(SubExpr, LV, Info))
``````````
</details>
https://github.com/llvm/llvm-project/pull/130868
More information about the cfe-commits
mailing list