[clang] [clang] Use new interpreter in EvaluateAsConstantExpr if requested (PR #70763)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 22:06:22 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 ae7f7f2ef2033a48fb9db3cb70b88ad62019f40b e71ed498d0d46af26f72e08706415f21b7deb30e -- clang/lib/AST/ExprConstant.cpp clang/lib/AST/Interp/ByteCodeExprGen.h clang/test/AST/Interp/literals.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 2a8b81c12555..eef8c35ec4f5 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/70763


More information about the cfe-commits mailing list