@@ -225,6 +225,14 @@ getSourceCode(
225
225
226
226
// ------------------------------------------------
227
227
228
+ std::string
229
+ ASTVisitor::
230
+ getTypeAsString (
231
+ QualType T)
232
+ {
233
+ return T.getAsString (astContext_->getPrintingPolicy ());
234
+ }
235
+
228
236
Access
229
237
ASTVisitor::
230
238
getAccessFromSpecifier (
@@ -246,7 +254,7 @@ getAccessFromSpecifier(
246
254
TagDecl*
247
255
ASTVisitor::
248
256
getTagDeclForType (
249
- QualType const & T)
257
+ QualType T)
250
258
{
251
259
if (TagDecl const * D = T->getAsTagDecl ())
252
260
return D->getDefinition ();
@@ -256,7 +264,7 @@ getTagDeclForType(
256
264
RecordDecl*
257
265
ASTVisitor::
258
266
getRecordDeclForType (
259
- QualType const & T)
267
+ QualType T)
260
268
{
261
269
if (RecordDecl const * D = T->getAsRecordDecl ())
262
270
return D->getDefinition ();
@@ -266,14 +274,12 @@ getRecordDeclForType(
266
274
TypeInfo
267
275
ASTVisitor::
268
276
getTypeInfoForType (
269
- QualType const & T)
277
+ QualType T)
270
278
{
271
279
TagDecl const * TD = getTagDeclForType (T);
272
- if (T->isBuiltinType ()
273
- && (T->getAs <clang::BuiltinType>()->getKind () == BuiltinType::Bool))
274
- return TypeInfo (Reference (EmptySID, " bool" ));
275
280
if (!TD)
276
- return TypeInfo (Reference (EmptySID, T.getAsString ()));
281
+ return TypeInfo (Reference (EmptySID,
282
+ getTypeAsString (T)));
277
283
InfoType IT;
278
284
if (dyn_cast<EnumDecl>(TD))
279
285
IT = InfoType::IT_enum;
@@ -296,8 +302,6 @@ parseParameters(
296
302
// KRYSTIAN NOTE: call getOriginalType instead
297
303
// of getType if we want to preserve top-level
298
304
// cv-qualfiers/array types/function types
299
- auto ti = getTypeInfoForType (P->getType ());
300
-
301
305
FieldTypeInfo& FieldInfo = I.Params .emplace_back (
302
306
getTypeInfoForType (P->getType ()),
303
307
P->getNameAsString ());
@@ -683,10 +687,9 @@ extractBases(
683
687
continue ;
684
688
if (auto const * Ty = B.getType ()->getAs <TemplateSpecializationType>())
685
689
{
686
- TemplateDecl const * D = Ty->getTemplateName ().getAsTemplateDecl ();
687
690
I.Bases .emplace_back (
688
691
getSymbolID (D),
689
- B.getType (). getAsString ( ),
692
+ getTypeAsString ( B.getType ()),
690
693
getAccessFromSpecifier (B.getAccessSpecifier ()),
691
694
isVirtual);
692
695
}
@@ -702,7 +705,7 @@ extractBases(
702
705
{
703
706
I.Bases .emplace_back (
704
707
EmptySID,
705
- B.getType (). getAsString ( ),
708
+ getTypeAsString ( B.getType ()),
706
709
getAccessFromSpecifier (B.getAccessSpecifier ()),
707
710
isVirtual);
708
711
}
@@ -727,7 +730,7 @@ constructFunction(
727
730
else
728
731
I.Loc .emplace_back (LineNumber, File, IsFileInRootDir);
729
732
QualType const qt = D->getReturnType ();
730
- std::string s = qt. getAsString ( );
733
+ std::string s = getTypeAsString (qt );
731
734
I.ReturnType = getTypeInfoForType (qt);
732
735
parseParameters (I, D);
733
736
@@ -1046,7 +1049,7 @@ buildEnum(
1046
1049
I.Scoped = D->isScoped ();
1047
1050
if (D->isFixed ())
1048
1051
{
1049
- auto Name = D->getIntegerType (). getAsString ( );
1052
+ auto Name = getTypeAsString ( D->getIntegerType ());
1050
1053
I.BaseType = TypeInfo (Name);
1051
1054
}
1052
1055
parseEnumerators (I, D);
@@ -1069,8 +1072,8 @@ buildVar(
1069
1072
I.DefLoc .emplace (LineNumber, File, IsFileInRootDir);
1070
1073
else
1071
1074
I.Loc .emplace_back (LineNumber, File, IsFileInRootDir);
1072
- static_cast <TypeInfo&>(I) =
1073
- getTypeInfoForType ( D->getTypeSourceInfo ()->getType ());
1075
+ static_cast <TypeInfo&>(I) = getTypeInfoForType (
1076
+ D->getTypeSourceInfo ()->getType ());
1074
1077
I.specs .storageClass = D->getStorageClass ();
1075
1078
insertBitcode (ex_, writeBitcode (I));
1076
1079
insertBitcode (ex_, writeParent (I, D->getAccess ()));
@@ -1120,7 +1123,8 @@ buildTypedef(
1120
1123
TypedefInfo I;
1121
1124
if (! extractInfo (I, D))
1122
1125
return ;
1123
- I.Underlying = getTypeInfoForType (D->getUnderlyingType ());
1126
+ I.Underlying = getTypeInfoForType (
1127
+ D->getUnderlyingType ());
1124
1128
if (I.Underlying .Type .Name .empty ())
1125
1129
{
1126
1130
// Typedef for an unnamed type. This is like
0 commit comments