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 origin/main HEAD --extensions h,c,cpp -- 
clang/lib/AST/ByteCode/InterpBuiltin.cpp clang/lib/AST/ExprConstant.cpp 
clang/lib/Headers/avx2intrin.h clang/lib/Headers/avxintrin.h 
clang/lib/Headers/pmmintrin.h clang/lib/Headers/tmmintrin.h 
clang/test/CodeGen/X86/avx-builtins.c clang/test/CodeGen/X86/avx2-builtins.c 
clang/test/CodeGen/X86/mmx-builtins.c clang/test/CodeGen/X86/ssse3-builtins.c
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</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 026894381..387957efa 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -12080,7 +12080,7 @@ bool VectorExprEvaluator::VisitCallExpr(const CallExpr 
*E) {
   case clang::X86::BI__builtin_ia32_phsubd128:
   case clang::X86::BI__builtin_ia32_phsubd256:
   case clang::X86::BI__builtin_ia32_phsubsw128:
-  case clang::X86::BI__builtin_ia32_phsubsw256:{
+  case clang::X86::BI__builtin_ia32_phsubsw256: {
     APValue SourceLHS, SourceRHS;
     if (!EvaluateAsRValue(Info, E->getArg(0), SourceLHS) ||
         !EvaluateAsRValue(Info, E->getArg(1), SourceRHS))
@@ -12088,39 +12088,38 @@ bool VectorExprEvaluator::VisitCallExpr(const 
CallExpr *E) {
     QualType DestEltTy = E->getType()->castAs<VectorType>()->getElementType();
     bool DestUnsigned = DestEltTy->isUnsignedIntegerOrEnumerationType();
 
-      unsigned SourceLen = SourceLHS.getVectorLength();
-      SmallVector<APValue, 4> ResultElements;
-      ResultElements.reserve(SourceLen);
-      for (unsigned EltNum = 0; EltNum < SourceLen; EltNum += 2) {
-        APSInt LHSA = SourceLHS.getVectorElt(EltNum).getInt();
-        APSInt LHSB = SourceLHS.getVectorElt(EltNum + 1).getInt();
-
-        switch (E->getBuiltinCallee()) {
-        case clang::X86::BI__builtin_ia32_phaddw128:
-        case clang::X86::BI__builtin_ia32_phaddw256:
-        case clang::X86::BI__builtin_ia32_phaddd128:
-        case clang::X86::BI__builtin_ia32_phaddd256:
-        ResultElements.push_back(
-            APValue(APSInt(LHSA+LHSB, DestUnsigned)));
+    unsigned SourceLen = SourceLHS.getVectorLength();
+    SmallVector<APValue, 4> ResultElements;
+    ResultElements.reserve(SourceLen);
+    for (unsigned EltNum = 0; EltNum < SourceLen; EltNum += 2) {
+      APSInt LHSA = SourceLHS.getVectorElt(EltNum).getInt();
+      APSInt LHSB = SourceLHS.getVectorElt(EltNum + 1).getInt();
+
+      switch (E->getBuiltinCallee()) {
+      case clang::X86::BI__builtin_ia32_phaddw128:
+      case clang::X86::BI__builtin_ia32_phaddw256:
+      case clang::X86::BI__builtin_ia32_phaddd128:
+      case clang::X86::BI__builtin_ia32_phaddd256:
+        ResultElements.push_back(APValue(APSInt(LHSA + LHSB, DestUnsigned)));
+        break;
+      case clang::X86::BI__builtin_ia32_phaddsw128:
+      case clang::X86::BI__builtin_ia32_phaddsw256:
+        ResultElements.push_back(APValue(
+            APSInt(LHSA.isSigned() ? LHSA.sadd_sat(LHSB) : LHSA.uadd_sat(LHSB),
+                   DestUnsigned)));
+        break;
+      case clang::X86::BI__builtin_ia32_phsubw128:
+      case clang::X86::BI__builtin_ia32_phsubw256:
+      case clang::X86::BI__builtin_ia32_phsubd128:
+      case clang::X86::BI__builtin_ia32_phsubd256:
+        ResultElements.push_back(APValue(APSInt(LHSA - LHSB, DestUnsigned)));
+        break;
+      case clang::X86::BI__builtin_ia32_phsubsw128:
+      case clang::X86::BI__builtin_ia32_phsubsw256:
+        ResultElements.push_back(APValue(
+            APSInt(LHSA.isSigned() ? LHSA.ssub_sat(LHSB) : LHSA.usub_sat(LHSB),
+                   DestUnsigned)));
         break;
-        case clang::X86::BI__builtin_ia32_phaddsw128:
-        case clang::X86::BI__builtin_ia32_phaddsw256:
-          ResultElements.push_back(APValue(APSInt(
-              LHSA.isSigned() ? LHSA.sadd_sat(LHSB) : LHSA.uadd_sat(LHSB),
-              DestUnsigned)));
-          break;
-        case clang::X86::BI__builtin_ia32_phsubw128:
-        case clang::X86::BI__builtin_ia32_phsubw256:
-        case clang::X86::BI__builtin_ia32_phsubd128:
-        case clang::X86::BI__builtin_ia32_phsubd256:
-          ResultElements.push_back(APValue(APSInt(LHSA - LHSB, DestUnsigned)));
-          break;
-        case clang::X86::BI__builtin_ia32_phsubsw128:
-        case clang::X86::BI__builtin_ia32_phsubsw256:
-          ResultElements.push_back(APValue(APSInt(
-              LHSA.isSigned() ? LHSA.ssub_sat(LHSB) : LHSA.usub_sat(LHSB),
-              DestUnsigned)));
-          break;
       }
     }
     for (unsigned EltNum = 0; EltNum < SourceLen; EltNum += 2) {
@@ -12331,72 +12330,67 @@ bool 
VectorExprEvaluator::VisitShuffleVectorExpr(const ShuffleVectorExpr *E) {
 
//===----------------------------------------------------------------------===//
 
 namespace {
-  class ArrayExprEvaluator
-  :
-        public
-          ExprEvaluatorBase<ArrayExprEvaluator> {
-            const LValue &This;
-            APValue & Result;
-
-          public:
-            ArrayExprEvaluator(EvalInfo & Info, const LValue &This,
-                               APValue &Result)
-                : ExprEvaluatorBaseTy(Info), This(This), Result(Result) {}
-
-            bool Success(const APValue &V, const Expr *E) {
-              assert(V.isArray() && "expected array");
-              Result = V;
-              return true;
-            }
-
-            bool ZeroInitialization(const Expr *E) {
-              const ConstantArrayType *CAT =
-                  Info.Ctx.getAsConstantArrayType(E->getType());
-              if (!CAT) {
-                if (E->getType()->isIncompleteArrayType()) {
-                  // We can be asked to zero-initialize a flexible array 
member;
-                  // this is represented as an ImplicitValueInitExpr of
-                  // incomplete array type. In this case, the array has zero
-                  // elements.
-                  Result = APValue(APValue::UninitArray(), 0, 0);
-                  return true;
-                }
-                // FIXME: We could handle VLAs here.
-                return Error(E);
-              }
-
-              Result = APValue(APValue::UninitArray(), 0, CAT->getZExtSize());
-              if (!Result.hasArrayFiller())
-                return true;
-
-              // Zero-initialize all elements.
-              LValue Subobject = This;
-              Subobject.addArray(Info, E, CAT);
-              ImplicitValueInitExpr VIE(CAT->getElementType());
-              return EvaluateInPlace(Result.getArrayFiller(), Info, Subobject,
-                                     &VIE);
-            }
-
-            bool VisitCallExpr(const CallExpr *E) {
-              return handleCallExpr(E, Result, &This);
-            }
-            bool VisitInitListExpr(const InitListExpr *E,
-                                   QualType AllocType = QualType());
-            bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E);
-            bool VisitCXXConstructExpr(const CXXConstructExpr *E);
-            bool VisitCXXConstructExpr(const CXXConstructExpr *E,
-                                       const LValue &Subobject, APValue *Value,
-                                       QualType Type);
-            bool VisitStringLiteral(const StringLiteral *E,
-                                    QualType AllocType = QualType()) {
-              expandStringLiteral(Info, E, Result, AllocType);
-              return true;
-            }
-            bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
-            bool VisitCXXParenListOrInitListExpr(
-                const Expr *ExprToVisit, ArrayRef<Expr *> Args,
-                const Expr *ArrayFiller, QualType AllocType = QualType());
-          };
+class ArrayExprEvaluator : public ExprEvaluatorBase<ArrayExprEvaluator> {
+  const LValue &This;
+  APValue &Result;
+
+public:
+  ArrayExprEvaluator(EvalInfo &Info, const LValue &This, APValue &Result)
+      : ExprEvaluatorBaseTy(Info), This(This), Result(Result) {}
+
+  bool Success(const APValue &V, const Expr *E) {
+    assert(V.isArray() && "expected array");
+    Result = V;
+    return true;
+  }
+
+  bool ZeroInitialization(const Expr *E) {
+    const ConstantArrayType *CAT =
+        Info.Ctx.getAsConstantArrayType(E->getType());
+    if (!CAT) {
+      if (E->getType()->isIncompleteArrayType()) {
+        // We can be asked to zero-initialize a flexible array member;
+        // this is represented as an ImplicitValueInitExpr of
+        // incomplete array type. In this case, the array has zero
+        // elements.
+        Result = APValue(APValue::UninitArray(), 0, 0);
+        return true;
+      }
+      // FIXME: We could handle VLAs here.
+      return Error(E);
+    }
+
+    Result = APValue(APValue::UninitArray(), 0, CAT->getZExtSize());
+    if (!Result.hasArrayFiller())
+      return true;
+
+    // Zero-initialize all elements.
+    LValue Subobject = This;
+    Subobject.addArray(Info, E, CAT);
+    ImplicitValueInitExpr VIE(CAT->getElementType());
+    return EvaluateInPlace(Result.getArrayFiller(), Info, Subobject, &VIE);
+  }
+
+  bool VisitCallExpr(const CallExpr *E) {
+    return handleCallExpr(E, Result, &This);
+  }
+  bool VisitInitListExpr(const InitListExpr *E,
+                         QualType AllocType = QualType());
+  bool VisitArrayInitLoopExpr(const ArrayInitLoopExpr *E);
+  bool VisitCXXConstructExpr(const CXXConstructExpr *E);
+  bool VisitCXXConstructExpr(const CXXConstructExpr *E, const LValue 
&Subobject,
+                             APValue *Value, QualType Type);
+  bool VisitStringLiteral(const StringLiteral *E,
+                          QualType AllocType = QualType()) {
+    expandStringLiteral(Info, E, Result, AllocType);
+    return true;
+  }
+  bool VisitCXXParenListInitExpr(const CXXParenListInitExpr *E);
+  bool VisitCXXParenListOrInitListExpr(const Expr *ExprToVisit,
+                                       ArrayRef<Expr *> Args,
+                                       const Expr *ArrayFiller,
+                                       QualType AllocType = QualType());
+};
 } // end anonymous namespace
 
 static bool EvaluateArray(const Expr *E, const LValue &This,

``````````

</details>


https://github.com/llvm/llvm-project/pull/156822
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to