[PATCH] D72231: [Sema] Adds the pointer-to-int-cast diagnostic
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 5 11:43:49 PST 2020
Mordante created this revision.
Mordante added reviewers: dblaikie, rsmith.
Mordante added a project: clang.
Converting a pointer to an integer whose result cannot represented in the integer type is undefined behavior is C and prohibited in C++. C++ already has a diagnostic when casting. This adds a diagnostic for C.
The diagnostic is not enabled by default due to the number of diagnostics it triggered while running the tests.
Since this diagnostic uses the range of the conversion it also modifies int-to-pointer-cast diagnostic to use a range.
Fixes PR8718: No warning on casting between pointer and non-pointer-sized int
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72231
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaCast.cpp
clang/test/Sema/cast.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72231.236256.patch
Type: text/x-patch
Size: 6618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200105/72d44989/attachment.bin>
More information about the cfe-commits
mailing list