@@ -236,10 +236,10 @@ static RecordDecl *getRecordDeclForType(const QualType &T) {
236236 return nullptr ;
237237}
238238
239- TypeInfo getTypeInfoForType (const QualType &T) {
239+ TypeInfo getTypeInfoForType (const QualType &T, const PrintingPolicy &Policy ) {
240240 const TagDecl *TD = getTagDeclForType (T);
241241 if (!TD)
242- return TypeInfo (Reference (SymbolID (), T.getAsString ()));
242+ return TypeInfo (Reference (SymbolID (), T.getAsString (Policy )));
243243
244244 InfoType IT;
245245 if (dyn_cast<EnumDecl>(TD)) {
@@ -250,7 +250,7 @@ TypeInfo getTypeInfoForType(const QualType &T) {
250250 IT = InfoType::IT_default;
251251 }
252252 return TypeInfo (Reference (getUSRForDecl (TD), TD->getNameAsString (), IT,
253- T.getAsString (), getInfoRelativePath (TD)));
253+ T.getAsString (Policy ), getInfoRelativePath (TD)));
254254}
255255
256256static bool isPublic (const clang::AccessSpecifier AS,
@@ -379,10 +379,11 @@ static void parseFields(RecordInfo &I, const RecordDecl *D, bool PublicOnly,
379379 if (!shouldSerializeInfo (PublicOnly, /* IsInAnonymousNamespace=*/ false , F))
380380 continue ;
381381
382+ auto &LO = F->getLangOpts ();
382383 // Use getAccessUnsafe so that we just get the default AS_none if it's not
383384 // valid, as opposed to an assert.
384385 MemberTypeInfo &NewMember = I.Members .emplace_back (
385- getTypeInfoForType (F->getTypeSourceInfo ()->getType ()),
386+ getTypeInfoForType (F->getTypeSourceInfo ()->getType (), LO ),
386387 F->getNameAsString (),
387388 getFinalAccessSpecifier (Access, F->getAccessUnsafe ()));
388389 populateMemberTypeInfo (NewMember, F);
@@ -412,9 +413,10 @@ static void parseEnumerators(EnumInfo &I, const EnumDecl *D) {
412413}
413414
414415static void parseParameters (FunctionInfo &I, const FunctionDecl *D) {
416+ auto &LO = D->getLangOpts ();
415417 for (const ParmVarDecl *P : D->parameters ()) {
416418 FieldTypeInfo &FieldInfo = I.Params .emplace_back (
417- getTypeInfoForType (P->getOriginalType ()), P->getNameAsString ());
419+ getTypeInfoForType (P->getOriginalType (), LO ), P->getNameAsString ());
418420 FieldInfo.DefaultValue = getSourceCode (D, P->getDefaultArgRange ());
419421 }
420422}
@@ -541,7 +543,8 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
541543 bool &IsInAnonymousNamespace) {
542544 populateSymbolInfo (I, D, FC, LineNumber, Filename, IsFileInRootDir,
543545 IsInAnonymousNamespace);
544- I.ReturnType = getTypeInfoForType (D->getReturnType ());
546+ auto &LO = D->getLangOpts ();
547+ I.ReturnType = getTypeInfoForType (D->getReturnType (), LO);
545548 parseParameters (I, D);
546549
547550 PopulateTemplateParameters (I.Template , D);
@@ -783,7 +786,8 @@ emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
783786 return {};
784787
785788 Info.DefLoc .emplace (LineNumber, File, IsFileInRootDir);
786- Info.Underlying = getTypeInfoForType (D->getUnderlyingType ());
789+ auto &LO = D->getLangOpts ();
790+ Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
787791 if (Info.Underlying .Type .Name .empty ()) {
788792 // Typedef for an unnamed type. This is like "typedef struct { } Foo;"
789793 // The record serializer explicitly checks for this syntax and constructs
@@ -809,7 +813,8 @@ emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
809813 return {};
810814
811815 Info.DefLoc .emplace (LineNumber, File, IsFileInRootDir);
812- Info.Underlying = getTypeInfoForType (D->getUnderlyingType ());
816+ auto &LO = D->getLangOpts ();
817+ Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
813818 Info.IsUsing = true ;
814819
815820 // Info is wrapped in its parent scope so is returned in the second position.
0 commit comments