[PATCH] D77070: [SemaObjC] Add a warning for declarations of BOOL:1 when BOOL is a signed char

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 09:44:19 PDT 2020


erik.pilkington created this revision.
erik.pilkington added reviewers: rjmccall, steven_wu.
Herald added subscribers: ributzka, dexonsmith, jkorous.

Instead, recommend using a real boolean type. Its possible to get away with BOOL:1, if you only read from it in a context where its contextually converted to bool, but its still broken if you, for instance, store it into a BOOL variable or try to compare it with another BOOL. Given that, I don't think there is any good reason to use it when there are better alternatives available.

rdar://29707989


https://reviews.llvm.org/D77070

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/test/SemaObjC/signed-char-bool-bitfield-fixit.m
  clang/test/SemaObjC/signed-char-bool-bitfield.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77070.253608.patch
Type: text/x-patch
Size: 5506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200330/dda3e1e4/attachment-0001.bin>


More information about the cfe-commits mailing list