[clang] [Clang][Sema] Fix missing warning when comparing mismatched enums in … (PR #81389)

via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 10 15:34:10 PST 2024


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 b17348c3b541d7fc7ec441c98db75c18d8959910 b256939140c99356f2ab41e2c69f3d218ffc81a6 -- clang/test/Sema/warn-compare-enum-types-mismatch.c clang/include/clang/AST/Expr.h clang/lib/AST/Expr.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaExpr.cpp clang/test/Sema/builtins-elementwise-math.c clang/test/Sema/warn-overlap.c clang/test/Sema/warn-conditional-enum-types-mismatch.c
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 2ccd8f5842..bfd8dbced1 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -9735,7 +9735,8 @@ ExprResult Sema::SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo,
                      << E->getSourceRange());
   if (!DstTy->isVectorType() && !DstTy->isDependentType())
     return ExprError(Diag(BuiltinLoc, diag::err_builtin_non_vector_type)
-                     << "second" << "__builtin_convertvector");
+                     << "second"
+                     << "__builtin_convertvector");
 
   if (!SrcTy->isDependentType() && !DstTy->isDependentType()) {
     unsigned SrcElts = SrcTy->castAs<VectorType>()->getNumElements();
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index dbcd1513ed..cf2131c2f4 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4354,7 +4354,8 @@ static bool CheckVectorElementsTraitOperandType(Sema &S, QualType T,
   // builtin_vectorelements supports both fixed-sized and scalable vectors.
   if (!T->isVectorType() && !T->isSizelessVectorType())
     return S.Diag(Loc, diag::err_builtin_non_vector_type)
-           << "" << "__builtin_vectorelements" << T << ArgRange;
+           << ""
+           << "__builtin_vectorelements" << T << ArgRange;
 
   return false;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/81389


More information about the cfe-commits mailing list