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