1 // RUN: %clang_cc1 -ast-dump=json %s | FileCheck -strict-whitespace %s
4 explicit ExplicitBase(const char *) { }
5 ExplicitBase(const ExplicitBase
&) {}
6 ExplicitBase(ExplicitBase
&&) {}
7 ExplicitBase
&operator=(const ExplicitBase
&) { return *this; }
8 ExplicitBase
&operator=(ExplicitBase
&&) { return *this; }
12 struct Derived1
: ExplicitBase
{};
14 Derived1
makeDerived1() {
15 // CHECK: "kind": "FunctionDecl",
16 // CHECK: "name": "makeDerived1",
18 // CHECK: "kind": "CompoundStmt",
20 // CHECK: "kind": "ReturnStmt",
21 // CHECK: "kind": "ExprWithCleanups",
23 // CHECK-NEXT: "qualType": "Derived1"
26 // CHECK: "kind": "CXXFunctionalCastExpr",
28 // CHECK-NEXT: "qualType": "Derived1"
30 // CHECK-NEXT: "valueCategory": "prvalue",
31 // CHECK-NEXT: "castKind": "NoOp",
33 // CHECK: "kind": "CXXBindTemporaryExpr",
35 // CHECK-NEXT: "qualType": "Derived1"
37 // CHECK-NEXT: "valueCategory": "prvalue",
39 // CHECK: "kind": "InitListExpr",
41 // CHECK-NEXT: "qualType": "Derived1"
43 // CHECK-NEXT: "valueCategory": "prvalue",
45 // CHECK: "kind": "CXXConstructExpr",
47 // CHECK-NEXT: "qualType": "ExplicitBase"
49 // CHECK-NEXT: "valueCategory": "prvalue",
50 // CHECK-NEXT: "ctorType": {
51 // CHECK-NEXT: "qualType": "void (ExplicitBase &&)"
53 // CHECK-NEXT: "hadMultipleCandidates": true,
54 // CHECK-NEXT: "constructionKind": "non-virtual base",
56 // CHECK: "kind": "MaterializeTemporaryExpr",
58 // CHECK-NEXT: "qualType": "ExplicitBase"
60 // CHECK-NEXT: "valueCategory": "xvalue",
61 // CHECK-NEXT: "storageDuration": "full expression",
63 // CHECK: "kind": "CXXBindTemporaryExpr",
65 // CHECK-NEXT: "qualType": "ExplicitBase"
67 // CHECK-NEXT: "valueCategory": "prvalue",
69 // CHECK: "kind": "CXXTemporaryObjectExpr",
71 // CHECK-NEXT: "qualType": "ExplicitBase"
73 // CHECK-NEXT: "valueCategory": "prvalue",
74 // CHECK-NEXT: "ctorType": {
75 // CHECK-NEXT: "qualType": "void (const char *)"
77 // CHECK-NEXT: "list": true,
78 // CHECK-NEXT: "hadMultipleCandidates": true,
79 // CHECK-NEXT: "constructionKind": "complete",
81 // CHECK: "kind": "ImplicitCastExpr",
83 // CHECK-NEXT: "qualType": "const char *"
85 // CHECK-NEXT: "valueCategory": "prvalue",
86 // CHECK-NEXT: "castKind": "ArrayToPointerDecay",
88 // CHECK: "kind": "StringLiteral",
90 // CHECK-NEXT: "qualType": "const char[10]"
92 // CHECK-NEXT: "valueCategory": "lvalue",
93 // CHECK-NEXT: "value": "\"Move Ctor\""
94 return Derived1
{ExplicitBase
{"Move Ctor"}};
98 ImplicitBase(const char *) { }
99 ImplicitBase(const ImplicitBase
&) {}
100 ImplicitBase(ImplicitBase
&&) {}
101 ImplicitBase
&operator=(const ImplicitBase
&) { return *this; }
102 ImplicitBase
&operator=(ImplicitBase
&&) { return *this; }
106 struct Derived2
: ImplicitBase
{};
108 Derived2
makeDerived2() {
109 // CHECK: "kind": "FunctionDecl",
110 // CHECK: "name": "makeDerived2",
112 // CHECK: "kind": "CompoundStmt",
114 // CHECK: "kind": "ReturnStmt",
116 // CHECK: "kind": "ExprWithCleanups",
118 // CHECK-NEXT: "qualType": "Derived2"
120 // CHECK-NEXT: "valueCategory": "prvalue",
121 // CHECK-NEXT: "cleanupsHaveSideEffects": true,
123 // CHECK: "kind": "CXXFunctionalCastExpr",
125 // CHECK-NEXT: "qualType": "Derived2"
127 // CHECK-NEXT: "valueCategory": "prvalue",
128 // CHECK-NEXT: "castKind": "NoOp",
130 // CHECK: "kind": "CXXBindTemporaryExpr",
132 // CHECK-NEXT: "qualType": "Derived2"
134 // CHECK-NEXT: "valueCategory": "prvalue",
136 // CHECK: "kind": "InitListExpr",
138 // CHECK-NEXT: "qualType": "Derived2"
140 // CHECK-NEXT: "valueCategory": "prvalue",
142 // CHECK: "kind": "CXXConstructExpr",
144 // CHECK-NEXT: "qualType": "ImplicitBase"
146 // CHECK-NEXT: "valueCategory": "prvalue",
147 // CHECK-NEXT: "ctorType": {
148 // CHECK-NEXT: "qualType": "void (const char *)"
150 // CHECK-NEXT: "list": true,
151 // CHECK-NEXT: "hadMultipleCandidates": true,
152 // CHECK-NEXT: "constructionKind": "non-virtual base",
154 // CHECK: "kind": "ImplicitCastExpr",
156 // CHECK-NEXT: "qualType": "const char *"
158 // CHECK-NEXT: "valueCategory": "prvalue",
159 // CHECK-NEXT: "castKind": "ArrayToPointerDecay",
161 // CHECK: "kind": "StringLiteral",
163 // CHECK-NEXT: "qualType": "const char[8]"
165 // CHECK-NEXT: "valueCategory": "lvalue",
166 // CHECK-NEXT: "value": "\"No Ctor\""
167 return Derived2
{{"No Ctor"}};
170 // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
171 // using --filters=FunctionDecl,CompoundStmt,ReturnStmt,MaterializeTemporaryExpr,CXXBindTemporaryExpr,CXXTemporaryObjectExpr,ImplicitCastExpr,StringLiteralStringLiteral