[PATCH] D87710: [clangd] Actually parse Index section of the YAML file.
Adam Czachorowski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 16 04:12:33 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7029e5d4ca20: [clangd] Actually parse Index section of the YAML file. (authored by adamcz).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87710/new/
https://reviews.llvm.org/D87710
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
@@ -47,16 +47,21 @@
Add: |
b
az
+---
+Index:
+ Background: Skip
)yaml";
auto Results = Fragment::parseYAML(YAML, "config.yaml", Diags.callback());
EXPECT_THAT(Diags.Diagnostics, IsEmpty());
- ASSERT_EQ(Results.size(), 2u);
- EXPECT_FALSE(Results.front().If.HasUnrecognizedCondition);
- EXPECT_THAT(Results.front().If.PathMatch, ElementsAre(Val("abc")));
- EXPECT_THAT(Results.front().CompileFlags.Add,
- ElementsAre(Val("foo"), Val("bar")));
+ ASSERT_EQ(Results.size(), 3u);
+ EXPECT_FALSE(Results[0].If.HasUnrecognizedCondition);
+ EXPECT_THAT(Results[0].If.PathMatch, ElementsAre(Val("abc")));
+ EXPECT_THAT(Results[0].CompileFlags.Add, ElementsAre(Val("foo"), Val("bar")));
+
+ EXPECT_THAT(Results[1].CompileFlags.Add, ElementsAre(Val("b\naz\n")));
- EXPECT_THAT(Results.back().CompileFlags.Add, ElementsAre(Val("b\naz\n")));
+ ASSERT_TRUE(Results[2].Index.Background);
+ EXPECT_EQ("Skip", *Results[2].Index.Background.getValue());
}
TEST(ParseYAML, Locations) {
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: D87710.292177.patch
Type: text/x-patch
Size: 1791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200916/7421d12b/attachment-0001.bin>
More information about the cfe-commits
mailing list