[PATCH] D63912: [ObjC] Add a warning for implicit conversions of a constant non-boolean value to BOOL

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 27 17:31:05 PDT 2019


erik.pilkington created this revision.
erik.pilkington added reviewers: rjmccall, steven_wu.
Herald added subscribers: dexonsmith, jkorous.
Herald added a project: clang.
erik.pilkington added a reviewer: arphaman.

On macOS, BOOL is a typedef for signed char, but it should never hold a value that isn't 1 or 0. Any code that expects a different value in their BOOL should be fixed. See also D63856 <https://reviews.llvm.org/D63856>.

rdar://problem/51954400 ObjC: Add diagnostics to catch incorrect usage of BOOL


Repository:
  rC Clang

https://reviews.llvm.org/D63912

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/objc-bool-constant-conversion-fixit.m
  clang/test/Sema/objc-bool-constant-conversion.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63912.206973.patch
Type: text/x-patch
Size: 5497 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190628/88a871de/attachment-0001.bin>


More information about the cfe-commits mailing list