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

@@ -2325,13 +2325,14 @@ getWitnessFunctionType(SILModule &M,
CanType origLoweredTy;
if (auto origFTy = dyn_cast<AnyFunctionType>(origRequirementTy.getAsType()))
origLoweredTy = M.Types.getLoweredASTFunctionType(origFTy,
uncurryLevel);
uncurryLevel,
None);
else
origLoweredTy = origRequirementTy.getAsType();
auto witnessLoweredTy
= M.Types.getLoweredASTFunctionType(witnessSubstTy, uncurryLevel);
= M.Types.getLoweredASTFunctionType(witnessSubstTy, uncurryLevel, None);
auto witnessLoweredIfaceTy
= M.Types.getLoweredASTFunctionType(witnessSubstIfaceTy, uncurryLevel);
= M.Types.getLoweredASTFunctionType(witnessSubstIfaceTy, uncurryLevel, None);
// Convert to SILFunctionType.
auto fnTy = getNativeSILFunctionType(M, origLoweredTy,