[PATCH] D140179: [WIP][-Wunsafe-buffer-usage] Add unsafe buffer checking opt-out pragmas

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 19 15:57:21 PST 2023


ziqingluo-90 added inline comments.


================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:543
 #define GADGET(x)                                                              \
-        x ## Gadget::matcher().bind(#x),
+        allOf(x ## Gadget::matcher().bind(#x), notInSafeBufferOptOut()),
 #include "clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def"
----------------
ziqingluo-90 wrote:
> NoQ wrote:
> > This prevents safe fixable gadgets from being found in the opt-out zone. I think this clause should only apply to warning gadgets.
> You are right!  Fixables should be found regardless of whether they are in an opt-out zone.  A Fixable could later be immediately discarded once we know that the variable declaration associated to the Fixable is in an opt-out zone.
Oh wait, scratch what I said above.

`FixableGadget`s should be found regardless of whether they are in an opt-out zone.   They will be attached to variable declarations.  The emission of an Unsafe Buffer diagnostic of a variable declaration only depends on `WarningGadget`s.   So `FixableGadget`s have nothing to do with opt-out regions. 



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

https://reviews.llvm.org/D140179



More information about the cfe-commits mailing list