Extend MallocBugVisitor to place a note at the point where objects with AF_InternalBuffer allocation family are destroyed.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
483 ↗ | (On Diff #152600) | To be honest, I am not sure what was the purpose of the AST based checks in the original version. IMHO, looking at the states only should be sufficient without examining the AST. |
2914 ↗ | (On Diff #152600) | I think these messages should be full sentences starting with a capital letter and ending with a period. |
2988 ↗ | (On Diff #152600) | This new code should only be used for AF_InternalBuffer allocation family? If that is the case, maybe adding an assert here and running it on some large codebases to se if this is triggered would be great. |
2989 ↗ | (On Diff #152600) | LLVM's optional can implicitly convert to bool. I think it is perfectly fine to rely on the implicit conversion here. |
Only minor nits, as usual :)
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
483 ↗ | (On Diff #152600) | Yeah, same. I guess we could replace the check with an assertion (i.e. if there's statement, it's a call or delete-expression and it's AF_InternalBuffer), and see if anything crashes. |
2861 ↗ | (On Diff #152600) | I don't think our check will be limited to STL containers only. We might cover other containers as well, such as LLVM or WebKit custom strings and string views. |
2914 ↗ | (On Diff #152600) | Or exclamantion mark! :) |
2991 ↗ | (On Diff #152600) | PostImplCall->getLocation(). |
Thanks for the comments!
I'll run this on some projects and see if any assertions fail.