@@ -175,22 +175,25 @@ class ExtractAPIVisitorBase : public RecursiveASTVisitor<Derived> {
175
175
// skip classes not inherited as public
176
176
if (BaseSpecifier.getAccessSpecifier () != AccessSpecifier::AS_public)
177
177
continue ;
178
- SymbolReference BaseClass;
179
- if (BaseSpecifier.getType ().getTypePtr ()->isTemplateTypeParmType ()) {
180
- BaseClass.Name = API.copyString (BaseSpecifier.getType ().getAsString ());
181
- if (auto *TTPTD = BaseSpecifier.getType ()
182
- ->getAs <TemplateTypeParmType>()
183
- ->getDecl ()) {
184
- SmallString<128 > USR;
185
- index ::generateUSRForDecl (TTPTD, USR);
186
- BaseClass.USR = API.copyString (USR);
187
- BaseClass.Source = API.copyString (getOwningModuleName (*TTPTD));
188
- }
178
+ if (auto *BaseDecl = BaseSpecifier.getType ()->getAsTagDecl ()) {
179
+ Bases.emplace_back (createSymbolReferenceForDecl (*BaseDecl));
189
180
} else {
190
- BaseClass = createSymbolReferenceForDecl (
191
- *BaseSpecifier.getType ().getTypePtr ()->getAsCXXRecordDecl ());
181
+ SymbolReference BaseClass;
182
+ BaseClass.Name = API.copyString (BaseSpecifier.getType ().getAsString (
183
+ Decl->getASTContext ().getPrintingPolicy ()));
184
+
185
+ if (BaseSpecifier.getType ().getTypePtr ()->isTemplateTypeParmType ()) {
186
+ if (auto *TTPTD = BaseSpecifier.getType ()
187
+ ->getAs <TemplateTypeParmType>()
188
+ ->getDecl ()) {
189
+ SmallString<128 > USR;
190
+ index ::generateUSRForDecl (TTPTD, USR);
191
+ BaseClass.USR = API.copyString (USR);
192
+ BaseClass.Source = API.copyString (getOwningModuleName (*TTPTD));
193
+ }
194
+ }
195
+ Bases.emplace_back (BaseClass);
192
196
}
193
- Bases.emplace_back (BaseClass);
194
197
}
195
198
return Bases;
196
199
}
@@ -352,7 +355,7 @@ bool ExtractAPIVisitorBase<Derived>::VisitFunctionDecl(
352
355
return true ;
353
356
354
357
// Collect symbol information.
355
- StringRef Name = Decl->getName ();
358
+ auto Name = Decl->getNameAsString ();
356
359
SmallString<128 > USR;
357
360
index ::generateUSRForDecl (Decl, USR);
358
361
PresumedLoc Loc =
@@ -666,17 +669,17 @@ bool ExtractAPIVisitorBase<Derived>::VisitCXXMethodDecl(
666
669
if (FunctionTemplateDecl *TemplateDecl =
667
670
Decl->getDescribedFunctionTemplate ()) {
668
671
API.createRecord <CXXMethodTemplateRecord>(
669
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
670
- AvailabilityInfo::createFromDecl (Decl), Comment,
672
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
673
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
671
674
DeclarationFragmentsBuilder::getFragmentsForFunctionTemplate (
672
675
TemplateDecl),
673
676
SubHeading, DeclarationFragmentsBuilder::getFunctionSignature (Decl),
674
677
DeclarationFragmentsBuilder::getAccessControl (TemplateDecl),
675
678
Template (TemplateDecl), isInSystemHeader (Decl));
676
679
} else if (Decl->getTemplateSpecializationInfo ())
677
680
API.createRecord <CXXMethodTemplateSpecializationRecord>(
678
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
679
- AvailabilityInfo::createFromDecl (Decl), Comment,
681
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
682
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
680
683
DeclarationFragmentsBuilder::
681
684
getFragmentsForFunctionTemplateSpecialization (Decl),
682
685
SubHeading, Signature, Access, isInSystemHeader (Decl));
@@ -688,14 +691,14 @@ bool ExtractAPIVisitorBase<Derived>::VisitCXXMethodDecl(
688
691
SubHeading, Signature, Access, isInSystemHeader (Decl));
689
692
else if (Decl->isStatic ())
690
693
API.createRecord <CXXStaticMethodRecord>(
691
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
692
- AvailabilityInfo::createFromDecl (Decl), Comment,
694
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
695
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
693
696
DeclarationFragmentsBuilder::getFragmentsForCXXMethod (Decl), SubHeading,
694
697
Signature, Access, isInSystemHeader (Decl));
695
698
else
696
699
API.createRecord <CXXInstanceMethodRecord>(
697
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
698
- AvailabilityInfo::createFromDecl (Decl), Comment,
700
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
701
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
699
702
DeclarationFragmentsBuilder::getFragmentsForCXXMethod (Decl), SubHeading,
700
703
Signature, Access, isInSystemHeader (Decl));
701
704
@@ -977,7 +980,7 @@ bool ExtractAPIVisitorBase<Derived>::VisitFunctionTemplateDecl(
977
980
return true ;
978
981
979
982
// Collect symbol information.
980
- StringRef Name = Decl->getName ();
983
+ auto Name = Decl->getNameAsString ();
981
984
SmallString<128 > USR;
982
985
index ::generateUSRForDecl (Decl, USR);
983
986
PresumedLoc Loc =
0 commit comments