Commit Graph

4 Commits

Author SHA1 Message Date
Jordan Rose 6f2f39006b [analyzer] Misc. tidying in IdenticalExprChecker.
Some things I missed when this first went in.

llvm-svn: 196938
2013-12-10 18:18:10 +00:00
Jordan Rose 60bd88d341 [analyzer] Extend IdenticalExprChecker to check ternary operator results.
Warn if both result expressions of a ternary operator (? :) are the same.
Because only one of them will be executed, this warning will fire even if
the expressions have side effects.

Patch by Anders Rönnholm and Per Viberg!

llvm-svn: 196937
2013-12-10 18:18:06 +00:00
Benjamin Kramer e8a2c18bc7 Move classes into anonymous namespaces.
llvm-svn: 194706
2013-11-14 15:46:10 +00:00
Jordan Rose 51327f9237 [analyzer] Add IdenticalExprChecker, to find copy-pasted code.
This syntactic checker looks for expressions on both sides of comparison
operators that are structurally the same. As a special case, the
floating-point idiom "x != x" for "isnan(x)" is left alone.

Currently this only checks comparison operators, but in the future we could
extend this to include logical operators or chained if-conditionals.

Checker by Per Viberg!

llvm-svn: 194236
2013-11-08 01:15:39 +00:00