[analyzer] Improve warning messages and notes of InnerPointerChecker
ClosedPublic

Authored by rnkovacs on Thu, Jul 19, 3:04 PM.

Details

Diff Detail

Repository
rL LLVM
rnkovacs created this revision.Thu, Jul 19, 3:04 PM
NoQ added inline comments.Thu, Jul 19, 6:30 PM
lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp
253 ↗(On Diff #156366)

dyn_cast may fail by returning a null pointer. This either needs to be changed to cast or there needs to be a check for a null pointer before use. I guess it should be a cast because you're only acting on typed regions in the checker itself.

lib/StaticAnalyzer/Checkers/MallocChecker.cpp
2931–2932 ↗(On Diff #156366)

Cool stuff!

test/Analysis/dangling-internal-buffer.cpp
63 ↗(On Diff #156366)

Mm, nono, there's no return statement here, so we shouldn't say that our pointer is returned to the caller. Whether it should say "returned to the caller" or not, should not depend on the allocation family, but on the kind of "use" we encounter "after" "free".

75 ↗(On Diff #156366)

I suggest a shorter on a 'std::string' instead of on 'std::string' object.

rnkovacs updated this revision to Diff 160193.Fri, Aug 10, 3:46 PM
rnkovacs marked 3 inline comments as done.

Address comments & rebase.

rnkovacs marked an inline comment as done.Fri, Aug 10, 3:47 PM
rnkovacs added inline comments.
lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp
253 ↗(On Diff #156366)

I hope that in a few more reviews I'll learn to use all of these properly.

lib/StaticAnalyzer/Checkers/MallocChecker.cpp
2931–2932 ↗(On Diff #156366)

:)

test/Analysis/dangling-internal-buffer.cpp
63 ↗(On Diff #156366)

I don't even know how this went so off, sorry.

rnkovacs retitled this revision from [analyzer] Improve warning messages and notes of DanglingInternalBufferChecker to [analyzer] Improve warning messages and notes of InnerPointerChecker.Fri, Aug 10, 3:51 PM
NoQ accepted this revision.Fri, Aug 10, 4:06 PM

I think this is way easier to understand :)

This revision is now accepted and ready to land.Fri, Aug 10, 4:06 PM
This revision was automatically updated to reflect the committed changes.