@@ -535,22 +535,18 @@ static void populateInfo(Info &I, const T *D, const FullComment *C,
535
535
536
536
template <typename T>
537
537
static void populateSymbolInfo (SymbolInfo &I, const T *D, const FullComment *C,
538
- int LineNumber, StringRef Filename,
539
- bool IsFileInRootDir,
540
- bool &IsInAnonymousNamespace) {
538
+ Location Loc, bool &IsInAnonymousNamespace) {
541
539
populateInfo (I, D, C, IsInAnonymousNamespace);
542
540
if (D->isThisDeclarationADefinition ())
543
- I.DefLoc . emplace (LineNumber, Filename, IsFileInRootDir) ;
541
+ I.DefLoc = Loc ;
544
542
else
545
- I.Loc .emplace_back (LineNumber, Filename, IsFileInRootDir );
543
+ I.Loc .emplace_back (Loc );
546
544
}
547
545
548
546
static void populateFunctionInfo (FunctionInfo &I, const FunctionDecl *D,
549
- const FullComment *FC, int LineNumber,
550
- StringRef Filename, bool IsFileInRootDir,
547
+ const FullComment *FC, Location Loc,
551
548
bool &IsInAnonymousNamespace) {
552
- populateSymbolInfo (I, D, FC, LineNumber, Filename, IsFileInRootDir,
553
- IsInAnonymousNamespace);
549
+ populateSymbolInfo (I, D, FC, Loc, IsInAnonymousNamespace);
554
550
auto &LO = D->getLangOpts ();
555
551
I.ReturnType = getTypeInfoForType (D->getReturnType (), LO);
556
552
parseParameters (I, D);
@@ -579,7 +575,7 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
579
575
static void populateMemberTypeInfo (MemberTypeInfo &I, const Decl *D) {
580
576
assert (D && " Expect non-null FieldDecl in populateMemberTypeInfo" );
581
577
582
- ASTContext& Context = D->getASTContext ();
578
+ ASTContext & Context = D->getASTContext ();
583
579
// TODO investigate whether we can use ASTContext::getCommentForDecl instead
584
580
// of this logic. See also similar code in Mapper.cpp.
585
581
RawComment *Comment = Context.getRawCommentForDeclNoCache (D);
@@ -643,8 +639,7 @@ parseBases(RecordInfo &I, const CXXRecordDecl *D, bool IsFileInRootDir,
643
639
// reference, its value is not relevant in here so it's not used
644
640
// anywhere besides the function call.
645
641
bool IsInAnonymousNamespace;
646
- populateFunctionInfo (FI, MD, /* FullComment=*/ {}, /* LineNumber=*/ {},
647
- /* FileName=*/ {}, IsFileInRootDir,
642
+ populateFunctionInfo (FI, MD, /* FullComment=*/ {}, /* Location=*/ {},
648
643
IsInAnonymousNamespace);
649
644
FI.Access =
650
645
getFinalAccessSpecifier (BI.Access , MD->getAccessUnsafe ());
@@ -662,8 +657,8 @@ parseBases(RecordInfo &I, const CXXRecordDecl *D, bool IsFileInRootDir,
662
657
}
663
658
664
659
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
665
- emitInfo (const NamespaceDecl *D, const FullComment *FC, int LineNumber ,
666
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
660
+ emitInfo (const NamespaceDecl *D, const FullComment *FC, Location Loc ,
661
+ bool PublicOnly) {
667
662
auto NSI = std::make_unique<NamespaceInfo>();
668
663
bool IsInAnonymousNamespace = false ;
669
664
populateInfo (*NSI, D, FC, IsInAnonymousNamespace);
@@ -683,12 +678,11 @@ emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
683
678
}
684
679
685
680
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
686
- emitInfo (const RecordDecl *D, const FullComment *FC, int LineNumber ,
687
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
681
+ emitInfo (const RecordDecl *D, const FullComment *FC, Location Loc ,
682
+ bool PublicOnly) {
688
683
auto RI = std::make_unique<RecordInfo>();
689
684
bool IsInAnonymousNamespace = false ;
690
- populateSymbolInfo (*RI, D, FC, LineNumber, File, IsFileInRootDir,
691
- IsInAnonymousNamespace);
685
+ populateSymbolInfo (*RI, D, FC, Loc, IsInAnonymousNamespace);
692
686
if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
693
687
return {};
694
688
@@ -701,7 +695,7 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
701
695
}
702
696
// TODO: remove first call to parseBases, that function should be deleted
703
697
parseBases (*RI, C);
704
- parseBases (*RI, C, IsFileInRootDir, PublicOnly, true );
698
+ parseBases (*RI, C, /* IsFileInRootDir= */ true , PublicOnly, /* IsParent= */ true );
705
699
}
706
700
RI->Path = getInfoRelativePath (RI->Namespace );
707
701
@@ -750,12 +744,11 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
750
744
}
751
745
752
746
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
753
- emitInfo (const FunctionDecl *D, const FullComment *FC, int LineNumber ,
754
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
747
+ emitInfo (const FunctionDecl *D, const FullComment *FC, Location Loc ,
748
+ bool PublicOnly) {
755
749
FunctionInfo Func;
756
750
bool IsInAnonymousNamespace = false ;
757
- populateFunctionInfo (Func, D, FC, LineNumber, File, IsFileInRootDir,
758
- IsInAnonymousNamespace);
751
+ populateFunctionInfo (Func, D, FC, Loc, IsInAnonymousNamespace);
759
752
Func.Access = clang::AccessSpecifier::AS_none;
760
753
if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
761
754
return {};
@@ -765,12 +758,11 @@ emitInfo(const FunctionDecl *D, const FullComment *FC, int LineNumber,
765
758
}
766
759
767
760
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
768
- emitInfo (const CXXMethodDecl *D, const FullComment *FC, int LineNumber ,
769
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
761
+ emitInfo (const CXXMethodDecl *D, const FullComment *FC, Location Loc ,
762
+ bool PublicOnly) {
770
763
FunctionInfo Func;
771
764
bool IsInAnonymousNamespace = false ;
772
- populateFunctionInfo (Func, D, FC, LineNumber, File, IsFileInRootDir,
773
- IsInAnonymousNamespace);
765
+ populateFunctionInfo (Func, D, FC, Loc, IsInAnonymousNamespace);
774
766
if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
775
767
return {};
776
768
@@ -795,16 +787,15 @@ emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber,
795
787
}
796
788
797
789
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
798
- emitInfo (const TypedefDecl *D, const FullComment *FC, int LineNumber ,
799
- StringRef File, bool IsFileInRootDir, bool PublicOnly) {
790
+ emitInfo (const TypedefDecl *D, const FullComment *FC, Location Loc ,
791
+ bool PublicOnly) {
800
792
TypedefInfo Info;
801
-
802
793
bool IsInAnonymousNamespace = false ;
803
794
populateInfo (Info, D, FC, IsInAnonymousNamespace);
804
795
if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
805
796
return {};
806
797
807
- Info.DefLoc . emplace (LineNumber, File, IsFileInRootDir) ;
798
+ Info.DefLoc = Loc ;
808
799
auto &LO = D->getLangOpts ();
809
800
Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
810
801
if (Info.Underlying .Type .Name .empty ()) {
@@ -822,16 +813,16 @@ emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
822
813
// A type alias is a C++ "using" declaration for a type. It gets mapped to a
823
814
// TypedefInfo with the IsUsing flag set.
824
815
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
825
- emitInfo (const TypeAliasDecl *D, const FullComment *FC, int LineNumber ,
826
- StringRef File, bool IsFileInRootDir, bool PublicOnly) {
816
+ emitInfo (const TypeAliasDecl *D, const FullComment *FC, Location Loc ,
817
+ bool PublicOnly) {
827
818
TypedefInfo Info;
828
819
829
820
bool IsInAnonymousNamespace = false ;
830
821
populateInfo (Info, D, FC, IsInAnonymousNamespace);
831
822
if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
832
823
return {};
833
824
834
- Info.DefLoc . emplace (LineNumber, File, IsFileInRootDir) ;
825
+ Info.DefLoc = Loc ;
835
826
auto &LO = D->getLangOpts ();
836
827
Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
837
828
Info.IsUsing = true ;
@@ -841,12 +832,12 @@ emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
841
832
}
842
833
843
834
std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
844
- emitInfo (const EnumDecl *D, const FullComment *FC, int LineNumber ,
845
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
835
+ emitInfo (const EnumDecl *D, const FullComment *FC, Location Loc ,
836
+ bool PublicOnly) {
846
837
EnumInfo Enum;
847
838
bool IsInAnonymousNamespace = false ;
848
- populateSymbolInfo (Enum, D, FC, LineNumber, File, IsFileInRootDir,
849
- IsInAnonymousNamespace);
839
+ populateSymbolInfo (Enum, D, FC, Loc, IsInAnonymousNamespace);
840
+
850
841
if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
851
842
return {};
852
843
0 commit comments