@@ -142,26 +142,58 @@ TypeInfo getTypeInfoForType(const QualType& T) {
142
142
T.getAsString (), getInfoRelativePath (TD)));
143
143
}
144
144
145
- static bool isPublic (const clang::AccessSpecifier AS,
146
- const clang::Linkage Link) {
145
+ static
146
+ bool
147
+ isPublic (
148
+ clang::AccessSpecifier const AS,
149
+ clang::Linkage const Link)
150
+ {
147
151
if (AS == clang::AccessSpecifier::AS_private)
148
152
return false ;
149
- else if (( Link == clang::Linkage::ModuleLinkage) ||
150
- ( Link == clang::Linkage::ExternalLinkage) )
153
+ if (Link == clang::Linkage::ModuleLinkage ||
154
+ Link == clang::Linkage::ExternalLinkage)
151
155
return true ;
152
- return false ; // otherwise, linkage is some form of internal linkage
156
+ // some form of internal linkage
157
+ return false ;
153
158
}
154
159
155
- static bool shouldSerializeInfo (bool PublicOnly, bool IsInAnonymousNamespace,
156
- const NamedDecl* D) {
160
+ static
161
+ bool
162
+ shouldSerializeInfo (
163
+ bool PublicOnly,
164
+ bool IsInAnonymousNamespace,
165
+ NamedDecl const * D)
166
+ {
157
167
bool IsAnonymousNamespace = false ;
158
- if ( const auto * N = dyn_cast<NamespaceDecl>(D))
168
+ if ( auto const * N = dyn_cast<NamespaceDecl>(D))
159
169
IsAnonymousNamespace = N->isAnonymousNamespace ();
160
170
return !PublicOnly ||
161
171
(!IsInAnonymousNamespace && !IsAnonymousNamespace &&
162
172
isPublic (D->getAccessUnsafe (), D->getLinkageInternal ()));
163
173
}
164
174
175
+ // handles TypedefDecl and TypeAliasDecl
176
+ static
177
+ bool
178
+ shouldSerializeInfo (
179
+ bool PublicOnly,
180
+ bool IsInAnonymousNamespace,
181
+ TypedefNameDecl const * D)
182
+ {
183
+ if (! PublicOnly)
184
+ return true ;
185
+ if (IsInAnonymousNamespace)
186
+ return false ;
187
+ if (auto const * N = dyn_cast<NamespaceDecl>(D))
188
+ {
189
+ if (N->isAnonymousNamespace ())
190
+ return false ;
191
+ }
192
+ if (D->getAccessUnsafe () == AccessSpecifier::AS_private)
193
+ return false ;
194
+ return true ;
195
+ }
196
+
165
197
// The InsertChild functions insert the given info into the given scope using
166
198
// the method appropriate for that type. Some types are moved into the
167
199
// appropriate vector, while other types have Reference objects generated to
@@ -611,9 +643,17 @@ emitInfo(const RecordDecl* D, const FullComment* FC, int LineNumber,
611
643
return { std::move (I), std::move (Parent) };
612
644
}
613
645
614
- std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
615
- emitInfo (const FunctionDecl* D, const FullComment* FC, int LineNumber,
616
- llvm::StringRef File, bool IsFileInRootDir, bool PublicOnly) {
646
+ std::pair<
647
+ std::unique_ptr<Info>,
648
+ std::unique_ptr<Info>>
649
+ emitInfo (
650
+ FunctionDecl const * D,
651
+ FullComment const * FC,
652
+ int LineNumber,
653
+ llvm::StringRef File,
654
+ bool IsFileInRootDir,
655
+ bool PublicOnly)
656
+ {
617
657
FunctionInfo Func;
618
658
bool IsInAnonymousNamespace = false ;
619
659
populateFunctionInfo (Func, D, FC, LineNumber, File, IsFileInRootDir,
@@ -655,9 +695,17 @@ emitInfo(const CXXMethodDecl* D, const FullComment* FC, int LineNumber,
655
695
return { nullptr , MakeAndInsertIntoParent<FunctionInfo&&>(std::move (Func)) };
656
696
}
657
697
658
- std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
659
- emitInfo (const TypedefDecl* D, const FullComment* FC, int LineNumber,
660
- StringRef File, bool IsFileInRootDir, bool PublicOnly) {
698
+ std::pair<
699
+ std::unique_ptr<Info>,
700
+ std::unique_ptr<Info>>
701
+ emitInfo (
702
+ const TypedefDecl* D,
703
+ const FullComment* FC,
704
+ int LineNumber,
705
+ StringRef File,
706
+ bool IsFileInRootDir,
707
+ bool PublicOnly)
708
+ {
661
709
TypedefInfo Info;
662
710
663
711
bool IsInAnonymousNamespace = false ;
@@ -681,9 +729,17 @@ emitInfo(const TypedefDecl* D, const FullComment* FC, int LineNumber,
681
729
682
730
// A type alias is a C++ "using" declaration for a type. It gets mapped to a
683
731
// TypedefInfo with the IsUsing flag set.
684
- std::pair<std::unique_ptr<Info>, std::unique_ptr<Info>>
685
- emitInfo (const TypeAliasDecl* D, const FullComment* FC, int LineNumber,
686
- StringRef File, bool IsFileInRootDir, bool PublicOnly) {
732
+ std::pair<
733
+ std::unique_ptr<Info>,
734
+ std::unique_ptr<Info>>
735
+ emitInfo (
736
+ const TypeAliasDecl* D,
737
+ const FullComment* FC,
738
+ int LineNumber,
739
+ StringRef File,
740
+ bool IsFileInRootDir,
741
+ bool PublicOnly)
742
+ {
687
743
TypedefInfo Info;
688
744
689
745
bool IsInAnonymousNamespace = false ;
0 commit comments