[PATCH] D29839: [clang-tidy] New misc-istream-overflow check

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 12 14:41:05 PST 2017


alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

In https://reviews.llvm.org/D29839#674517, @aaron.ballman wrote:

> In https://reviews.llvm.org/D29839#674301, @xazax.hun wrote:
>
> > Shouldn't this be a path sensitive check within the clang static analyzer instead? So branches are properly handled and interprocedural analysis is done.
>
>
> I agree; I think this check should be part of the static analyzer because it is path sensitive if we want it to be particularly useful. As it stands now, it will catch trivial bugs, but by designing it as a clang-tidy check, it isn't easily extensible to catch the bigger bugs across procedures.


I totally agree with Aaron and Gabor. This analysis can't be properly implemented without path sensitivity and I can imagine many valid situations where it will be too noisy (custom functions or stream manipulators that hide width setting, for example). Clang-tidy has a bunch of lint-style analyses, but when there is a more appropriate technology to implement a certain analysis, it should be preferred. It's all trade-offs, but here path sensitive analysis seems to be a much better tool for the job.


https://reviews.llvm.org/D29839





More information about the cfe-commits mailing list