[PATCH] D139737: [-Wunsafe-buffer-usage] Initiate Fix-it generation for local variable declarations

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 14:30:06 PST 2023


jkorous added inline comments.


================
Comment at: clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h:46
+/// The text indicating that the user needs to provide input there:
+constexpr static const char *const UserFillPlaceHolder = "...";
 } // end namespace clang
----------------
Should we rather pick something that is syntactically incorrect in C++ in order to prevent accidental silent corruption of the sources?
FWIW Xcode uses `<#placeholder#>` syntax.


================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits.cpp:1
+// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage -verify %s
+// RUN: cp %s %t.cpp
----------------
I am starting to think we should split up our tests to allow for less conflicts between patches.
Could we please rename the file to a more specific name e. g. `warn-unsafe-buffer-usage-fixits-local-var-span.cpp`?


================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits.cpp:1
+// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage -verify %s
+// RUN: cp %s %t.cpp
----------------
jkorous wrote:
> I am starting to think we should split up our tests to allow for less conflicts between patches.
> Could we please rename the file to a more specific name e. g. `warn-unsafe-buffer-usage-fixits-local-var-span.cpp`?
Also, let's check only correctness of the FixIts in this test.
I would remove `RUN` lines with `-verify` and `expected-warnings`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139737/new/

https://reviews.llvm.org/D139737



More information about the cfe-commits mailing list