-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Fix cpp/new-free-mismatch
false positives
#3206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The QLDoc check is failing because this is exposing the I think moving the matching into the models is a good idea, but I might have the model make the decision about specific functions or expressions rather than using strings. In any case, we should probably talk about it in an issue rather than a PR. |
I've added QLDoc to the top of those files. It's fairly minimal, but points users to the files in |
qlformat failed :-/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the qlformat is fixed.
Sorry about that. Should pass this time... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Robert has reviewed, and the tests are passing.
There were four new false positives for
cpp/new-free-mismatch
ing/abseil/abseil-cpp
. The issue was that calls toallocator new
were being misrecognized asmalloc
-style allocations because they were function calls.I've added test cases and tidied some things up as I went along, including deprecating another part of the legacy wrapper
alloc.qll
(something I've been meaning to get around to).I'm thinking about the next step being wrapping the concept of an allocation
kind
("malloc"
,"new"
,"new[]"
) into the models themselves so that we can simplify this and similar code. Perhaps we should also create additionalkind
s for some of the more exotic allocators, so that we can detect more kinds of mismatches.