@@ -535,22 +535,18 @@ static void populateInfo(Info &I, const T *D, const FullComment *C,
535535
536536template <typename T>
537537static 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) {
541539 populateInfo (I, D, C, IsInAnonymousNamespace);
542540 if (D->isThisDeclarationADefinition ())
543- I.DefLoc . emplace (LineNumber, Filename, IsFileInRootDir) ;
541+ I.DefLoc = Loc ;
544542 else
545- I.Loc .emplace_back (LineNumber, Filename, IsFileInRootDir );
543+ I.Loc .emplace_back (Loc );
546544}
547545
548546static void populateFunctionInfo (FunctionInfo &I, const FunctionDecl *D,
549- const FullComment *FC, int LineNumber,
550- StringRef Filename, bool IsFileInRootDir,
547+ const FullComment *FC, Location Loc,
551548 bool &IsInAnonymousNamespace) {
552- populateSymbolInfo (I, D, FC, LineNumber, Filename, IsFileInRootDir,
553- IsInAnonymousNamespace);
549+ populateSymbolInfo (I, D, FC, Loc, IsInAnonymousNamespace);
554550 auto &LO = D->getLangOpts ();
555551 I.ReturnType = getTypeInfoForType (D->getReturnType (), LO);
556552 parseParameters (I, D);
@@ -579,7 +575,7 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
579575static void populateMemberTypeInfo (MemberTypeInfo &I, const Decl *D) {
580576 assert (D && " Expect non-null FieldDecl in populateMemberTypeInfo" );
581577
582- ASTContext& Context = D->getASTContext ();
578+ ASTContext & Context = D->getASTContext ();
583579 // TODO investigate whether we can use ASTContext::getCommentForDecl instead
584580 // of this logic. See also similar code in Mapper.cpp.
585581 RawComment *Comment = Context.getRawCommentForDeclNoCache (D);
@@ -643,8 +639,7 @@ parseBases(RecordInfo &I, const CXXRecordDecl *D, bool IsFileInRootDir,
643639 // reference, its value is not relevant in here so it's not used
644640 // anywhere besides the function call.
645641 bool IsInAnonymousNamespace;
646- populateFunctionInfo (FI, MD, /* FullComment=*/ {}, /* LineNumber=*/ {},
647- /* FileName=*/ {}, IsFileInRootDir,
642+ populateFunctionInfo (FI, MD, /* FullComment=*/ {}, /* Location=*/ {},
648643 IsInAnonymousNamespace);
649644 FI.Access =
650645 getFinalAccessSpecifier (BI.Access , MD->getAccessUnsafe ());
@@ -662,8 +657,8 @@ parseBases(RecordInfo &I, const CXXRecordDecl *D, bool IsFileInRootDir,
662657}
663658
664659std::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) {
667662 auto NSI = std::make_unique<NamespaceInfo>();
668663 bool IsInAnonymousNamespace = false ;
669664 populateInfo (*NSI, D, FC, IsInAnonymousNamespace);
@@ -683,12 +678,11 @@ emitInfo(const NamespaceDecl *D, const FullComment *FC, int LineNumber,
683678}
684679
685680std::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) {
688683 auto RI = std::make_unique<RecordInfo>();
689684 bool IsInAnonymousNamespace = false ;
690- populateSymbolInfo (*RI, D, FC, LineNumber, File, IsFileInRootDir,
691- IsInAnonymousNamespace);
685+ populateSymbolInfo (*RI, D, FC, Loc, IsInAnonymousNamespace);
692686 if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
693687 return {};
694688
@@ -701,7 +695,7 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
701695 }
702696 // TODO: remove first call to parseBases, that function should be deleted
703697 parseBases (*RI, C);
704- parseBases (*RI, C, IsFileInRootDir, PublicOnly, true );
698+ parseBases (*RI, C, /* IsFileInRootDir= */ true , PublicOnly, /* IsParent= */ true );
705699 }
706700 RI->Path = getInfoRelativePath (RI->Namespace );
707701
@@ -750,12 +744,11 @@ emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
750744}
751745
752746std::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) {
755749 FunctionInfo Func;
756750 bool IsInAnonymousNamespace = false ;
757- populateFunctionInfo (Func, D, FC, LineNumber, File, IsFileInRootDir,
758- IsInAnonymousNamespace);
751+ populateFunctionInfo (Func, D, FC, Loc, IsInAnonymousNamespace);
759752 Func.Access = clang::AccessSpecifier::AS_none;
760753 if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
761754 return {};
@@ -765,12 +758,11 @@ emitInfo(const FunctionDecl *D, const FullComment *FC, int LineNumber,
765758}
766759
767760std::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) {
770763 FunctionInfo Func;
771764 bool IsInAnonymousNamespace = false ;
772- populateFunctionInfo (Func, D, FC, LineNumber, File, IsFileInRootDir,
773- IsInAnonymousNamespace);
765+ populateFunctionInfo (Func, D, FC, Loc, IsInAnonymousNamespace);
774766 if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
775767 return {};
776768
@@ -795,16 +787,15 @@ emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber,
795787}
796788
797789std::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) {
800792 TypedefInfo Info;
801-
802793 bool IsInAnonymousNamespace = false ;
803794 populateInfo (Info, D, FC, IsInAnonymousNamespace);
804795 if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
805796 return {};
806797
807- Info.DefLoc . emplace (LineNumber, File, IsFileInRootDir) ;
798+ Info.DefLoc = Loc ;
808799 auto &LO = D->getLangOpts ();
809800 Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
810801 if (Info.Underlying .Type .Name .empty ()) {
@@ -822,16 +813,16 @@ emitInfo(const TypedefDecl *D, const FullComment *FC, int LineNumber,
822813// A type alias is a C++ "using" declaration for a type. It gets mapped to a
823814// TypedefInfo with the IsUsing flag set.
824815std::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) {
827818 TypedefInfo Info;
828819
829820 bool IsInAnonymousNamespace = false ;
830821 populateInfo (Info, D, FC, IsInAnonymousNamespace);
831822 if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
832823 return {};
833824
834- Info.DefLoc . emplace (LineNumber, File, IsFileInRootDir) ;
825+ Info.DefLoc = Loc ;
835826 auto &LO = D->getLangOpts ();
836827 Info.Underlying = getTypeInfoForType (D->getUnderlyingType (), LO);
837828 Info.IsUsing = true ;
@@ -841,12 +832,12 @@ emitInfo(const TypeAliasDecl *D, const FullComment *FC, int LineNumber,
841832}
842833
843834std::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) {
846837 EnumInfo Enum;
847838 bool IsInAnonymousNamespace = false ;
848- populateSymbolInfo (Enum, D, FC, LineNumber, File, IsFileInRootDir,
849- IsInAnonymousNamespace);
839+ populateSymbolInfo (Enum, D, FC, Loc, IsInAnonymousNamespace);
840+
850841 if (!shouldSerializeInfo (PublicOnly, IsInAnonymousNamespace, D))
851842 return {};
852843
0 commit comments