Implement GCC's -Wint-to-pointer-cast.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 16 Oct 2012 18:53:14 +0000 (18:53 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 16 Oct 2012 18:53:14 +0000 (18:53 +0000)
commit282ad876bd89a7d7ce698ab4128dc8f0a18105cd
tree5dad6bf2a61d47ad89b5586d5f6b67bb3e02efcd
parent794baf6fb7ac22fb4e4954f33f16886a5ab2a540
Implement GCC's -Wint-to-pointer-cast.

This implementation doesn't warn on anything that GCC doesn't warn on with the
exception of templates specializations (GCC doesn't warn, Clang does). The
specific skipped cases (boolean, constant expressions, enums) are open for
debate/adjustment if anyone wants to demonstrate that GCC is being overly
conservative here. The only really obvious false positive I found was in the
Clang regression suite's MPI test - apparently MPI uses specific flag values in
pointer constants. (eg: #define FOO (void*)~0)

llvm-svn: 166039
13 files changed:
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaCast.cpp
clang/test/Analysis/CFContainers.mm
clang/test/Analysis/idempotent-operations.c
clang/test/Analysis/misc-ps-region-store.m
clang/test/Analysis/taint-tester.c
clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp
clang/test/Sema/block-return.c
clang/test/Sema/cast.c
clang/test/Sema/i-c-e.c
clang/test/SemaCXX/cast-conversion.cpp
clang/test/SemaCXX/decl-expr-ambiguity.cpp