]> granicus.if.org Git - clang/commit
[objc] Don't require null-check and don't emit memset when result is ignored for...
authorKuba Mracek <mracek@apple.com>
Fri, 30 Jun 2017 16:28:15 +0000 (16:28 +0000)
committerKuba Mracek <mracek@apple.com>
Fri, 30 Jun 2017 16:28:15 +0000 (16:28 +0000)
commitfc0baba7f6ae7a67b39c2375bfbbb7948a10b026
tree126b3de1536316bf9df5d1bdc20064417eb6482c
parent75ec5aa40177caeb6531afab8c0757183dddc101
[objc] Don't require null-check and don't emit memset when result is ignored for struct-returning method calls [clang part]

This fixes an issue with the emission of lifetime markers for struct-returning Obj-C msgSend calls. When the result of a struct-returning call is ignored, the temporary storage is only marked with lifetime markers in one of the two branches of the nil-receiver-check. The check is, however, not required when the result is unused. If we still need to emit the check (due to consumer arguments), let's not emit the memset to zero out the result if it's unused. This fixes a use-after-scope false positive with AddressSanitizer.

Differential Revision: https://reviews.llvm.org/D34834

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306837 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGObjCMac.cpp
test/CodeGenObjC/stret-1.m
test/CodeGenObjC/stret-lifetime.m [new file with mode: 0644]