[PATCH] D90748: [clangd] Introduce config parsing for External blocks
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG359e2f988dc5: [clangd] Introduce config parsing for External blocks (authored by kadircet). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90748/new/ https://reviews.llvm.org/D90748 Files: clang-tools-extra/clangd/ConfigFragment.h 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 @@ -10,6 +10,7 @@ #include "ConfigFragment.h" #include "ConfigTesting.h" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -142,6 +143,25 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +Server: ^"bar" +MountPoint: "baz" + )yaml"); + auto Results = + Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback()); + ASSERT_EQ(Results.size(), 1u); + ASSERT_TRUE(Results[0].Index.External); + EXPECT_THAT(*Results[0].Index.External.getValue()->File, Val("foo")); + EXPECT_THAT(*Results[0].Index.External.getValue()->MountPoint, Val("baz")); + ASSERT_THAT(Diags.Diagnostics, IsEmpty()); + EXPECT_THAT(*Results[0].Index.External.getValue()->Server, Val("bar")); +} + } // namespace } // namespace config } // namespace clangd Index: clang-tools-extra/clangd/ConfigYAML.cpp === --- clang-tools-extra/clangd/ConfigYAML.cpp +++ clang-tools-extra/clangd/ConfigYAML.cpp @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--===// - #include "ConfigFragment.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallSet.h" @@ -111,6 +110,22 @@ DictParser Dict("Index", this); Dict.handle("Background", [&](Node &N) { F.Background = scalarValue(N, "Background"); }); +Dict.handle("External", [&](Node &N) { + Fragment::IndexBlock::ExternalBlock External; + parse(External, N); + F.External.emplace(std::move(External)); + F.External->Range = N.getSourceRange(); +}); +Dict.parse(N); + } + + void parse(Fragment::IndexBlock::ExternalBlock &F, Node &N) { +DictParser Dict("External", this); +Dict.handle("File", [&](Node &N) { F.File = scalarValue(N, "File"); }); +Dict.handle("Server", +[&](Node &N) { F.Server = scalarValue(N, "Server"); }); +Dict.handle("MountPoint", +[&](Node &N) { F.MountPoint = scalarValue(N, "MountPoint"); }); Dict.parse(N); } Index: clang-tools-extra/clangd/ConfigFragment.h === --- clang-tools-extra/clangd/ConfigFragment.h +++ clang-tools-extra/clangd/ConfigFragment.h @@ -162,6 +162,22 @@ /// This is checked for translation units only, not headers they include. /// Legal values are "Build" or "Skip". llvm::Optional> Background; +/// An external index uses data source outside of clangd itself. This is +/// usually prepared using clangd-indexer. +/// Exactly one source (File/Server) should be configured. +struct ExternalBlock { + /// Path to an index file generated by clangd-indexer. Relative paths may + /// be used, if config fragment is associated with a directory. + llvm::Optional> File; + /// Address and port number for a clangd-index-server. e.g. + /// `123.1.1.1:13337`. + llvm::Optional> Server; + /// Source root governed by this index. Default is the directory + /// associated with the config fragment. Absolute in case of user config + /// and relative otherwise. Should always use forward-slashes. + llvm::Optional> MountPoint; +}; +llvm::Optional> External; }; IndexBlock Index; Index: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp === --- clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp +++ clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp @@ -10,6 +10,7 @@ #include "ConfigFragment.h" #include "ConfigTesting.h" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -142,6 +143,25 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +
[PATCH] D90748: [clangd] Introduce config parsing for External blocks
kadircet updated this revision to Diff 304060. kadircet added a comment. - Preserve location of external block Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90748/new/ https://reviews.llvm.org/D90748 Files: clang-tools-extra/clangd/ConfigFragment.h 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 @@ -10,6 +10,7 @@ #include "ConfigFragment.h" #include "ConfigTesting.h" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -124,6 +125,25 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +Server: ^"bar" +MountPoint: "baz" + )yaml"); + auto Results = + Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback()); + ASSERT_EQ(Results.size(), 1u); + ASSERT_TRUE(Results[0].Index.External); + EXPECT_THAT(*Results[0].Index.External.getValue()->File, Val("foo")); + EXPECT_THAT(*Results[0].Index.External.getValue()->MountPoint, Val("baz")); + ASSERT_THAT(Diags.Diagnostics, IsEmpty()); + EXPECT_THAT(*Results[0].Index.External.getValue()->Server, Val("bar")); +} + } // namespace } // namespace config } // namespace clangd Index: clang-tools-extra/clangd/ConfigYAML.cpp === --- clang-tools-extra/clangd/ConfigYAML.cpp +++ clang-tools-extra/clangd/ConfigYAML.cpp @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--===// - #include "ConfigFragment.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallSet.h" @@ -86,6 +85,22 @@ DictParser Dict("Index", this); Dict.handle("Background", [&](Node &N) { F.Background = scalarValue(N, "Background"); }); +Dict.handle("External", [&](Node &N) { + Fragment::IndexBlock::ExternalBlock External; + parse(External, N); + F.External.emplace(std::move(External)); + F.External->Range = N.getSourceRange(); +}); +Dict.parse(N); + } + + void parse(Fragment::IndexBlock::ExternalBlock &F, Node &N) { +DictParser Dict("External", this); +Dict.handle("File", [&](Node &N) { F.File = scalarValue(N, "File"); }); +Dict.handle("Server", +[&](Node &N) { F.Server = scalarValue(N, "Server"); }); +Dict.handle("MountPoint", +[&](Node &N) { F.MountPoint = scalarValue(N, "MountPoint"); }); Dict.parse(N); } Index: clang-tools-extra/clangd/ConfigFragment.h === --- clang-tools-extra/clangd/ConfigFragment.h +++ clang-tools-extra/clangd/ConfigFragment.h @@ -162,6 +162,22 @@ /// This is checked for translation units only, not headers they include. /// Legal values are "Build" or "Skip". llvm::Optional> Background; +/// An external index uses data source outside of clangd itself. This is +/// usually prepared using clangd-indexer. +/// Exactly one source (File/Server) should be configured. +struct ExternalBlock { + /// Path to an index file generated by clangd-indexer. Relative paths may + /// be used, if config fragment is associated with a directory. + llvm::Optional> File; + /// Address and port number for a clangd-index-server. e.g. + /// `123.1.1.1:13337`. + llvm::Optional> Server; + /// Source root governed by this index. Default is the directory + /// associated with the config fragment. Absolute in case of user config + /// and relative otherwise. Should always use forward-slashes. + llvm::Optional> MountPoint; +}; +llvm::Optional> External; }; IndexBlock Index; Index: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp === --- clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp +++ clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp @@ -10,6 +10,7 @@ #include "ConfigFragment.h" #include "ConfigTesting.h" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -124,6 +125,25 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +Server: ^"bar" +MountPoint: "baz" + )yaml"); + auto Results = + Fragment::parseYAML(YAML.code(), "config.yaml", Diag
[PATCH] D90748: [clangd] Introduce config parsing for External blocks
kadircet added a comment. > (Meta-point: not sure how useful splitting this patch out from the compile > step is...) I wanted to keep them separate especially to ensure testing isn't mixed up. As these things tend to get big easily :/ Comment at: clang-tools-extra/clangd/ConfigFragment.h:173 + /// otherwise. + llvm::Optional> File; + /// Address and port number for a remote-index. e.g. `123.1.1.1:13337`. sammccall wrote: > Should we mention slashes here too? :-\ > > Maybe we should just lift "all paths use forward-slashes" to a top-level > comment. This is literally used for pointing at a file on disk though. So it doesn't really matter if this is forward or back slashes? Comment at: clang-tools-extra/clangd/ConfigFragment.h:176 + llvm::Optional> Server; + /// Source root governed by this index. None implies current config file + /// location. Absolute in case of user config and relative otherwise. sammccall wrote: > Again: "Default is the directory associated with the config frament". > > (Repeating this makes me wonder if we should have defined a more specific > name like "Home"...) not sure where else we repeated this ? Comment at: clang-tools-extra/clangd/ConfigYAML.cpp:103 +#else + warning("Remote index support isn't enabled for this clangd.", N); +#endif sammccall wrote: > nit: this sort of validation would normally live in ConfigCompile, since it's > not to do with serialization moving into compile logic. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90748/new/ https://reviews.llvm.org/D90748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D90748: [clangd] Introduce config parsing for External blocks
kadircet added a comment. (sorry looks like i forgot to hit submit :( ) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90748/new/ https://reviews.llvm.org/D90748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D90748: [clangd] Introduce config parsing for External blocks
kadircet updated this revision to Diff 303824. kadircet marked 6 inline comments as done. kadircet added a comment. - Update comments - Drop the warning for specifying server on non-grpc builds Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90748/new/ https://reviews.llvm.org/D90748 Files: clang-tools-extra/clangd/ConfigFragment.h 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 @@ -10,6 +10,7 @@ #include "ConfigFragment.h" #include "ConfigTesting.h" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -124,6 +125,25 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +Server: ^"bar" +MountPoint: "baz" + )yaml"); + auto Results = + Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback()); + ASSERT_EQ(Results.size(), 1u); + ASSERT_TRUE(Results[0].Index.External); + EXPECT_THAT(*Results[0].Index.External->File, Val("foo")); + EXPECT_THAT(*Results[0].Index.External->MountPoint, Val("baz")); + ASSERT_THAT(Diags.Diagnostics, IsEmpty()); + EXPECT_THAT(*Results[0].Index.External->Server, Val("bar")); +} + } // namespace } // namespace config } // namespace clangd Index: clang-tools-extra/clangd/ConfigYAML.cpp === --- clang-tools-extra/clangd/ConfigYAML.cpp +++ clang-tools-extra/clangd/ConfigYAML.cpp @@ -5,7 +5,6 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--===// - #include "ConfigFragment.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallSet.h" @@ -86,6 +85,20 @@ DictParser Dict("Index", this); Dict.handle("Background", [&](Node &N) { F.Background = scalarValue(N, "Background"); }); +Dict.handle("External", [&](Node &N) { + F.External.emplace(); + parse(*F.External, N); +}); +Dict.parse(N); + } + + void parse(Fragment::IndexBlock::ExternalBlock &F, Node &N) { +DictParser Dict("External", this); +Dict.handle("File", [&](Node &N) { F.File = scalarValue(N, "File"); }); +Dict.handle("Server", +[&](Node &N) { F.Server = scalarValue(N, "Server"); }); +Dict.handle("MountPoint", +[&](Node &N) { F.MountPoint = scalarValue(N, "MountPoint"); }); Dict.parse(N); } Index: clang-tools-extra/clangd/ConfigFragment.h === --- clang-tools-extra/clangd/ConfigFragment.h +++ clang-tools-extra/clangd/ConfigFragment.h @@ -162,6 +162,22 @@ /// This is checked for translation units only, not headers they include. /// Legal values are "Build" or "Skip". llvm::Optional> Background; +/// An external index uses data source outside of clangd itself. This is +/// usually prepared using clangd-indexer. +/// Exactly one source (File/Server) should be configured. +struct ExternalBlock { + /// Path to an index file generated by clangd-indexer. Relative paths may + /// be used, if config fragment is associated with a directory. + llvm::Optional> File; + /// Address and port number for a clangd-index-server. e.g. + /// `123.1.1.1:13337`. + llvm::Optional> Server; + /// Source root governed by this index. Default is the directory + /// associated with the config fragment. Absolute in case of user config + /// and relative otherwise. Should always use forward-slashes. + llvm::Optional> MountPoint; +}; +llvm::Optional External; }; IndexBlock Index; Index: clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp === --- clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp +++ clang-tools-extra/clangd/unittests/ConfigYAMLTests.cpp @@ -10,6 +10,7 @@ #include "ConfigFragment.h" #include "ConfigTesting.h" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -124,6 +125,25 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +Server: ^"bar" +MountPoint: "baz" + )yaml"); + auto Results = + Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback()); + ASSERT_EQ(Results.size(), 1u); + ASSERT_TRUE(Resu
[PATCH] D90748: [clangd] Introduce config parsing for External blocks
sammccall added a comment. LG (comment nits) thanks! (Meta-point: not sure how useful splitting this patch out from the compile step is...) Comment at: clang-tools-extra/clangd/ConfigFragment.h:165 llvm::Optional> Background; +/// Configuration information for an external index. If both File and Server +/// are set, Server will be ignored. This will be used by index I'd move the file-take-precedence-over-server part to server. Or even just say only one source (file/server) should be configured, leave the behavior unspecified, and report an error when compiling the fragment. Comment at: clang-tools-extra/clangd/ConfigFragment.h:165 llvm::Optional> Background; +/// Configuration information for an external index. If both File and Server +/// are set, Server will be ignored. This will be used by index sammccall wrote: > I'd move the file-take-precedence-over-server part to server. > > Or even just say only one source (file/server) should be configured, leave > the behavior unspecified, and report an error when compiling the fragment. "Configuration information for" is redundant here. maybe just /// An external index uses data source outside of clangd itself. /// This is usually prepared using clangd-indexer. Comment at: clang-tools-extra/clangd/ConfigFragment.h:170 +struct ExternalBlock { + /// Path to a monolithic index on disk. Absolute in case of a global + /// config, relative to location the config file containing the fragment nit: I'm not sure "monolithic" is a useful qualifier to the audience here. Path to an index file generated by clangd-indexer? Comment at: clang-tools-extra/clangd/ConfigFragment.h:171 + /// Path to a monolithic index on disk. Absolute in case of a global + /// config, relative to location the config file containing the fragment + /// otherwise. Generalize this as "Relative paths may be used, if the config fragment is associated with a directory."? Comment at: clang-tools-extra/clangd/ConfigFragment.h:173 + /// otherwise. + llvm::Optional> File; + /// Address and port number for a remote-index. e.g. `123.1.1.1:13337`. Should we mention slashes here too? :-\ Maybe we should just lift "all paths use forward-slashes" to a top-level comment. Comment at: clang-tools-extra/clangd/ConfigFragment.h:174 + llvm::Optional> File; + /// Address and port number for a remote-index. e.g. `123.1.1.1:13337`. + llvm::Optional> Server; nit: for a clangd-index-server Comment at: clang-tools-extra/clangd/ConfigFragment.h:176 + llvm::Optional> Server; + /// Source root governed by this index. None implies current config file + /// location. Absolute in case of user config and relative otherwise. Again: "Default is the directory associated with the config frament". (Repeating this makes me wonder if we should have defined a more specific name like "Home"...) Comment at: clang-tools-extra/clangd/ConfigYAML.cpp:103 +#else + warning("Remote index support isn't enabled for this clangd.", N); +#endif nit: this sort of validation would normally live in ConfigCompile, since it's not to do with serialization Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90748/new/ https://reviews.llvm.org/D90748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D90748: [clangd] Introduce config parsing for External blocks
kadircet created this revision. kadircet added a reviewer: sammccall. Herald added subscribers: cfe-commits, usaxena95, arphaman. Herald added a project: clang. kadircet requested review of this revision. Herald added subscribers: MaskRay, ilya-biryukov. Enable configuration of remote and static indexes through config files in addition to command line arguments. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D90748 Files: clang-tools-extra/clangd/ConfigFragment.h 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 @@ -9,7 +9,9 @@ #include "Annotations.h" #include "ConfigFragment.h" #include "ConfigTesting.h" +#include "Features.inc" #include "Protocol.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/SMLoc.h" #include "llvm/Support/ScopedPrinter.h" #include "llvm/Support/SourceMgr.h" @@ -124,6 +126,34 @@ ASSERT_THAT(Results, IsEmpty()); } +TEST(ParseYAML, ExternalBlock) { + CapturedDiags Diags; + Annotations YAML(R"yaml( +Index: + External: +File: "foo" +Server: ^"bar" +MountPoint: "baz" + )yaml"); + auto Results = + Fragment::parseYAML(YAML.code(), "config.yaml", Diags.callback()); + ASSERT_EQ(Results.size(), 1u); + ASSERT_TRUE(Results[0].Index.External); + EXPECT_THAT(*Results[0].Index.External->File, Val("foo")); + EXPECT_THAT(*Results[0].Index.External->MountPoint, Val("baz")); +#if CLANGD_ENABLE_REMOTE + ASSERT_THAT(Diags.Diagnostics, IsEmpty()); + EXPECT_THAT(*Results[0].Index.External->Server, Val("bar")); +#else + EXPECT_FALSE(Results[0].Index.External->Server); + EXPECT_THAT( + Diags.Diagnostics, + ElementsAre(AllOf( + DiagMessage("Remote index support isn't enabled for this clangd."), + DiagPos(YAML.point()), DiagKind(llvm::SourceMgr::DK_Warning; +#endif +} + } // namespace } // namespace config } // namespace clangd Index: clang-tools-extra/clangd/ConfigYAML.cpp === --- clang-tools-extra/clangd/ConfigYAML.cpp +++ clang-tools-extra/clangd/ConfigYAML.cpp @@ -5,8 +5,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===--===// - #include "ConfigFragment.h" +#include "Features.inc" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringRef.h" @@ -86,6 +86,25 @@ DictParser Dict("Index", this); Dict.handle("Background", [&](Node &N) { F.Background = scalarValue(N, "Background"); }); +Dict.handle("External", [&](Node &N) { + F.External.emplace(); + parse(*F.External, N); +}); +Dict.parse(N); + } + + void parse(Fragment::IndexBlock::ExternalBlock &F, Node &N) { +DictParser Dict("External", this); +Dict.handle("File", [&](Node &N) { F.File = scalarValue(N, "File"); }); +Dict.handle("Server", [&](Node &N) { +#if CLANGD_ENABLE_REMOTE + F.Server = scalarValue(N, "Server"); +#else + warning("Remote index support isn't enabled for this clangd.", N); +#endif +}); +Dict.handle("MountPoint", +[&](Node &N) { F.MountPoint = scalarValue(N, "MountPoint"); }); Dict.parse(N); } Index: clang-tools-extra/clangd/ConfigFragment.h === --- clang-tools-extra/clangd/ConfigFragment.h +++ clang-tools-extra/clangd/ConfigFragment.h @@ -162,6 +162,23 @@ /// This is checked for translation units only, not headers they include. /// Legal values are "Build" or "Skip". llvm::Optional> Background; +/// Configuration information for an external index. If both File and Server +/// are set, Server will be ignored. This will be used by index +/// implementations to distribute queries to different index sources based +/// on the file. +struct ExternalBlock { + /// Path to a monolithic index on disk. Absolute in case of a global + /// config, relative to location the config file containing the fragment + /// otherwise. + llvm::Optional> File; + /// Address and port number for a remote-index. e.g. `123.1.1.1:13337`. + llvm::Optional> Server; + /// Source root governed by this index. None implies current config file + /// location. Absolute in case of user config and relative otherwise. + /// Should always use forward-slashes. + llvm::Optional> MountPoint; +}; +llvm::Optional External; }; IndexBlock Index; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits