Page MenuHomePhabricator

[analyzer] Refer to macro names in diagnostics for macros representing a literal
ClosedPublic

Authored by zaks.anna on Dec 13 2016, 12:50 PM.

Details

Summary

When a macro expending to a literal is used in a comparison, use the macro name in the diagnostic rather than the literal. This improves readability of path notes.

Added tests for various macro literals that could occur. Only BOOl, Int, and NULL tests have changed behavior with this patch.

Diff Detail

Repository
rL LLVM

Event Timeline

zaks.anna updated this revision to Diff 81277.Dec 13 2016, 12:50 PM
zaks.anna retitled this revision from to [analyzer] Refer to macro names in diagnostics for macros representing a literal.
zaks.anna updated this object.
zaks.anna added reviewers: dergachev.a, dcoughlin.
zaks.anna added a subscriber: cfe-commits.
dcoughlin accepted this revision.Dec 13 2016, 2:09 PM
dcoughlin edited edge metadata.

The diagnostics look great to me and the macro logic seems reasonable.

test/Analysis/diagnostics/macros.cpp
49 ↗(On Diff #81277)

Missing newline?

This revision is now accepted and ready to land.Dec 13 2016, 2:09 PM
This revision was automatically updated to reflect the committed changes.