forked from OSchip/llvm-project
[clangd] Add parsing for IgnoreHeaders config option
This commit is contained in:
parent
ac0f4c8f36
commit
9fe89a1f0f
|
@ -128,6 +128,7 @@ private:
|
|||
Dict.handle("UnusedIncludes", [&](Node &N) {
|
||||
F.UnusedIncludes = scalarValue(N, "UnusedIncludes");
|
||||
});
|
||||
Dict.handle("Includes", [&](Node &N) { parse(F.Includes, N); });
|
||||
Dict.handle("ClangTidy", [&](Node &N) { parse(F.ClangTidy, N); });
|
||||
Dict.parse(N);
|
||||
}
|
||||
|
@ -154,6 +155,15 @@ private:
|
|||
Dict.parse(N);
|
||||
}
|
||||
|
||||
void parse(Fragment::DiagnosticsBlock::IncludesBlock &F, Node &N) {
|
||||
DictParser Dict("Includes", this);
|
||||
Dict.handle("IgnoreHeader", [&](Node &N) {
|
||||
if (auto Values = scalarValues(N))
|
||||
F.IgnoreHeader = std::move(*Values);
|
||||
});
|
||||
Dict.parse(N);
|
||||
}
|
||||
|
||||
void parse(Fragment::IndexBlock &F, Node &N) {
|
||||
DictParser Dict("Index", this);
|
||||
Dict.handle("Background",
|
||||
|
|
|
@ -247,6 +247,20 @@ InlayHints:
|
|||
EXPECT_EQ(Results[0].InlayHints.DeducedTypes, llvm::None);
|
||||
}
|
||||
|
||||
TEST(ParseYAML, IncludesIgnoreHeader) {
|
||||
CapturedDiags Diags;
|
||||
Annotations YAML(R"yaml(
|
||||
Diagnostics:
|
||||
Includes:
|
||||
IgnoreHeader: [foo, bar]
|
||||
)yaml");
|
||||
auto Results =
|
||||
Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback());
|
||||
ASSERT_THAT(Diags.Diagnostics, IsEmpty());
|
||||
ASSERT_EQ(Results.size(), 1u);
|
||||
EXPECT_THAT(Results[0].Diagnostics.Includes.IgnoreHeader,
|
||||
ElementsAre(val("foo"), val("bar")));
|
||||
}
|
||||
} // namespace
|
||||
} // namespace config
|
||||
} // namespace clangd
|
||||
|
|
Loading…
Reference in New Issue