[all-commits] [llvm/llvm-project] 91b382: [clang][Sema] Use size of char in bits for void types

Bill Wendling via All-commits all-commits at lists.llvm.org
Fri Oct 14 14:46:44 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 91b3823bd000b1a6ffde96a6363098f59307317a
      https://github.com/llvm/llvm-project/commit/91b3823bd000b1a6ffde96a6363098f59307317a
  Author: Bill Wendling <morbo at google.com>
  Date:   2022-10-14 (Fri, 14 Oct 2022)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Sema/array-bounds-ptr-arith.c

  Log Message:
  -----------
  [clang][Sema] Use size of char in bits for void types

The extension that allows for pointer arithmetic on 'void' types treats
the 'void' as a 'char'. We should use the 'char' size in bits instead of
1 (the number of bytes) to allow warning when pointer arithmetic would
go out of bounds.

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




More information about the All-commits mailing list