[PATCH] D129269: [analyzer] Fix use of length in CStringChecker

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 11 05:35:54 PDT 2022


martong added a comment.

Thanks Vince for the patch! I think the implementation is correct. But I am worried that it might do sub-optimal computations on the string literals. I mean, getting the length would require O(N) steps each time, and that could be problematic with long literals, especially in projects that have many literals.

So, I'd rather keep your first implementation with `getLength` with the new test case which fails (and the failure is documented). I think, this is what @steakhal was also suggesting.

Then, if your time allows, in a second patch, we could have the loop based implementation for catching embedded null terminators. However, that change should have it's own measurement and maybe even it's own command line option to enable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129269



More information about the cfe-commits mailing list