]> granicus.if.org Git - clang/commit
Implement -Wenum-compare, which warns when comparing two enums of
authorChandler Carruth <chandlerc@gmail.com>
Thu, 17 Feb 2011 08:37:06 +0000 (08:37 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 17 Feb 2011 08:37:06 +0000 (08:37 +0000)
commit543cb655b174087f6c2d22009934c9fed6c32114
tree61c99e83fd8f8c1bf5683f7ba470c7a92fa74f16
parent8755836379a3f8e9848b5e770aa60d00e1fbb990
Implement -Wenum-compare, which warns when comparing two enums of
different types. We omit the warning when the enum types are anonymous.
Unlike GCC, this warning does not distinguish between C++ and C/ObjC for
controling whether it is on by default, it is always on by default.

Original patch contributed by Richard Trieu (@ Google), I fixed some
style issues, and cleaned it up for submission.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125739 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp
test/SemaCXX/overloaded-operator.cpp
test/SemaCXX/warn-enum-compare.cpp [new file with mode: 0644]