[Mlir-commits] [mlir] [mlir][emitc][cf] add 'cf.switch' support in CppEmitter (PR #101478)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Aug 1 06:09:51 PDT 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 2d3655037ccfa276cb0949c2ce0cff56985f6637 34a1d6a2c36ed2a43edd95e8f02753ca974833f8 --extensions cpp -- mlir/lib/Target/Cpp/TranslateToCpp.cpp
``````````

</details>

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

``````````diff
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index 94effae342..b47f41d2e0 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -588,7 +588,6 @@ static LogicalResult printOperation(CppEmitter &emitter,
 
   os << "\nswitch(" << emitter.getOrCreateName(switchOp.getFlag()) << ") {";
 
-
   for (const auto caseBlock : switchOp.getCaseDestinations()) {
     if (iteratorCaseValues == iteratorCaseValuesEnd)
       return switchOp.emitOpError("case's value is absent for case block");
@@ -596,8 +595,8 @@ static LogicalResult printOperation(CppEmitter &emitter,
     os << "\ncase " << *(iteratorCaseValues++) << ": {\n";
     os.indent();
 
-    for (auto pair :
-         llvm::zip(switchOp.getCaseOperands(caseIndex++), caseBlock->getArguments())) {
+    for (auto pair : llvm::zip(switchOp.getCaseOperands(caseIndex++),
+                               caseBlock->getArguments())) {
       Value &operand = std::get<0>(pair);
       BlockArgument &argument = std::get<1>(pair);
       os << emitter.getOrCreateName(argument) << " = "
@@ -618,8 +617,8 @@ static LogicalResult printOperation(CppEmitter &emitter,
 
   auto defaultBlock = switchOp.getDefaultDestination();
 
-  for (auto pair : llvm::zip(switchOp.getDefaultOperands(),
-                             defaultBlock->getArguments())) {
+  for (auto pair :
+       llvm::zip(switchOp.getDefaultOperands(), defaultBlock->getArguments())) {
     Value &operand = std::get<0>(pair);
     BlockArgument &argument = std::get<1>(pair);
     os << emitter.getOrCreateName(argument) << " = "

``````````

</details>


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


More information about the Mlir-commits mailing list