Fix crash when emitting NullReturn guards for functions returning BOOL
authorJon Roelofs <jonathan_roelofs@apple.com>
Thu, 21 Jan 2021 21:56:27 +0000 (13:56 -0800)
committerJon Roelofs <jonathan_roelofs@apple.com>
Thu, 21 Jan 2021 22:29:36 +0000 (14:29 -0800)
commit1deee5cacbb76578367186d7ff2937b6fa79b827
tree0dd8873fc13670c6ca2d0555ba33e07bcef86604
parentd75b3719828f3e0c9736476e50a08e5083f90c0b
Fix crash when emitting NullReturn guards for functions returning BOOL

CodeGenModule::EmitNullConstant() creates constants with their "in memory"
type, not their "in vregs" type. The one place where this difference matters is
when the type is _Bool, as that is an i1 when in vregs and an i8 in memory.

Fixes: rdar://73361264
clang/lib/CodeGen/CGObjCMac.cpp
clang/test/CodeGenObjC/null-check-bool-ret.m [new file with mode: 0644]