[clang-tools-extra] [clangd] Allow specifying what headers are always included via "" or <> (PR #67749)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 23:17:29 PST 2024


================
@@ -539,6 +539,42 @@ TEST_F(ConfigCompileTests, Style) {
   Frag.Style.FullyQualifiedNamespaces.push_back(std::string("bar"));
   EXPECT_TRUE(compileAndApply());
   EXPECT_THAT(Conf.Style.FullyQualifiedNamespaces, ElementsAre("foo", "bar"));
+
+  {
+    Frag = {};
+    EXPECT_TRUE(Conf.Style.QuotedHeaders.empty())
+        << Conf.Style.QuotedHeaders.size();
+    Frag.Style.QuotedHeaders.push_back(Located<std::string>("foo.h"));
+    Frag.Style.QuotedHeaders.push_back(Located<std::string>(".*inc"));
+    EXPECT_TRUE(compileAndApply());
+    auto HeaderFilter = [this](llvm::StringRef Path) {
+      for (auto &Filter : Conf.Style.QuotedHeaders) {
+        if (Filter(Path))
+          return true;
+      }
+      return false;
+    };
+    EXPECT_TRUE(HeaderFilter("foo.h"));
----------------
HighCommander4 wrote:

consider checking `"prefix/foo.h"` as well

https://github.com/llvm/llvm-project/pull/67749


More information about the cfe-commits mailing list