[all-commits] [llvm/llvm-project] 9658d8: [Sema] Adds the pointer-to-int-cast diagnostic

mordante via All-commits all-commits at lists.llvm.org
Sun Feb 16 06:40:36 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9658d895c81aeb849b412b9332c88769588c7660
      https://github.com/llvm/llvm-project/commit/9658d895c81aeb849b412b9332c88769588c7660
  Author: Mark de Wever <koraq at xs4all.nl>
  Date:   2020-02-16 (Sun, 16 Feb 2020)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaCast.cpp
    M clang/test/Analysis/bstring.c
    M clang/test/Analysis/casts.c
    M clang/test/Analysis/misc-ps.c
    M clang/test/Analysis/misc-ps.m
    M clang/test/Analysis/ptr-arith.c
    M clang/test/Analysis/svalbuilder-logic.c
    M clang/test/Analysis/symbol-reaper.c
    M clang/test/CodeGen/const-init.c
    M clang/test/Sema/MicrosoftExtensions.c
    M clang/test/Sema/block-return.c
    M clang/test/Sema/cast.c
    M clang/test/Sema/const-eval.c
    M clang/test/Sema/init.c
    M clang/test/Sema/offsetof.c
    M clang/test/Sema/static-init.c
    M clang/test/Sema/struct-decl.c
    M clang/test/SemaObjC/arc.m
    M clang/test/SemaObjC/gcc-cast-ext.m
    M clang/test/SemaObjC/protocol-archane.m

  Log Message:
  -----------
  [Sema] Adds the pointer-to-int-cast diagnostic

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.

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

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




More information about the All-commits mailing list