[clang-tools-extra] 3ecfeb4 - [clangd] Wire up compilation for style blocks
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 14 23:19:04 PDT 2022
Author: Kadir Cetinkaya
Date: 2022-06-15T08:15:32+02:00
New Revision: 3ecfeb4c2f45a2bf0634bc53e3d5ae9aa673f7a4
URL: https://github.com/llvm/llvm-project/commit/3ecfeb4c2f45a2bf0634bc53e3d5ae9aa673f7a4
DIFF: https://github.com/llvm/llvm-project/commit/3ecfeb4c2f45a2bf0634bc53e3d5ae9aa673f7a4.diff
LOG: [clangd] Wire up compilation for style blocks
Differential Revision: https://reviews.llvm.org/D127749
Added:
Modified:
clang-tools-extra/clangd/ConfigCompile.cpp
clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp
index 0cdbc5526e6e5..2de8816f9f084 100644
--- a/clang-tools-extra/clangd/ConfigCompile.cpp
+++ b/clang-tools-extra/clangd/ConfigCompile.cpp
@@ -197,6 +197,7 @@ struct FragmentCompiler {
compile(std::move(F.Completion));
compile(std::move(F.Hover));
compile(std::move(F.InlayHints));
+ compile(std::move(F.Style));
}
void compile(Fragment::IfBlock &&F) {
diff --git a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
index 8761f371c1ad9..b3286e58efef1 100644
--- a/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ConfigCompileTests.cpp
@@ -536,6 +536,14 @@ TEST_F(ConfigCompileTests, AllScopes) {
EXPECT_TRUE(compileAndApply());
EXPECT_TRUE(Conf.Completion.AllScopes);
}
+
+TEST_F(ConfigCompileTests, Style) {
+ Frag = {};
+ Frag.Style.FullyQualifiedNamespaces.push_back(std::string("foo"));
+ Frag.Style.FullyQualifiedNamespaces.push_back(std::string("bar"));
+ EXPECT_TRUE(compileAndApply());
+ EXPECT_THAT(Conf.Style.FullyQualifiedNamespaces, ElementsAre("foo", "bar"));
+}
} // namespace
} // namespace config
} // namespace clangd
diff --git a/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp b/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
index 143bcf99fc547..ddf6f4f5fb1f6 100644
--- a/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp
@@ -261,6 +261,19 @@ TEST(ParseYAML, IncludesIgnoreHeader) {
EXPECT_THAT(Results[0].Diagnostics.Includes.IgnoreHeader,
ElementsAre(val("foo"), val("bar")));
}
+
+TEST(ParseYAML, Style) {
+ CapturedDiags Diags;
+ Annotations YAML(R"yaml(
+Style:
+ FullyQualifiedNamespaces: [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].Style.FullyQualifiedNamespaces,
+ ElementsAre(val("foo"), val("bar")));
+}
} // namespace
} // namespace config
} // namespace clangd
More information about the cfe-commits
mailing list