[PATCH] D87745: [clangd] Config: handle Index block
Aleksandr Platonov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 16 00:41:46 PDT 2020
ArcsinX created this revision.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, jkorous.
Herald added a project: clang.
ArcsinX requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.
Without this patch config parser ignores `Index` block and reports warning "Unknown Config key Index".
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87745
Files:
clang-tools-extra/clangd/ConfigYAML.cpp
clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
Index: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
@@ -119,6 +119,16 @@
ASSERT_THAT(Results, IsEmpty());
}
+TEST(ParseYAML, Index) {
+ CapturedDiags Diags;
+ const char *YAML = R"yaml(
+Index:
+ Background: Skip
+ )yaml";
+ auto Results = Fragment::parseYAML(YAML, "config.yaml", Diags.callback());
+ EXPECT_THAT(Diags.Diagnostics, IsEmpty());
+}
+
} // namespace
} // namespace config
} // namespace clangd
Index: clang-tools-extra/clangd/ConfigYAML.cpp
===================================================================
--- clang-tools-extra/clangd/ConfigYAML.cpp
+++ clang-tools-extra/clangd/ConfigYAML.cpp
@@ -38,6 +38,7 @@
DictParser Dict("Config", this);
Dict.handle("If", [&](Node &N) { parse(F.If, N); });
Dict.handle("CompileFlags", [&](Node &N) { parse(F.CompileFlags, N); });
+ Dict.handle("Index", [&](Node &N) { parse(F.Index, N); });
Dict.parse(N);
return !(N.failed() || HadError);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87745.292125.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200916/68bc8c50/attachment.bin>
More information about the cfe-commits
mailing list