// enclosing block scope.
// FIXME: We only have to do this if the argument is a temporary, which
// gets released after the full expression.
- if (TheExpr->getType()->isObjCRetainableType()) {
+ if (TheExpr->getType()->isObjCRetainableType() &&
+ getLangOpts().ObjCAutoRefCount) {
assert(getEvaluationKind(TheExpr->getType()) == TEK_Scalar &&
"Only scalar can be a ObjC retainable type");
if (!isa<Constant>(ArgVal)) {
// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fno-experimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-LEGACY
// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 -fexperimental-new-pass-manager | FileCheck %s --check-prefixes=CHECK,CHECK-NEWPM
// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O0 | FileCheck %s -check-prefix=CHECK-O0
+// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -O2 -disable-llvm-passes | FileCheck %s -check-prefix=CHECK-MRR
// Make sure we emit clang.arc.use before calling objc_release as part of the
// cleanup. This way we make sure the object will not be released until the
// CHECK-O0: call void @llvm.objc.storeStrong(i8** %[[V13]], i8* null)
// CHECK-O0: call void @llvm.objc.storeStrong(i8** %[[A_ADDR]], i8* null)
+// CHECK-MRR: define void @test_builtin_os_log2(
+// CHECK-MRR-NOT: call {{.*}} @llvm.objc
+
void test_builtin_os_log2(void *buf, id a) {
__builtin_os_log_format(buf, "capabilities: %@ %@", GenString(), a);
os_log_pack_send(buf);