@@ -236,10 +236,10 @@ static RecordDecl *getRecordDeclForType(const QualType &T) {
236
236
return nullptr ;
237
237
}
238
238
239
- TypeInfo getTypeInfoForType (const QualType &T) {
239
+ TypeInfo getTypeInfoForType (const QualType &T, const PrintingPolicy &Policy ) {
240
240
const TagDecl *TD = getTagDeclForType (T);
241
241
if (!TD)
242
- return TypeInfo (Reference (SymbolID (), T.getAsString ()));
242
+ return TypeInfo (Reference (SymbolID (), T.getAsString (Policy )));
243
243
244
244
InfoType IT;
245
245
if (dyn_cast<EnumDecl>(TD)) {
@@ -250,7 +250,7 @@ TypeInfo getTypeInfoForType(const QualType &T) {
250
250
IT = InfoType::IT_default;
251
251
}
252
252
return TypeInfo (Reference (getUSRForDecl (TD), TD->getNameAsString (), IT,
253
- T.getAsString (), getInfoRelativePath (TD)));
253
+ T.getAsString (Policy ), getInfoRelativePath (TD)));
254
254
}
255
255
256
256
static bool isPublic (const clang::AccessSpecifier AS,
@@ -379,10 +379,11 @@ static void parseFields(RecordInfo &I, const RecordDecl *D, bool PublicOnly,
379
379
if (!shouldSerializeInfo (PublicOnly, /* IsInAnonymousNamespace=*/ false , F))
380
380
continue ;
381
381
382
+ auto &LO = F->getLangOpts ();
382
383
// Use getAccessUnsafe so that we just get the default AS_none if it's not
383
384
// valid, as opposed to an assert.
384
385
MemberTypeInfo &NewMember = I.Members .emplace_back (
385
- getTypeInfoForType (F->getTypeSourceInfo ()->getType ()),
386
+ getTypeInfoForType (F->getTypeSourceInfo ()->getType (), LO ),
386
387
F->getNameAsString (),
387
388
getFinalAccessSpecifier (Access, F->getAccessUnsafe ()));
388
389
populateMemberTypeInfo (NewMember, F);
@@ -412,9 +413,10 @@ static void parseEnumerators(EnumInfo &I, const EnumDecl *D) {
412
413
}
413
414
414
415
static void parseParameters (FunctionInfo &I, const FunctionDecl *D) {
416
+ auto &LO = D->getLangOpts ();
415
417
for (const ParmVarDecl *P : D->parameters ()) {
416
418
FieldTypeInfo &FieldInfo = I.Params .emplace_back (
417
- getTypeInfoForType (P->getOriginalType ()), P->getNameAsString ());
419
+ getTypeInfoForType (P->getOriginalType (), LO ), P->getNameAsString ());
418
420
FieldInfo.DefaultValue = getSourceCode (D, P->getDefaultArgRange ());
419
421
}
420
422
}
@@ -541,7 +543,8 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
541
543
bool &IsInAnonymousNamespace) {
542
544
populateSymbolInfo (I, D, FC, LineNumber, Filename, IsFileInRootDir,
543
545
IsInAnonymousNamespace);
544
- I.ReturnType = getTypeInfoForType (D->getReturnType ());
546
+ auto &LO = D->getLangOpts ();
547
+ I.ReturnType = getTypeInfoForType (D->getReturnType (), LO);
545
548
parseParameters (I, D);
546
549
547
550
PopulateTemplateParameters (I.Template , D);
@@ -783,7 +786,8 @@ emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
783
786
return {};
784
787
785
788
Info.DefLoc .emplace (LineNumber, File, IsFileInRootDir);
786
- Info.Underlying = getTypeInfoForType (D->getUnderlyingType ());
789
+ auto &LO = D->getLangOpts ();
790
+ Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
787
791
if (Info.Underlying .Type .Name .empty ()) {
788
792
// Typedef for an unnamed type. This is like "typedef struct { } Foo;"
789
793
// The record serializer explicitly checks for this syntax and constructs
@@ -809,7 +813,8 @@ emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
809
813
return {};
810
814
811
815
Info.DefLoc .emplace (LineNumber, File, IsFileInRootDir);
812
- Info.Underlying = getTypeInfoForType (D->getUnderlyingType ());
816
+ auto &LO = D->getLangOpts ();
817
+ Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
813
818
Info.IsUsing = true ;
814
819
815
820
// Info is wrapped in its parent scope so is returned in the second position.
0 commit comments