ziqingluo-90 added inline comments.
================ Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:1891-1892 + for (unsigned i = 0; i < NumParms; i++) { + if (!ParmsMask[i]) + continue; + ---------------- NoQ wrote: > Speaking of [[ https://reviews.llvm.org/D156762#inline-1517322 |my comment on > the other patch]]. > > Can we simply ask `Strategy` about the strategy for `FD->getParamDecl(i)` > instead of passing a mask? > > Eventually we'll have to do that anyway, given how different parameters can > be assigned different strategies. Yes. I think using `Strategy` is the correct way to do it. Can I make it a follow-up patch? I noticed that this line needs to be fixed: ``` Strategy NaiveStrategy = getNaiveStrategy(UnsafeVars); ``` The `UnsafeVars` is the set of variables associated to all matched `FixableGadget`s. There can be variables that is safe and do not need fix. Their strategy is set to `std::span` currently which is not correct. With this line being fixed, we can have examples like ``` void f(int * p) { int * q; q = p; p[5] = 5; } ``` where `q`'s strategy is `WONTFIX` and `p`'s strategy is `std::span`. The expression `q = p` can be fixed to `q = p.data()`. It currently has an empty fix-it, which is incorrect. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153059/new/ https://reviews.llvm.org/D153059 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits