Author: Mariya Podchishchaeva Date: 2023-07-13T06:47:49-04:00 New Revision: 8b4a27f410ba42b2e19651ddafc60cd878d0963c
URL: https://github.com/llvm/llvm-project/commit/8b4a27f410ba42b2e19651ddafc60cd878d0963c DIFF: https://github.com/llvm/llvm-project/commit/8b4a27f410ba42b2e19651ddafc60cd878d0963c.diff LOG: [clangd][NFC] Remove dead code refactor/tweaks/ExtractVariable.cpp: Condition (!C++ && !ExprType) is never true because if ExprType was null we would early-exit earlier. tool/ClangdMain.cpp: StaticIdx variable is not initialized before check, so checking it doesn't make sense. Found by static analyzer tool. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D155164 Added: Modified: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp clang-tools-extra/clangd/tool/ClangdMain.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp index aac017c0725d47..cdf2c6b988cf9b 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp @@ -402,12 +402,6 @@ bool eligibleForExtraction(const SelectionTree::Node *N) { if (!ExprType || ExprType->isVoidType()) return false; - // Must know the type of the result in order to spell it, or instead use - // `auto` in C++. - if (!N->getDeclContext().getParentASTContext().getLangOpts().CPlusPlus11 && - !ExprType) - return false; - // A plain reference to a name (e.g. variable) isn't worth extracting. // FIXME: really? What if it's e.g. `std::is_same<void, void>::value`? if (llvm::isa<DeclRefExpr>(E)) diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index 27f70a527cd3cb..865dd0a44aa4a9 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -879,7 +879,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var Opts.ResourceDir = ResourceDir; Opts.BuildDynamicSymbolIndex = true; std::vector<std::unique_ptr<SymbolIndex>> IdxStack; - std::unique_ptr<SymbolIndex> StaticIdx; #if CLANGD_ENABLE_REMOTE if (RemoteIndexAddress.empty() != ProjectRoot.empty()) { llvm::errs() << "remote-index-address and project-path have to be " @@ -900,14 +899,7 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var Opts.ReferencesLimit = ReferencesLimit; Opts.Rename.LimitFiles = RenameFileLimit; auto PAI = createProjectAwareIndex(loadExternalIndex, Sync); - if (StaticIdx) { - IdxStack.emplace_back(std::move(StaticIdx)); - IdxStack.emplace_back( - std::make_unique<MergedIndex>(PAI.get(), IdxStack.back().get())); - Opts.StaticIndex = IdxStack.back().get(); - } else { - Opts.StaticIndex = PAI.get(); - } + Opts.StaticIndex = PAI.get(); Opts.AsyncThreadsCount = WorkerThreadsCount; Opts.MemoryCleanup = getMemoryCleanupFunction(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits