[clang-tools-extra] [clang-tidy] Warn on use of std::get_temporary_buffer (PR #176191)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 19 08:55:38 PST 2026


================
@@ -97,6 +98,9 @@ static StringRef getRationaleFor(StringRef FunctionName) {
       .Cases({"rewind", "setbuf"}, "has no error detection")
       .Case("vfork", "is insecure as it can lead to denial of service "
                      "situations in the parent process")
+      .Case("get_temporary_buffer",
+            "is bugprone, has no performance advantage, was deprecated in "
+            "C++17 and removed in C++20")
----------------
NagyDonat wrote:

By the way, when I was reading the first comment I felt that your suggestion is too long because for some reason I thought that  "returns uninitialized memory without performance advantages" replaces just "is bugprone" and not "is bugprone, has no performance advantage".

When I read  your second comment in this thread, I realized that it suggests a good phrasing -- but I didn't notice that it is exactly the same phrasing as what you already wrote in the first comment :sweat_smile: ...

Anyway, thanks for the suggestion :smile:

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


More information about the cfe-commits mailing list