This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Improve FuchsiaHandleChecker's diagnostic messages
ClosedPublic

Authored by xazax.hun on Jan 22 2020, 2:14 PM.

Details

Summary

I found that this information is useful when trying to understand bug reports. Moreover other checks seem to also report parameter indices.

Diff Detail

Event Timeline

xazax.hun created this revision.Jan 22 2020, 2:14 PM
NoQ accepted this revision.Jan 23 2020, 8:36 AM

Nice! These are indeed useful when multiple things can happen. You may also consider adding stack hints a-la MallocChecker (i.e., "Returning; handle was closed").

clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
314

I think this commend would have actually made a better note text. Maybe mention the function name as well, "Function foo() returns an open handle".

355

I think we often use "through" in this context. I.e., "Handle released through 2nd parameter".

359

What was wrong with good old ""?

This revision is now accepted and ready to land.Jan 23 2020, 8:36 AM
xazax.hun marked an inline comment as done.Jan 23 2020, 8:42 AM
xazax.hun added inline comments.
clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
359

I had two returns with different types so I either need to specify the return type of the lambda explicitly or make the two returns return the same type.

NoQ added inline comments.Jan 23 2020, 8:44 AM
clang/lib/StaticAnalyzer/Checkers/FuchsiaHandleChecker.cpp
359

Oh, right.

I think i specified the return type explicitly in most places but that's not a must.

This revision was automatically updated to reflect the committed changes.