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

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 20 07:24:15 PDT 2024


================
@@ -0,0 +1,30 @@
+.. title:: clang-tidy - bugprone-return-const-ref-from-parameter
+
+bugprone-return-const-ref-from-parameter
+========================================
+
+Detects the function which returns the const reference from parameter which
+causes potential use after free if the caller uses xvalue as argument.
+
+In c++, const reference parameter can accept xvalue which will be destructed
----------------
EugeneZelenko wrote:

```suggestion
In C++, const reference parameter can accept xvalue which will be destructed
```

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


More information about the cfe-commits mailing list