[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / externally-retained.m
bloba7d168381e1dd6d842579afa8ebe8a428bec4252
1 // UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
2 // Test for assertion failure due to objc_externally_retained on a function.
4 // Without PCH
5 // RUN: %clang_cc1 -fsyntax-only -verify -fobjc-arc -include %s %s
7 // With PCH
8 // RUN: %clang_cc1 %s -emit-pch -fobjc-arc -o %t
9 // RUN: %clang_cc1 -emit-llvm-only -verify %s -fobjc-arc -include-pch %t -debug-info-kind=limited
11 // expected-no-diagnostics
13 #ifndef HEADER
14 #define HEADER
15 //===----------------------------------------------------------------------===//
16 // Header
18 __attribute__((objc_externally_retained)) void doSomething(id someObject);
20 id sharedObject = 0;
22 //===----------------------------------------------------------------------===//
23 #else
24 //===----------------------------------------------------------------------===//
26 void callDoSomething(void) {
27   doSomething(sharedObject);
30 //===----------------------------------------------------------------------===//
31 #endif