[clang][Sema] Use size of char in bits for void types
authorBill Wendling <morbo@google.com>
Fri, 14 Oct 2022 21:20:54 +0000 (14:20 -0700)
committerBill Wendling <morbo@google.com>
Fri, 14 Oct 2022 21:46:19 +0000 (14:46 -0700)
commit91b3823bd000b1a6ffde96a6363098f59307317a
treeeb97d0105f8689a3ac326c13f3c401bc3bcd6004
parent6eb205b25771739f9bd54dd3a55af8dfa0776ef7
[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
clang/lib/Sema/SemaChecking.cpp
clang/test/Sema/array-bounds-ptr-arith.c