@@ -174,22 +174,25 @@ class ExtractAPIVisitorBase : public RecursiveASTVisitor<Derived> {
174
174
// skip classes not inherited as public
175
175
if (BaseSpecifier.getAccessSpecifier () != AccessSpecifier::AS_public)
176
176
continue ;
177
- SymbolReference BaseClass;
178
- if (BaseSpecifier.getType ().getTypePtr ()->isTemplateTypeParmType ()) {
179
- BaseClass.Name = API.copyString (BaseSpecifier.getType ().getAsString ());
180
- if (auto *TTPTD = BaseSpecifier.getType ()
181
- ->getAs <TemplateTypeParmType>()
182
- ->getDecl ()) {
183
- SmallString<128 > USR;
184
- index::generateUSRForDecl (TTPTD, USR);
185
- BaseClass.USR = API.copyString (USR);
186
- BaseClass.Source = API.copyString (getOwningModuleName (*TTPTD));
187
- }
177
+ if (auto *BaseDecl = BaseSpecifier.getType ()->getAsTagDecl ()) {
178
+ Bases.emplace_back (createSymbolReferenceForDecl (*BaseDecl));
188
179
} else {
189
- BaseClass = createSymbolReferenceForDecl (
190
- *BaseSpecifier.getType ().getTypePtr ()->getAsCXXRecordDecl ());
180
+ SymbolReference BaseClass;
181
+ BaseClass.Name = API.copyString (BaseSpecifier.getType ().getAsString (
182
+ Decl->getASTContext ().getPrintingPolicy ()));
183
+
184
+ if (BaseSpecifier.getType ().getTypePtr ()->isTemplateTypeParmType ()) {
185
+ if (auto *TTPTD = BaseSpecifier.getType ()
186
+ ->getAs <TemplateTypeParmType>()
187
+ ->getDecl ()) {
188
+ SmallString<128 > USR;
189
+ index::generateUSRForDecl (TTPTD, USR);
190
+ BaseClass.USR = API.copyString (USR);
191
+ BaseClass.Source = API.copyString (getOwningModuleName (*TTPTD));
192
+ }
193
+ }
194
+ Bases.emplace_back (BaseClass);
191
195
}
192
- Bases.emplace_back (BaseClass);
193
196
}
194
197
return Bases;
195
198
}
@@ -326,7 +329,7 @@ bool ExtractAPIVisitorBase<Derived>::VisitFunctionDecl(
326
329
return true ;
327
330
328
331
// Collect symbol information.
329
- StringRef Name = Decl->getName ();
332
+ auto Name = Decl->getNameAsString ();
330
333
SmallString<128 > USR;
331
334
index::generateUSRForDecl (Decl, USR);
332
335
PresumedLoc Loc =
@@ -639,17 +642,17 @@ bool ExtractAPIVisitorBase<Derived>::VisitCXXMethodDecl(
639
642
if (FunctionTemplateDecl *TemplateDecl =
640
643
Decl->getDescribedFunctionTemplate ()) {
641
644
API.createRecord <CXXMethodTemplateRecord>(
642
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
643
- AvailabilityInfo::createFromDecl (Decl), Comment,
645
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
646
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
644
647
DeclarationFragmentsBuilder::getFragmentsForFunctionTemplate (
645
648
TemplateDecl),
646
649
SubHeading, DeclarationFragmentsBuilder::getFunctionSignature (Decl),
647
650
DeclarationFragmentsBuilder::getAccessControl (TemplateDecl),
648
651
Template (TemplateDecl), isInSystemHeader (Decl));
649
652
} else if (Decl->getTemplateSpecializationInfo ())
650
653
API.createRecord <CXXMethodTemplateSpecializationRecord>(
651
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
652
- AvailabilityInfo::createFromDecl (Decl), Comment,
654
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
655
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
653
656
DeclarationFragmentsBuilder::
654
657
getFragmentsForFunctionTemplateSpecialization (Decl),
655
658
SubHeading, Signature, Access, isInSystemHeader (Decl));
@@ -661,14 +664,14 @@ bool ExtractAPIVisitorBase<Derived>::VisitCXXMethodDecl(
661
664
SubHeading, Signature, Access, isInSystemHeader (Decl));
662
665
else if (Decl->isStatic ())
663
666
API.createRecord <CXXStaticMethodRecord>(
664
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
665
- AvailabilityInfo::createFromDecl (Decl), Comment,
667
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
668
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
666
669
DeclarationFragmentsBuilder::getFragmentsForCXXMethod (Decl), SubHeading,
667
670
Signature, Access, isInSystemHeader (Decl));
668
671
else
669
672
API.createRecord <CXXInstanceMethodRecord>(
670
- USR, Decl->getName (), createHierarchyInformationForDecl (*Decl), Loc ,
671
- AvailabilityInfo::createFromDecl (Decl), Comment,
673
+ USR, Decl->getNameAsString (), createHierarchyInformationForDecl (*Decl),
674
+ Loc, AvailabilityInfo::createFromDecl (Decl), Comment,
672
675
DeclarationFragmentsBuilder::getFragmentsForCXXMethod (Decl), SubHeading,
673
676
Signature, Access, isInSystemHeader (Decl));
674
677
@@ -950,7 +953,7 @@ bool ExtractAPIVisitorBase<Derived>::VisitFunctionTemplateDecl(
950
953
return true ;
951
954
952
955
// Collect symbol information.
953
- StringRef Name = Decl->getName ();
956
+ auto Name = Decl->getNameAsString ();
954
957
SmallString<128 > USR;
955
958
index::generateUSRForDecl (Decl, USR);
956
959
PresumedLoc Loc =
0 commit comments