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

Piotr Padlewski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 11 04:13:58 PST 2017


Prazek added a comment.

In https://reviews.llvm.org/D29839#674315, @xazax.hun wrote:

> In https://reviews.llvm.org/D29839#674307, @Prazek 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.
> >
> >
> > Do you have some examples? I would argue, that even if you would have code that firstly uses width(), and then after a while reads input, then this is bugprone, and probably the line initializing width should be just before reading.
>
>
> You are right, reasonable code sets the width right before reading the input. But do we only want to catch bugs in reasonable code?


We will catch bugs in resonable and not resonable code. But because clang-tidy is a linter, we will also warn about cases that might be valid, but looks buggy, making code resonable. 
We won't gonna have any false negatives (missed bugs), we only can have more false positives (warnings about correct code), but because it is linter, it totally make sense to warn about these cases.


https://reviews.llvm.org/D29839





More information about the cfe-commits mailing list