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]);
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]);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits