[PATCH] D156474: [-Wunsafe-buffer-usage][NFC] Slightly refactor and optimize the code

Rashmi Mudduluru via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 2 14:12:41 PDT 2023


t-rasmud accepted this revision.
t-rasmud added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2179
+      if (FixItsForVariable.count(GrpMate))
+        FinalFixItsForVariable[Var].insert(FinalFixItsForVariable[Var].end(),
+                                           FixItsForVariable[GrpMate].begin(),
----------------
ziqingluo-90 wrote:
> t-rasmud wrote:
> > ziqingluo-90 wrote:
> > > Instead of calling `fixVariable` to generate fix-its for group mates, directly copying those fix-its from the `FixItsForVariable` container.
> > > 
> > > At this point,  `FixItsForVariable` is complete. That is, it maps every variable to its own fix-its (excluding fix-its of group mates).
> > Do you mean "including fix-its of group mates"? If not, I might have misunderstood the changes and will take a look again.
> No. 
> `FixItsForVariable` is a map from variables to their own fix-its, excluding fix-its of group mates.
> `FinalFixItsForVariable` is a map from variables to the set of fix-its that fix the whole group.
> 
> The construction of  `FinalFixItsForVariable` reads `FixItsForVariable`.
> 
> Maybe I should have better names for these two variables.
> 
> 
> 
Ah! That makes sense, I misread the `FixItsForVariable` as `FinalFixItsForVariable` in you comment. Thank you for explaining.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156474



More information about the cfe-commits mailing list