[Sema] Add -Wpointer-compare
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Mon, 5 Aug 2019 22:15:40 +0000 (22:15 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Mon, 5 Aug 2019 22:15:40 +0000 (22:15 +0000)
commitf708f0a2430f3a50b8836f4bd5510169dea359eb
treedcfa191421f4caa3b48c13266d8deef7c764b47f
parentdcdbe6515b21e0f210d087536c6fee74cb9fe37e
[Sema] Add -Wpointer-compare

This patch adds a warning that diagnoses comparisons of pointers to
'\0'. This is often indicative of a bug (e.g. the user might've
forgotten to dereference the pointer).

Patch by Elaina Guan!

Differential Revision: https://reviews.llvm.org/D65595

llvm-svn: 367940
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/warn-nullchar-nullptr.c [new file with mode: 0644]