@@ -76,29 +76,32 @@ declaration: Namespace - root
76
76
type: Record - S
77
77
)" },
78
78
{R"cpp(
79
- template <typename T> int root() {
80
- (void)root<unsigned>();
79
+ namespace root {
80
+ template <typename T> int tmpl() {
81
+ (void)tmpl<unsigned>();
81
82
return T::value;
83
+ }
82
84
}
83
85
)cpp" ,
84
86
R"(
85
- declaration: FunctionTemplate - root
86
- declaration: TemplateTypeParm - T
87
- declaration: Function - root
88
- type: FunctionProto
89
- type: Builtin - int
90
- statement: Compound
91
- expression: CStyleCast - ToVoid
92
- type: Builtin - void
93
- expression: Call
94
- expression: ImplicitCast - FunctionToPointerDecay
95
- expression: DeclRef - root
96
- template argument: Type
97
- type: Builtin - unsigned int
98
- statement: Return
99
- expression: DependentScopeDeclRef - value
100
- specifier: TypeSpec
101
- type: TemplateTypeParm - T
87
+ declaration: Namespace - root
88
+ declaration: FunctionTemplate - tmpl
89
+ declaration: TemplateTypeParm - T
90
+ declaration: Function - tmpl
91
+ type: FunctionProto
92
+ type: Builtin - int
93
+ statement: Compound
94
+ expression: CStyleCast - ToVoid
95
+ type: Builtin - void
96
+ expression: Call
97
+ expression: ImplicitCast - FunctionToPointerDecay
98
+ expression: DeclRef - tmpl
99
+ template argument: Type
100
+ type: Builtin - unsigned int
101
+ statement: Return
102
+ expression: DependentScopeDeclRef - value
103
+ specifier: TypeSpec
104
+ type: TemplateTypeParm - T
102
105
)" },
103
106
{R"cpp(
104
107
struct Foo { char operator+(int); };
@@ -116,10 +119,28 @@ declaration: Var - root
116
119
type: Record - Foo
117
120
expression: IntegerLiteral - 42
118
121
)" },
122
+ {R"cpp(
123
+ struct Bar {
124
+ int x;
125
+ int root() const {
126
+ return x;
127
+ }
128
+ };
129
+ )cpp" ,
130
+ R"(
131
+ declaration: CXXMethod - root
132
+ type: FunctionProto
133
+ type: Builtin - int
134
+ statement: Compound
135
+ statement: Return
136
+ expression: ImplicitCast - LValueToRValue
137
+ expression: Member - x
138
+ expression: CXXThis - const, implicit
139
+ )" },
119
140
};
120
141
for (const auto &Case : Cases) {
121
142
ParsedAST AST = TestTU::withCode (Case.first ).build ();
122
- auto Node = dumpAST (DynTypedNode::create (findDecl (AST, " root" )),
143
+ auto Node = dumpAST (DynTypedNode::create (findUnqualifiedDecl (AST, " root" )),
123
144
AST.getTokens (), AST.getASTContext ());
124
145
EXPECT_EQ (llvm::StringRef (Case.second ).trim (),
125
146
llvm::StringRef (llvm::to_string (Node)).trim ());
0 commit comments