[PATCH] D64600: [ObjC] Add an attribute that "clamps" signed char BOOLs to {0,1}
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 11 15:12:39 PDT 2019
erik.pilkington created this revision.
erik.pilkington added reviewers: rjmccall, aaron.ballman, steven_wu.
Herald added subscribers: dexonsmith, jkorous.
Herald added a project: clang.
This attribute can be applied to typedefs of BOOL in Objective-C. It causes loads, stores, and casts to BOOL to clamp into {0,1}. This is useful for us because a lot of code is going to be moving from a platform where BOOL is a typedef for a native bool type (iOS) to a platform where its a typedef for signed char (macOS) because of macCatalyst. We can't change the type of the BOOL, since its ABI.
rdar://6510042
Thanks for taking a look!
Erik
Repository:
rC Clang
https://reviews.llvm.org/D64600
Files:
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/AST/TypePrinter.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Sema/SemaType.cpp
clang/test/CodeGenObjC/objc-clamping-bool.m
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaObjC/objc-clamping-bool.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64600.209350.patch
Type: text/x-patch
Size: 13467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190711/69692b99/attachment-0001.bin>
More information about the cfe-commits
mailing list