This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Enhance misc-suspicious-string-compare to move down false-positives.
ClosedPublic

Authored by etienneb on Apr 25 2016, 2:22 PM.

Details

Summary

The checker was noisy when running over llvm code base.
This patch is impriving the way string-compare functions are matched.

  1. By default, do not report !strcmp(...) unless it's activate by the user,
  2. Only match suspicious expression over a subset of expression (binary operator),
  3. Added matching of macro wrapper used with clang on linux.

See bug: 27465.

Diff Detail

Event Timeline

etienneb updated this revision to Diff 54908.Apr 25 2016, 2:22 PM
etienneb retitled this revision from to [clang-tidy] Enhance misc-suspicious-string-compare to move down false-positives..
etienneb updated this object.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.
alexfh accepted this revision.Apr 26 2016, 6:12 AM
alexfh edited edge metadata.

LG with one nit.

clang-tidy/misc/SuspiciousStringCompareCheck.cpp
215

Can you make the message more specific? It should make it clear, what exactly is "suspicious" in this usage.

This revision is now accepted and ready to land.Apr 26 2016, 6:12 AM
etienneb updated this revision to Diff 55025.Apr 26 2016, 9:57 AM
etienneb marked an inline comment as done.
etienneb edited edge metadata.

address alexfh comments.

etienneb closed this revision.Apr 26 2016, 9:59 AM