SIL: Consider the original Clang type of a decl before bridging Bool back to ObjCBool.

It's not always correct to map a Swift Bool back to ObjCBool in C land, since Bool could have originally been a proper _Bool. Pass the clang::Decl down to type lowering so we can recognize this. We still don't have a great solution for block types, because there's no decl to refer to, and Swift's user-level type system erases the distinction between void(^)(_Bool) and void(^)(BOOL). However, this is enough to let us start using C APIs that traffic in _Bool.

Swift SVN r23546
This commit is contained in:
Joe Groff
2014-11-22 05:21:55 +00:00
parent 24fd14a54d
commit f8dfcaa84e
10 changed files with 191 additions and 66 deletions

View File

@@ -27,6 +27,9 @@
- (BOOL) zim;
- (void) setZim: (BOOL)b;
- (_Bool) zang;
- (void) setZang: (_Bool)b;
@end
NSString *bar(void);
@@ -38,4 +41,9 @@ NSString *NSStringFromClass(Class c);
#define CF_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#define NS_ENUM(_type, _name) CF_ENUM(_type, _name)
BOOL getBOOL(void);
_Bool getBool(void);
void useBOOL(BOOL x);
void useBool(_Bool x);