[clang] [LifetimeSafety] Add details for `-Wlifetime-safety-return-stack-addr` diagnostic (PR #199432)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 24 09:20:24 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 h,cpp -- clang/include/clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h clang/lib/Analysis/LifetimeSafety/Checker.cpp clang/lib/Sema/SemaLifetimeSafety.h clang/test/Sema/warn-lifetime-analysis-nocfg.cpp clang/test/Sema/warn-lifetime-safety-suggestions.cpp clang/test/Sema/warn-lifetime-safety.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/SemaLifetimeSafety.h b/clang/lib/Sema/SemaLifetimeSafety.h
index 6bd78f79d..a65b88553 100644
--- a/clang/lib/Sema/SemaLifetimeSafety.h
+++ b/clang/lib/Sema/SemaLifetimeSafety.h
@@ -75,8 +75,7 @@ public:
}
void reportUseAfterReturn(const ValueDecl *VD, const Expr *IssueExpr,
- const Expr *ReturnExpr,
- const Expr *MovedExpr,
+ const Expr *ReturnExpr, const Expr *MovedExpr,
bool IsReference) override {
unsigned DiagID = MovedExpr
? diag::warn_lifetime_safety_return_stack_addr_moved
@@ -93,8 +92,7 @@ public:
}
void reportUseAfterReturn(const MaterializeTemporaryExpr *MTE,
- const Expr *ReturnExpr,
- const Expr *MovedExpr,
+ const Expr *ReturnExpr, const Expr *MovedExpr,
bool IsReference) override {
unsigned DiagID =
MovedExpr ? diag::warn_lifetime_safety_return_temp_stack_addr_moved
``````````
</details>
https://github.com/llvm/llvm-project/pull/199432
More information about the cfe-commits
mailing list