26
26
#include < clang/Index/USRGeneration.h>
27
27
#include < clang/Lex/Lexer.h>
28
28
#include < llvm/ADT/Hashing.h>
29
- #include < llvm/ADT/Optional.h>
30
29
#include < llvm/ADT/StringExtras.h>
31
30
#include < llvm/Support/Error.h>
32
31
#include < llvm/Support/Path.h>
@@ -65,9 +64,9 @@ ASTVisitor(
65
64
// a relatively small amount of memory (vs storing
66
65
// USRs directly).
67
66
//
68
- static
69
67
SymbolID
70
- getUSRForDecl (
68
+ ASTVisitor::
69
+ getSymbolID (
71
70
Decl const * D)
72
71
{
73
72
llvm::SmallString<128 > USR;
@@ -78,8 +77,8 @@ getUSRForDecl(
78
77
79
78
// ------------------------------------------------
80
79
81
- static
82
80
bool
81
+ ASTVisitor::
83
82
shouldSerializeInfo (
84
83
bool PublicOnly,
85
84
bool IsInAnonymousNamespace,
@@ -106,8 +105,8 @@ shouldSerializeInfo(
106
105
107
106
// ------------------------------------------------
108
107
109
- static
110
108
void
109
+ ASTVisitor::
111
110
getParent (
112
111
SymbolID& parent,
113
112
Decl const * D)
@@ -121,19 +120,19 @@ getParent(
121
120
{
122
121
isParentAnonymous = true ;
123
122
}
124
- parent = getUSRForDecl (N);
123
+ parent = getSymbolID (N);
125
124
}
126
125
else if (auto const * N = dyn_cast<RecordDecl>(DC))
127
126
{
128
- parent = getUSRForDecl (N);
127
+ parent = getSymbolID (N);
129
128
}
130
129
else if (auto const * N = dyn_cast<FunctionDecl>(DC))
131
130
{
132
- parent = getUSRForDecl (N);
131
+ parent = getSymbolID (N);
133
132
}
134
133
else if (auto const * N = dyn_cast<EnumDecl>(DC))
135
134
{
136
- parent = getUSRForDecl (N);
135
+ parent = getSymbolID (N);
137
136
}
138
137
else
139
138
{
@@ -142,8 +141,8 @@ getParent(
142
141
(void )isParentAnonymous;
143
142
}
144
143
145
- static
146
144
void
145
+ ASTVisitor::
147
146
getParentNamespaces (
148
147
llvm::SmallVector<Reference, 4 >& Namespaces,
149
148
Decl const * D,
@@ -166,28 +165,28 @@ getParentNamespaces(
166
165
Namespace = N->getNameAsString ();
167
166
}
168
167
Namespaces.emplace_back (
169
- getUSRForDecl (N),
168
+ getSymbolID (N),
170
169
Namespace,
171
170
InfoType::IT_namespace);
172
171
}
173
172
else if (auto const * N = dyn_cast<RecordDecl>(DC))
174
173
{
175
174
Namespaces.emplace_back (
176
- getUSRForDecl (N),
175
+ getSymbolID (N),
177
176
N->getNameAsString (),
178
177
InfoType::IT_record);
179
178
}
180
179
else if (auto const * N = dyn_cast<FunctionDecl>(DC))
181
180
{
182
181
Namespaces.emplace_back (
183
- getUSRForDecl (N),
182
+ getSymbolID (N),
184
183
N->getNameAsString (),
185
184
InfoType::IT_function);
186
185
}
187
186
else if (auto const * N = dyn_cast<EnumDecl>(DC))
188
187
{
189
188
Namespaces.emplace_back (
190
- getUSRForDecl (N),
189
+ getSymbolID (N),
191
190
N->getNameAsString (),
192
191
InfoType::IT_enum);
193
192
}
@@ -212,8 +211,8 @@ getParentNamespaces(
212
211
213
212
// ------------------------------------------------
214
213
215
- static
216
214
std::string
215
+ ASTVisitor::
217
216
getSourceCode (
218
217
Decl const * D,
219
218
SourceRange const & R)
@@ -226,8 +225,8 @@ getSourceCode(
226
225
227
226
// ------------------------------------------------
228
227
229
- static
230
228
Access
229
+ ASTVisitor::
231
230
getAccessFromSpecifier (
232
231
AccessSpecifier as) noexcept
233
232
{
@@ -244,8 +243,8 @@ getAccessFromSpecifier(
244
243
}
245
244
}
246
245
247
- static
248
246
TagDecl*
247
+ ASTVisitor::
249
248
getTagDeclForType (
250
249
QualType const & T)
251
250
{
@@ -254,8 +253,8 @@ getTagDeclForType(
254
253
return nullptr ;
255
254
}
256
255
257
- static
258
256
RecordDecl*
257
+ ASTVisitor::
259
258
getRecordDeclForType (
260
259
QualType const & T)
261
260
{
@@ -264,8 +263,8 @@ getRecordDeclForType(
264
263
return nullptr ;
265
264
}
266
265
267
- static
268
266
TypeInfo
267
+ ASTVisitor::
269
268
getTypeInfoForType (
270
269
QualType const & T)
271
270
{
@@ -283,11 +282,11 @@ getTypeInfoForType(
283
282
else
284
283
IT = InfoType::IT_default;
285
284
return TypeInfo (Reference (
286
- getUSRForDecl (TD), TD->getNameAsString (), IT));
285
+ getSymbolID (TD), TD->getNameAsString (), IT));
287
286
}
288
287
289
- static
290
288
void
289
+ ASTVisitor::
291
290
parseParameters (
292
291
FunctionInfo& I,
293
292
FunctionDecl const * D)
@@ -308,6 +307,7 @@ parseParameters(
308
307
}
309
308
310
309
void
310
+ ASTVisitor::
311
311
getTemplateParams (
312
312
llvm::Optional<TemplateInfo>& TemplateInfo,
313
313
const Decl* D)
@@ -326,9 +326,9 @@ getTemplateParams(
326
326
}
327
327
}
328
328
329
- static
330
329
void
331
- parseJavadoc (
330
+ ASTVisitor::
331
+ parseRawComment (
332
332
llvm::Optional<Javadoc>& javadoc,
333
333
Decl const * D,
334
334
Reporter& R)
@@ -350,15 +350,15 @@ parseJavadoc(
350
350
351
351
// ------------------------------------------------
352
352
353
- static
354
353
void
354
+ ASTVisitor::
355
355
getMemberTypeInfo (
356
356
MemberTypeInfo& I,
357
357
FieldDecl const * D,
358
358
Reporter& R)
359
359
{
360
360
Assert (D && " Expect non-null FieldDecl in getMemberTypeInfo" );
361
- parseJavadoc (I.javadoc , D, R);
361
+ parseRawComment (I.javadoc , D, R);
362
362
363
363
for (auto attr : D->attrs ())
364
364
{
@@ -510,8 +510,8 @@ writeParent(
510
510
return writeBitcode (P);
511
511
}
512
512
513
- static
514
513
void
514
+ ASTVisitor::
515
515
parseFields (
516
516
RecordInfo& I,
517
517
const RecordDecl* D,
@@ -534,8 +534,8 @@ parseFields(
534
534
}
535
535
}
536
536
537
- static
538
537
void
538
+ ASTVisitor::
539
539
parseEnumerators (
540
540
EnumInfo& I,
541
541
const EnumDecl* D)
@@ -640,7 +640,7 @@ extractInfo(
640
640
if (! extractSymbolID (I.id , D))
641
641
return false ;
642
642
I.Name = D->getNameAsString ();
643
- parseJavadoc (I.javadoc , D, R_);
643
+ parseRawComment (I.javadoc , D, R_);
644
644
return true ;
645
645
}
646
646
@@ -685,15 +685,15 @@ extractBases(
685
685
{
686
686
TemplateDecl const * D = Ty->getTemplateName ().getAsTemplateDecl ();
687
687
I.Bases .emplace_back (
688
- getUSRForDecl (D),
688
+ getSymbolID (D),
689
689
B.getType ().getAsString (),
690
690
getAccessFromSpecifier (B.getAccessSpecifier ()),
691
691
isVirtual);
692
692
}
693
693
else if (RecordDecl const * P = getRecordDeclForType (B.getType ()))
694
694
{
695
695
I.Bases .emplace_back (
696
- getUSRForDecl (P),
696
+ getSymbolID (P),
697
697
P->getNameAsString (),
698
698
getAccessFromSpecifier (B.getAccessSpecifier ()),
699
699
isVirtual);
@@ -742,7 +742,7 @@ constructFunction(
742
742
I.Template ->Specialization .emplace ();
743
743
auto & Specialization = *I.Template ->Specialization ;
744
744
745
- Specialization.SpecializationOf = getUSRForDecl (FTSI->getTemplate ());
745
+ Specialization.SpecializationOf = getSymbolID (FTSI->getTemplate ());
746
746
747
747
// Template parameters to the specialization.
748
748
if (FTSI->TemplateArguments )
@@ -917,12 +917,12 @@ buildRecord(
917
917
if (SpecOf.is <ClassTemplateDecl*>())
918
918
{
919
919
Specialization.SpecializationOf =
920
- getUSRForDecl (SpecOf.get <ClassTemplateDecl*>());
920
+ getSymbolID (SpecOf.get <ClassTemplateDecl*>());
921
921
}
922
922
else if (SpecOf.is <ClassTemplatePartialSpecializationDecl*>())
923
923
{
924
924
Specialization.SpecializationOf =
925
- getUSRForDecl (SpecOf.get <ClassTemplatePartialSpecializationDecl*>());
925
+ getSymbolID (SpecOf.get <ClassTemplatePartialSpecializationDecl*>());
926
926
}
927
927
928
928
// Parameters to the specilization. For partial specializations, get the
0 commit comments