[PATCH] D156188: [-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 9 13:36:24 PDT 2023
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.
Very nice, everything looks great!
================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1777-1778
+
+ StringRef SpanOpen = "std::span<";
+ StringRef SpanClose = ">";
+ std::string SpanTyText = SpanOpen.str();
----------------
I'd rather just use literals in expressions. Saves a couple mallocs, a couple memcpys, and a couple lines of code.
(They'll probably turn into variables later anyway, when we transcend beyond `span`, so arguably not worth fixing.)
================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-unsupported.cpp:141-143
+// CHECK-NOT: fix-it:{{.*}}:{[[@LINE+1]]
+void macroIdentifier(int * MACRO_NAME) { // The fix-it ends with a macro. It will be discarded due to overlap with macros. \
+ expected-warning{{'MyName' is an unsafe pointer used for buffer access}}
----------------
(a bit narrower and less fancy)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156188/new/
https://reviews.llvm.org/D156188
More information about the cfe-commits
mailing list