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

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 2 14:02:52 PDT 2023


ziqingluo-90 added inline comments.


================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2179
+      if (FixItsForVariable.count(GrpMate))
+        FinalFixItsForVariable[Var].insert(FinalFixItsForVariable[Var].end(),
+                                           FixItsForVariable[GrpMate].begin(),
----------------
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.





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