[clang] [CIR] Add support for ternary operator as lvalue (PR #163580)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 15 08:57:21 PDT 2025


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 cpp,h -- clang/lib/CIR/CodeGen/CIRGenExpr.cpp clang/lib/CIR/CodeGen/CIRGenFunction.cpp clang/lib/CIR/CodeGen/CIRGenFunction.h clang/lib/CIR/Dialect/IR/CIRDialect.cpp clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp clang/test/CIR/CodeGen/opaque.cpp clang/test/CIR/CodeGen/ternary.cpp --diff_from_common_commit
``````````

: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/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index 7223bc066..b5975442f 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -1955,7 +1955,7 @@ void cir::TernaryOp::build(
   YieldOp yield = dyn_cast_or_null<YieldOp>(trueRegion->back().getTerminator());
   if (!yield)
     yield = dyn_cast_or_null<YieldOp>(falseRegion->back().getTerminator());
-  
+
   assert((yield && yield.getNumOperands() <= 1) &&
          "expected zero or one result type");
   if (yield.getNumOperands() == 1)

``````````

</details>


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


More information about the cfe-commits mailing list