This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] CStringChecker.cpp - Code refactoring on bug report.
ClosedPublic

Authored by MTC on Mar 16 2018, 5:28 AM.

Details

Summary

When improving the modeling evalMemset(), some scenes need to emit report of NotNullTerm. In this case,
there are three places in CStringChecker.cpp that have the same code about NotNullTerm report. In
addition, CStringChecker.cpp already has emitOverlapBug(), so I think it needs code refactoring.

Thanks in advance for the code review!

Diff Detail

Repository
rC Clang

Event Timeline

MTC created this revision.Mar 16 2018, 5:28 AM
NoQ added a comment.Mar 19 2018, 2:08 PM

Sorry, one moment, i'm seeing a few regressions after the previous refactoring but i didn't look at them closely yet to provide a reproducer. I'll get back to this.

MTC added a comment.Mar 19 2018, 6:58 PM
In D44557#1042357, @NoQ wrote:

Sorry, one moment, i'm seeing a few regressions after the previous refactoring but i didn't look at them closely yet to provide a reproducer. I'll get back to this.

Thank you for the code review, @NoQ !

The regression is maybe caused by https://reviews.llvm.org/D44075, my patch! CheckBufferAccess() may not guarantee checkNonNull() will be called. If that's true, please revert https://reviews.llvm.org/rC326782 and I'll fix it.

NoQ added a comment.Mar 20 2018, 6:01 PM
In D44557#1042792, @MTC wrote:
In D44557#1042357, @NoQ wrote:

Sorry, one moment, i'm seeing a few regressions after the previous refactoring but i didn't look at them closely yet to provide a reproducer. I'll get back to this.

Thank you for the code review, @NoQ !

The regression is maybe caused by https://reviews.llvm.org/D44075, my patch! CheckBufferAccess() may not guarantee checkNonNull() will be called. If that's true, please revert https://reviews.llvm.org/rC326782 and I'll fix it.

Thank you; i reverted the change in rC328067, but it'd still be great to at least add a reproducer to our tests :) I'll have a look at this one soon.

george.karpenkov accepted this revision.Apr 21 2018, 4:30 AM

LGTM, thanks!

This revision is now accepted and ready to land.Apr 21 2018, 4:30 AM
This revision was automatically updated to reflect the committed changes.