xref: /aosp_15_r20/external/clang/test/CodeGenObjCXX/lvalue-reference-getter.mm (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
2*67e74705SXin Li// rdar://10153365
3*67e74705SXin Li
4*67e74705SXin Listatic int gint;
5*67e74705SXin Listruct SetSection {
6*67e74705SXin Li      int & at(int __n) { return gint; }
7*67e74705SXin Li      const int& at(int __n) const { return gint; }
8*67e74705SXin Li};
9*67e74705SXin Li
10*67e74705SXin Listatic SetSection gSetSection;
11*67e74705SXin Li
12*67e74705SXin Li@interface SetShow
13*67e74705SXin Li- (SetSection&)sections;
14*67e74705SXin Li@end
15*67e74705SXin Li
16*67e74705SXin Li@implementation SetShow
17*67e74705SXin Li- (SetSection&) sections {
18*67e74705SXin Li//  [self sections].at(100);
19*67e74705SXin Li    self.sections.at(100);
20*67e74705SXin Li   return gSetSection;
21*67e74705SXin Li}
22*67e74705SXin Li@end
23*67e74705SXin Li
24*67e74705SXin Li// CHECK: [[SELF:%.*]] = alloca [[T6:%.*]]*, align
25*67e74705SXin Li// CHECK: [[T0:%.*]] = load {{.*}}, {{.*}}* [[SELF]], align
26*67e74705SXin Li// CHECK: [[T1:%.*]] = load {{.*}}, {{.*}}* @OBJC_SELECTOR_REFERENCES_
27*67e74705SXin Li// CHECK: [[C:%.*]] = call dereferenceable({{[0-9]+}}) %struct.SetSection* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
28*67e74705SXin Li// CHECK: call dereferenceable({{[0-9]+}}) i32* @_ZN10SetSection2atEi(%struct.SetSection* [[C]]
29