[PATCH] D155164: [clangd][NFC] Remove dead code
Mariya Podchishchaeva via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 13 02:28:30 PDT 2023
Fznamznon created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
Fznamznon requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155164
Files:
clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -879,7 +879,6 @@
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 @@
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();
Index: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
===================================================================
--- clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
@@ -402,12 +402,6 @@
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))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155164.539906.patch
Type: text/x-patch
Size: 1902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230713/64887249/attachment.bin>
More information about the cfe-commits
mailing list