[clang-tools-extra] 1c2e249 - [clangd] IncludeCleaner: don't stop the traversal

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 07:11:11 PDT 2021


Author: Kirill Bobyrev
Date: 2021-10-26T16:08:54+02:00
New Revision: 1c2e249f938c50e1b331a1f7adc83c0a381f3897

URL: https://github.com/llvm/llvm-project/commit/1c2e249f938c50e1b331a1f7adc83c0a381f3897
DIFF: https://github.com/llvm/llvm-project/commit/1c2e249f938c50e1b331a1f7adc83c0a381f3897.diff

LOG: [clangd] IncludeCleaner: don't stop the traversal

I was under the impression that `return false;` in the
RecursiveASTVisitor stops the traversal for the subtree but it appears
that it stops the whole tree traversal, so this change introduces a bug
where `ReferencedLocationCrawler` will not collect any symbols past an
enum.

This is a follow-up on D112209.

Added: 
    

Modified: 
    clang-tools-extra/clangd/IncludeCleaner.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp
index 50f5a926111e..af82c96e494a 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -98,7 +98,7 @@ class ReferencedLocationCrawler
   bool VisitEnumDecl(EnumDecl *D) {
     if (D->isThisDeclarationADefinition() && D->getIntegerTypeSourceInfo())
       add(D);
-    return false;
+    return true;
   }
 
 private:


        


More information about the cfe-commits mailing list