[PATCH] D155524: [-Wunsafe-buffer-usage] Ignore the FixableGadgets that will not be fixed at an earlier stage

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 15:58:46 PDT 2023


ziqingluo-90 created this revision.
ziqingluo-90 added reviewers: NoQ, jkorous, t-rasmud, malavikasamak.
Herald added a project: All.
ziqingluo-90 requested review of this revision.
Herald added subscribers: cfe-commits, wangpc.
Herald added a project: clang.

When some unsafe operations are suppressed,   there will be (non-strictly) fewer variables being warned about.   `FixableGadget`s  associated with the suppressed variables will not be fixed.  
Removing these `FixableGadget` as early as possible could help improve the performance and stability of the analysis.

The variable grouping algorithm introduced in D145739 <https://reviews.llvm.org/D145739> nearly completes this task.  
For a variable that is neither warned about nor reachable from a warned variable, it does not exist in the graph computed by the algorithm. 
So this patch simply removes `FixableGadget`s whose variables are not present in the graph computed for variable grouping.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155524

Files:
  clang/lib/Analysis/UnsafeBufferUsage.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-fixit.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155524.541252.patch
Type: text/x-patch
Size: 4954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230717/1ee5bce6/attachment.bin>


More information about the cfe-commits mailing list