[PATCH] D120713: [clangd] Make dexp command line options sticky

Yevgeny Rouban via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 1 04:00:10 PST 2022


yrouban created this revision.
yrouban added reviewers: jhenderson, lattner, jpienaar, mehdi_amini.
yrouban added a project: clang.
Herald added subscribers: usaxena95, kadircet, arphaman.
yrouban requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Preparing for the cl::opt reset fix proposed on D115433 <https://reviews.llvm.org/D115433> this patch fixes the dexp tool to preserve its three command line options (IndexLocation, ExecCommand, ProjectRoot) from reset that is done before parsing query options.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120713

Files:
  clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp


Index: clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
===================================================================
--- clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -413,6 +413,12 @@
   using namespace clang::clangd;
 
   llvm::cl::ParseCommandLineOptions(argc, argv, Overview);
+
+  // Protect IndexLocation, ExecCommand and ProjectRoot from being reset.
+  IndexLocation.setValue(IndexLocation, true /* initial */);
+  ExecCommand.setValue(ExecCommand, true /* initial */);
+  ProjectRoot.setValue(ProjectRoot, true /* initial */);
+
   llvm::cl::ResetCommandLineParser(); // We reuse it for REPL commands.
   llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120713.412042.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220301/abfe5bb1/attachment.bin>


More information about the llvm-commits mailing list