[Diagnostics] Warn if ?: with integer constants always evaluates to true
authorDavid Bolvansky <david.bolvansky@gmail.com>
Sun, 22 Sep 2019 22:00:48 +0000 (22:00 +0000)
committerDavid Bolvansky <david.bolvansky@gmail.com>
Sun, 22 Sep 2019 22:00:48 +0000 (22:00 +0000)
commitfb218170b47e08cc8154a82c530757392a0fca18
tree0213401fe15857c447a7625a7ef0f30aef064d64
parent914c4c306d1206670c3486987b55fedc11eccee4
[Diagnostics] Warn if ?: with integer constants always evaluates to true

Extracted from D63082. GCC has this warning under -Wint-in-bool-context, but as noted in the D63082's review, we should put it under TautologicalConstantCompare.

llvm-svn: 372531
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/warn-integer-constants-in-ternary.c [new file with mode: 0644]