[clang-tools-extra] 81f8df0 - [clangd] Make dexp command line options sticky
Yevgeny Rouban via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 8 22:01:17 PST 2022
Author: Yevgeny Rouban
Date: 2022-03-09T12:59:49+07:00
New Revision: 81f8df0c83c6a4476f5bffa6947c0e78a94138a7
URL: https://github.com/llvm/llvm-project/commit/81f8df0c83c6a4476f5bffa6947c0e78a94138a7
DIFF: https://github.com/llvm/llvm-project/commit/81f8df0c83c6a4476f5bffa6947c0e78a94138a7.diff
LOG: [clangd] Make dexp command line options sticky
Preparing for the cl::opt reset fix proposed on 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.
Tags: #clang
Added:
Modified:
clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index 2615d06bbd2b5..c6cefdf675ef5 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -413,6 +413,13 @@ int main(int argc, const char *argv[]) {
using namespace clang::clangd;
llvm::cl::ParseCommandLineOptions(argc, argv, Overview);
+
+ // Preserve global options when flag parser is reset, so commands can use
+ // them.
+ IndexLocation.setValue(IndexLocation, /*initial=*/ true);
+ ExecCommand.setValue(ExecCommand, /*initial=*/ true);
+ ProjectRoot.setValue(ProjectRoot, /*initial=*/ true);
+
llvm::cl::ResetCommandLineParser(); // We reuse it for REPL commands.
llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
More information about the cfe-commits
mailing list