[clang] [Sema] Permit side-effect-free function calls in C++23 [[assume]] (PR #194243)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 27 08:46:59 PDT 2026


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 -- clang/lib/Sema/SemaStmtAttr.cpp clang/test/SemaCXX/cxx23-assume.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/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp
index c845bf7ff..985a1c1c7 100644
--- a/clang/lib/Sema/SemaStmtAttr.cpp
+++ b/clang/lib/Sema/SemaStmtAttr.cpp
@@ -804,9 +804,9 @@ ExprResult Sema::ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr &A,
 
 /// Recursively analyze whether a function body has side effects.
 /// \p Visited tracks the current call chain to prevent infinite recursion.
-static bool FunctionBodyHasSideEffects(const FunctionDecl *FD,
-                                        const ASTContext &Ctx,
-                                        llvm::SmallPtrSetImpl<const FunctionDecl *> &Visited) {
+static bool FunctionBodyHasSideEffects(
+    const FunctionDecl *FD, const ASTContext &Ctx,
+    llvm::SmallPtrSetImpl<const FunctionDecl *> &Visited) {
   if (FD->hasAttr<ConstAttr>() || FD->hasAttr<PureAttr>())
     return false;
 

``````````

</details>


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


More information about the cfe-commits mailing list