[clang] [clang][Interp] Fix `ArrayInitLoopExpr` handling (PR #67886)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 10:51:23 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 25da9bb7d44c91b0339382af6c91b6a346685212 d44be70de99dfbe00ea2dc366222a797ca92d9d5 -- clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/test/AST/Interp/cxx20.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 5dde2d52e717..056d85facb68 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -817,13 +817,14 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitLoopExpr(
   assert(Initializing);
   assert(!DiscardResult);
 
-  // Make sure the common expression is evaluated, and the result is cached in the current scope.
+  // Make sure the common expression is evaluated, and the result is cached in
+  // the current scope.
   {
     OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/true,
-                             /*NewInitializing=*/false);
+                               /*NewInitializing=*/false);
     this->VisitOpaqueValueExpr(E->getCommonExpr());
   }
-  
+
   // TODO: This compiles to quite a lot of bytecode if the array is larger.
   //   Investigate compiling this to a loop.
   const Expr *SubExpr = E->getSubExpr();
@@ -881,7 +882,7 @@ bool ByteCodeExprGen<Emitter>::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
 
   // Here the local variable is created but the value is removed from the stack,
   // so we put it back if the caller needs it.
-  if(!DiscardResult) {
+  if (!DiscardResult) {
     if (!this->emitGetLocal(SubExprT, *LocalIndex, E))
       return false;
   }

``````````

</details>


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


More information about the cfe-commits mailing list