[clang] [clang] Fix clang++ crash on assertions when compiling source (PR #70594)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 04:06:56 PDT 2023


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 4f5d463505b3e313cd3943132e7b2784a65c39d9 efea75d1ae4a1da80b16b3e743a15a82b5f8d971 -- clang/test/Sema/GH35603.cpp clang/lib/AST/ExprConstant.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 07f0a12385b4..97705c1afc13 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -2772,9 +2772,9 @@ static bool EvalAndBitcastToAPInt(EvalInfo &Info, const Expr *E,
       }
       unsigned BaseEltSize = EltAsInt.getBitWidth();
       if (BigEndian)
-        Res |= EltAsInt.zextOrTrunc(VecSize).rotr(i*EltSize+BaseEltSize);
+        Res |= EltAsInt.zextOrTrunc(VecSize).rotr(i * EltSize + BaseEltSize);
       else
-        Res |= EltAsInt.zextOrTrunc(VecSize).rotl(i*EltSize);
+        Res |= EltAsInt.zextOrTrunc(VecSize).rotl(i * EltSize);
     }
     return true;
   }
@@ -10566,9 +10566,9 @@ bool VectorExprEvaluator::VisitCastExpr(const CastExpr *E) {
       for (unsigned i = 0; i < NElts; i++) {
         llvm::APInt Elt;
         if (BigEndian)
-          Elt = SValInt.rotl(i*EltSize+EltSize).zextOrTrunc(EltSize);
+          Elt = SValInt.rotl(i * EltSize + EltSize).zextOrTrunc(EltSize);
         else
-          Elt = SValInt.rotr(i*EltSize).zextOrTrunc(EltSize);
+          Elt = SValInt.rotr(i * EltSize).zextOrTrunc(EltSize);
         Elts.push_back(APValue(APSInt(Elt, !EltTy->isSignedIntegerType())));
       }
     } else {

``````````

</details>


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


More information about the cfe-commits mailing list