diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2014-10-23 19:00:10 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-10-23 19:00:10 +0000 |
commit | f05cbec617a4dccc9c8301eb238a2f8ecefbae99 (patch) | |
tree | a06d7a115ee74e303bffe93ad9d88dac46a409ae /include/clang/Basic/DiagnosticSemaKinds.td | |
parent | 854931f5dafff52c3f2f431dfdf1b0ba1cddc6bc (diff) |
patch to issue warning on comparing parameters with
nonnull attribute when comparison is always
true/false. Patch by Steven Wu with few fixes and minor
refactoring and adding tests by me. rdar://18712242
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220496 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/DiagnosticSemaKinds.td')
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index e6ad4b54bd..8197f7d69e 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -2500,6 +2500,10 @@ def warn_impcast_pointer_to_bool : Warning< "address of%select{| function| array}0 '%1' will always evaluate to " "'true'">, InGroup<PointerBoolConversion>; +def warn_cast_nonnull_to_bool : Warning< + "nonnull parameter '%0' will always evaluate to " + "'true'">, + InGroup<PointerBoolConversion>; def warn_this_bool_conversion : Warning< "'this' pointer cannot be null in well-defined C++ code; pointer may be " "assumed to always convert to true">, InGroup<UndefinedBoolConversion>; @@ -2512,6 +2516,10 @@ def warn_null_pointer_compare : Warning< "comparison of %select{address of|function|array}0 '%1' %select{not |}2" "equal to a null pointer is always %select{true|false}2">, InGroup<TautologicalPointerCompare>; +def warn_nonnull_parameter_compare : Warning< + "comparison of nonnull parameter '%0' %select{not |}1" + "equal to a null pointer is always %select{true|false}1">, + InGroup<TautologicalPointerCompare>; def warn_this_null_compare : Warning< "'this' pointer cannot be null in well-defined C++ code; comparison may be " "assumed to always evaluate to %select{true|false}0">, |