mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL already does this where necessary, except with foreign throwing functions; this patch changes Sema and the ClangImporter to give them an ObjCBool foreign error result type explicitly. This fixes a problem where calls to functions taking and returning the C99 _Bool type were miscompiled on Mac OS X x86-64, because IRGen was conflating the Objective-C BOOL type (which is a signed char on some platforms) and C99 _Bool (which lowers as the LLVM i1 type). Fixes <rdar://problem/26506458> and <rdar://problem/27365520>.
16 lines
431 B
Swift
16 lines
431 B
Swift
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
//
|
|
// RUN: %target-clang -fobjc-arc %S/Inputs/ObjCClasses/ObjCClasses.m -c -o %t/ObjCClasses.o
|
|
// RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ -Xlinker %t/ObjCClasses.o %s -o %t/a.out
|
|
// RUN: %target-run %t/a.out
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: objc_interop
|
|
|
|
import ObjCClasses
|
|
import Foundation
|
|
|
|
TestingBool().shouldBeTrueObjCBool(true)
|
|
TestingBool().shouldBeTrueCBool(true)
|