[PATCH] D70411: [analyzer][WIP] CERT: StrChecker: 31.c

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 17:21:54 PST 2019


Charusso added a comment.

In D70411#1754356 <https://reviews.llvm.org/D70411#1754356>, @NoQ wrote:

> I think it would really help if you draw a state machine for the checker, like the ASCII-art thing in D70470 <https://reviews.llvm.org/D70470>; you don't need to spend a lot of time turning it into ASCII-art, a photo of a quick hand-drawn picture would be totally fine, because it's, first and foremost, for discussion :)


Hm, the idea is cool, but my checker is not that complex, given that now I have added comments. Thanks, I will adjust the comments with some kind of drawing.

My main problem was that to create a `NoteTag` when the not null-terminated string is read, but it is after when we emit an error, so I could not emit a note. That is why it emits two different reports, and somehow I need to convert the function call evaluation warning to a note in case when a not null-terminated string is read. Do we have any plans with `NoteTags` to support the craziest checkers? What do you think about storing the reports in the program state?



================
Comment at: clang/lib/StaticAnalyzer/Checkers/cert/StrChecker.cpp:279
+        if (PredNode->getState() == ErrorNode->getState()) {
+          IsFalsePositiveFound = true;
+          PR->markInvalid(nullptr, nullptr);
----------------
NoQ wrote:
> Why is this a false positive?
> 
> You're bringing in a completely brand-new machinery here, could you explain how it works and why do you need it?
Hm, yes, I wanted to add comments earlier, sorry. It is still wonky a little-bit, somehow I need to merge the two different errors.


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

https://reviews.llvm.org/D70411





More information about the cfe-commits mailing list