In ARC mode, consider Objective-C lifetime types (object pointers and
block pointers) that don't have any qualification to be POD types. We
were previously considering them to be non-POD types, because this was
convenient in C++ for is_pod-like traits. However, we now end up
inferring lifetime in such cases (template arguments infer __strong),
so it is not necessary.
Moreover, we want rvalues of object type (which have their lifetime
stripped) to be PODs to allow, e.g., va_arg(arglist, id) to function
properly. Fixes <rdar://problem/9758798>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134993 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m
index df39687..55b7747 100644
--- a/test/CodeGenObjC/arc.m
+++ b/test/CodeGenObjC/arc.m
@@ -1526,3 +1526,17 @@
// CHECK-NEXT: call void @objc_release(i8* [[T0]])
// CHECK-NEXT: ret void
}
+
+// <rdar://problem/9758798>
+// CHECK: define void @test54(i32 %first, ...)
+void test54(int first, ...) {
+ __builtin_va_list arglist;
+ // CHECK: call void @llvm.va_start
+ __builtin_va_start(arglist, first);
+ // CHECK: call i8* @objc_retain
+ id obj = __builtin_va_arg(arglist, id);
+ // CHECK: call void @llvm.va_end
+ __builtin_va_end(arglist);
+ // CHECK: call void @objc_release
+ // CHECK: ret void
+}