This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Detect bugs in bugprone-misplaced-operator-in-strlen-in-alloc even in the case the allocation function is called using a constant function pointer
ClosedPublic

Authored by baloghadamsoftware on Oct 27 2017, 6:09 AM.

Details

Summary

Detect bugs even if a function of the malloc() family is called using a constant pointer.

Diff Detail

Event Timeline

aaron.ballman accepted this revision.Oct 30 2017, 9:25 AM

LGTM

FYI: it's been difficult to perform this review because all of these reviews are touching the same chunk of code for something that's not been committed yet. It would be easier to review if all of these reviews were combined into the review adding the check.

This revision is now accepted and ready to land.Oct 30 2017, 9:25 AM

LGTM

FYI: it's been difficult to perform this review because all of these reviews are touching the same chunk of code for something that's not been committed yet. It would be easier to review if all of these reviews were combined into the review adding the check.

I am also working for the Static Analyzer where I received the comment that development should be incremental to avoid huge patches. So I tried to use the same approach here as well.

LGTM

FYI: it's been difficult to perform this review because all of these reviews are touching the same chunk of code for something that's not been committed yet. It would be easier to review if all of these reviews were combined into the review adding the check.

I am also working for the Static Analyzer where I received the comment that development should be incremental to avoid huge patches. So I tried to use the same approach here as well.

Incremental is definitely the way to go, but that's usually to prevent massive code dumps of large-scale functionality. For a single, relatively small check like this, I think it's fine to add all of this into one review because it's all so tightly related.