[clang] 118f783 - [clang-rename] Respect the traversal scope when traversing the entire AST.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 01:44:19 PST 2019


Author: Haojian Wu
Date: 2019-11-07T10:43:54+01:00
New Revision: 118f7836a65e864ef3c7e015d58ca370fee65e89

URL: https://github.com/llvm/llvm-project/commit/118f7836a65e864ef3c7e015d58ca370fee65e89
DIFF: https://github.com/llvm/llvm-project/commit/118f7836a65e864ef3c7e015d58ca370fee65e89.diff

LOG: [clang-rename] Respect the traversal scope when traversing the entire AST.

Summary:
This should be NFC to clang-rename, by default the traversal scope is
TUDecl. Traversing the TUDecl in clangd is a performance cliff, we should
avoid it.

Reviewers: ilya-biryukov

Subscribers: kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69892

Added: 
    

Modified: 
    clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
index 966833137c26..d966a5ef23c2 100644
--- a/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
+++ b/clang/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp
@@ -67,7 +67,7 @@ class AdditionalUSRFinder : public RecursiveASTVisitor<AdditionalUSRFinder> {
 
   std::vector<std::string> Find() {
     // Fill OverriddenMethods and PartialSpecs storages.
-    TraverseDecl(Context.getTranslationUnitDecl());
+    TraverseAST(Context);
     if (const auto *MethodDecl = dyn_cast<CXXMethodDecl>(FoundDecl)) {
       addUSRsOfOverridenFunctions(MethodDecl);
       for (const auto &OverriddenMethod : OverriddenMethods) {


        


More information about the cfe-commits mailing list