Skip to content

Commit 2753767

Browse files
committed
feat: allow multiple implementation-defined and see-below namespaces
1 parent 3122db0 commit 2753767

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

src/lib/AST/ASTVisitor.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -2456,13 +2456,12 @@ class ASTVisitor
24562456
void
24572457
traverseContext(DeclContext* DC);
24582458

2459-
24602459
bool
24612460
isInSpecialNamespace(
24622461
const Decl* D,
2463-
std::string_view Namespace)
2462+
std::span<const FilterPattern> Patterns)
24642463
{
2465-
if(! D || Namespace.empty())
2464+
if(! D || Patterns.empty())
24662465
return false;
24672466
const DeclContext* DC = isa<DeclContext>(D) ?
24682467
dyn_cast<DeclContext>(D) : D->getDeclContext();
@@ -2471,16 +2470,17 @@ class ASTVisitor
24712470
const NamespaceDecl* ND = dyn_cast<NamespaceDecl>(DC);
24722471
if(! ND)
24732472
continue;
2474-
if(ND->getQualifiedNameAsString() == Namespace)
2475-
return true;
2473+
for(const auto& Pattern : Patterns)
2474+
if(Pattern.matches(ND->getQualifiedNameAsString()))
2475+
return true;
24762476
}
24772477
return false;
24782478
}
24792479

24802480
bool
24812481
isInSpecialNamespace(
24822482
const NestedNameSpecifier* NNS,
2483-
std::string_view Namespace)
2483+
std::span<const FilterPattern> Patterns)
24842484
{
24852485
const NamedDecl* ND = nullptr;
24862486
while(NNS)
@@ -2491,7 +2491,7 @@ class ASTVisitor
24912491
break;
24922492
NNS = NNS->getPrefix();
24932493
}
2494-
return ND && isInSpecialNamespace(ND, Namespace);
2494+
return ND && isInSpecialNamespace(ND, Patterns);
24952495
}
24962496

24972497
bool

src/lib/Lib/ConfigImpl.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,16 @@ struct llvm::yaml::MappingTraits<SettingsImpl>
109109

110110
io.mapOptional("filters", cfg.filters);
111111

112-
io.mapOptional("see-below", cfg.seeBelow);
113-
io.mapOptional("implementation-defined", cfg.implementationDefined);
112+
// KRYSTIAN FIXME: This should really be done with mapping traits.
113+
std::vector<std::string> seeBelow;
114+
io.mapOptional("see-below", seeBelow);
115+
for(std::string_view pattern : seeBelow)
116+
cfg.seeBelow.emplace_back(pattern);
117+
118+
std::vector<std::string> implementationDefined;
119+
io.mapOptional("implementation-defined", implementationDefined);
120+
for(std::string_view pattern : implementationDefined)
121+
cfg.implementationDefined.emplace_back(pattern);
114122
}
115123
};
116124

@@ -223,13 +231,9 @@ ConfigImpl(
223231

224232
// Parse the filters
225233
for(std::string_view pattern : settings_.filters.symbols.exclude)
226-
{
227234
parseSymbolFilter(settings_.symbolFilter, pattern, true);
228-
}
229235
for(std::string_view pattern : settings_.filters.symbols.include)
230-
{
231236
parseSymbolFilter(settings_.symbolFilter, pattern, false);
232-
}
233237
settings_.symbolFilter.finalize(false, false, false);
234238
}
235239

src/lib/Lib/ConfigImpl.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ class ConfigImpl
138138
*/
139139
std::string baseURL;
140140

141-
/** Namespace for symbols rendered as "see-below".
141+
/** Namespaces for symbols rendered as "see-below".
142142
*/
143-
std::string seeBelow;
143+
std::vector<FilterPattern> seeBelow;
144144

145-
/** Namespace for symbols rendered as "implementation-defined".
145+
/** Namespaces for symbols rendered as "implementation-defined".
146146
*/
147-
std::string implementationDefined;
147+
std::vector<FilterPattern> implementationDefined;
148148
};
149149

150150
/// @copydoc Config::settings()

0 commit comments

Comments
 (0)