[clang-tools-extra] [tidy] add new check bugprone-return-const-ref-from-parameter (PR #89497)

Danny Mösch via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 22:47:15 PDT 2024


================
@@ -0,0 +1,31 @@
+.. title:: clang-tidy - bugprone-return-const-ref-from-parameter
+
+bugprone-return-const-ref-from-parameter
+========================================
+
+Detects return statements that return a constant reference parameter as constant
+reference. This may cause use-after-free errors if the caller uses xvalue as
+arguments.
----------------
SimplyDanny wrote:

```suggestion
Detects return statements that return a constant reference parameter as constant
reference. This may cause use-after-free errors if the caller uses xvalues as
arguments.
```

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


More information about the cfe-commits mailing list