[PATCH] D124688: [clangd] parse all make_unique-like functions in preamble

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 30 04:23:31 PDT 2022

sammccall added a comment.

Great! If this were to be a public, user-controlled feature we'd make it part of the config file <https://clangd.llvm.org/config> which is a bit more involved, but I think this is rather just a developer toggle until it's time to turn it on by default, so a command-line flag seems fine.

This needs to be passed from the main binary => ClangdServer => Preamble::build, as something like `bool AlwaysParseForwardingFunctions`.

I think the most appropriate place to pass this to Preamble::build is in ParseOptions defined in `Compiler.h` (currently empty) which is embedded in ParseInputs. Something like `bool AlwaysParseForwardingFunctions`.
And the usual way to pass command line flags into ClangdServer is via ClangdServer::Options.

See https://github.com/llvm/llvm-project/commit/e6be5c7cd6d227144f874623e2764890f80cad32 where we removed a couple of ParseOptions, I think you'd basically want the opposite of that.
(Sorry about the plumbing, configuration is always a pain).

For testing, you want the ability to turn this option on in TestTU. I'd just add `ParseOptions TestTU::ParseOpts` as a public member that your test can set, and use it from `TestTU::inputs()` instead of the current `Inputs.Opts = ParseOptions();`.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list