[PATCH] D96495: [clangd] Retire the cross-file-rename command-line flag.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 11 11:29:09 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG573348ab9b28: [clangd] Retire the cross-file-rename command-line flag. (authored by hokein).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96495/new/

https://reviews.llvm.org/D96495

Files:
  clang-tools-extra/clangd/refactor/Rename.h
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -832,8 +832,12 @@
     TU.ExtraArgs.push_back("-xobjective-c++");
     auto AST = TU.build();
     for (const auto &RenamePos : Code.points()) {
-      auto RenameResult =
-          rename({RenamePos, NewName, AST, testPath(TU.Filename)});
+      auto RenameResult = rename({RenamePos,
+                                  NewName,
+                                  AST,
+                                  testPath(TU.Filename),
+                                  /*Index*/ nullptr,
+                                  {/*CrossFile*/ false}});
       ASSERT_TRUE(bool(RenameResult)) << RenameResult.takeError();
       ASSERT_EQ(1u, RenameResult->GlobalChanges.size());
       EXPECT_EQ(
@@ -1133,8 +1137,12 @@
     }
     auto AST = TU.build();
     llvm::StringRef NewName = Case.NewName;
-    auto Results =
-        rename({T.point(), NewName, AST, testPath(TU.Filename), Case.Index});
+    auto Results = rename({T.point(),
+                           NewName,
+                           AST,
+                           testPath(TU.Filename),
+                           Case.Index,
+                           {/*CrossFile=*/false}});
     bool WantRename = true;
     if (T.ranges().empty())
       WantRename = false;
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -286,6 +286,7 @@
 RetiredFlag<bool> RecoveryASTType("recovery-ast-type");
 RetiredFlag<bool> AsyncPreamble("async-preamble");
 RetiredFlag<bool> CollectMainFileRefs("collect-main-file-refs");
+RetiredFlag<bool> CrossFileRename("cross-file-rename");
 
 opt<int> LimitResults{
     "limit-results",
@@ -295,7 +296,6 @@
     init(100),
 };
 
-
 list<std::string> TweakList{
     "tweaks",
     cat(Features),
@@ -304,13 +304,6 @@
     CommaSeparated,
 };
 
-opt<bool> CrossFileRename{
-    "cross-file-rename",
-    cat(Features),
-    desc("Enable cross-file rename feature."),
-    init(true),
-};
-
 opt<bool> FoldingRanges{
     "folding-ranges",
     cat(Features),
@@ -852,9 +845,6 @@
   if (ForceOffsetEncoding != OffsetEncoding::UnsupportedEncoding)
     Opts.Encoding = ForceOffsetEncoding;
 
-  // Shall we allow to customize the file limit?
-  Opts.Rename.AllowCrossFile = CrossFileRename;
-
   if (CheckFile.getNumOccurrences()) {
     llvm::SmallString<256> Path;
     llvm::sys::fs::real_path(CheckFile, Path, /*expand_tilde=*/true);
Index: clang-tools-extra/clangd/refactor/Rename.h
===================================================================
--- clang-tools-extra/clangd/refactor/Rename.h
+++ clang-tools-extra/clangd/refactor/Rename.h
@@ -29,7 +29,7 @@
 struct RenameOptions {
   /// If true, enable cross-file rename; otherwise, only allows to rename a
   /// symbol that's only used in the current file.
-  bool AllowCrossFile = false;
+  bool AllowCrossFile = true;
   /// The maximum number of affected files (0 means no limit), only meaningful
   /// when AllowCrossFile = true.
   /// If the actual number exceeds the limit, rename is forbidden.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96495.323100.patch
Type: text/x-patch
Size: 3361 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210211/869439e1/attachment-0001.bin>


More information about the cfe-commits mailing list