1 // RUN: %clang_cc1 -std=c++11 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s
2 // Test (r)value and CVR qualifiers on C++11 non-static member functions.
3 class A {
4 public:
5   // CHECK: !MDSubprogram(name: "l",
6   // CHECK-SAME:          line: [[@LINE+4]]
7   // CHECK-SAME:          type: ![[PLSR:[0-9]+]]
8   // CHECK-SAME:          flags: DIFlagPublic | DIFlagPrototyped | DIFlagLValueReference,
9   // CHECK: ![[PLSR]] = !MDSubroutineType(flags: DIFlagLValueReference, types: ![[ARGS:[0-9]+]])
10   void l() const &;
11   // CHECK: ![[ARGS]] = !{null, ![[THIS:[0-9]+]]}
12   // CHECK: ![[THIS]] = !MDDerivedType(tag: DW_TAG_pointer_type, baseType: ![[CONST_A:[0-9]+]]
13   // CHECK: ![[CONST_A]] = !MDDerivedType(tag: DW_TAG_const_type
14   // CHECK: !MDSubprogram(name: "r"
15   // CHECK-SAME:          line: [[@LINE+4]]
16   // CHECK-SAME:          type: ![[PRSR:[0-9]+]]
17   // CHECK-SAME:          flags: DIFlagPublic | DIFlagPrototyped | DIFlagRValueReference,
18   // CHECK: ![[PRSR]] = !MDSubroutineType(flags: DIFlagRValueReference, types: ![[ARGS]])
19   void r() const &&;
20 };
21 
g()22 void g() {
23   A a;
24   // The type of pl is "void (A::*)() const &".
25   // CHECK: !MDLocalVariable(tag: DW_TAG_auto_variable, name: "pl",
26   // CHECK-SAME:             line: [[@LINE+3]]
27   // CHECK-SAME:             type: ![[PL:[0-9]+]]
28   // CHECK: !MDDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: ![[PLSR]]
29   auto pl = &A::l;
30 
31   // CHECK: !MDLocalVariable(tag: DW_TAG_auto_variable, name: "pr",
32   // CHECK-SAME:             line: [[@LINE+3]]
33   // CHECK-SAME:             type: ![[PR:[0-9]+]]
34   // CHECK: !MDDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: ![[PRSR]]
35   auto pr = &A::r;
36 }
37