[PATCH] D146669: [-Wunsafe-buffer-usage] Hide fixits/suggestions behind an extra flag, -fsafe-buffer-usage-suggestions.

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 18:59:23 PDT 2023


jkorous accepted this revision.
jkorous added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:11792
   "change type of '%0' to '%select{std::span|std::array|std::span::iterator}1' to preserve bounds information">;
+def note_safe_buffer_usage_suggestions_disabled : Note<
+  "pass -fsafe-buffer-usage-suggestions to receive code hardening suggestions">;
----------------
I like this idea!

Thinking about the questions you raised:
> Do we really need that? Maybe we should somehow throttle it to reduce noise?

The only case I can see value in not emitting this note is when the user passes `-fno-safe-buffer-usage-suggestions`. In that case it can be argued that the user is well aware of the flag since they explicitly turned it off.

That being said I am fine with the current behavior and in either case expect we will tweak this once we get feedback from the users.


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

https://reviews.llvm.org/D146669



More information about the cfe-commits mailing list