[PATCH] D133298: [clang-rename] RecursiveSymbolVisitor - visit namespace aliases and using directives

imctrading via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 5 08:18:25 PDT 2022


imctrading updated this revision to Diff 458010.
imctrading added a comment.

Fix formatting in `RecursiveSymbolVisitor.h`


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

https://reviews.llvm.org/D133298

Files:
  clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
  clang/test/clang-rename/Namespace.cpp


Index: clang/test/clang-rename/Namespace.cpp
===================================================================
--- clang/test/clang-rename/Namespace.cpp
+++ clang/test/clang-rename/Namespace.cpp
@@ -6,6 +6,9 @@
   gcc::x = 42;                // CHECK: clang::x = 42;
 }
 
+namespace gcc_alias = gcc;    // CHECK: namespace gcc_alias = clang;
+using namespace gcc;          // CHECK: using namespace clang;
+
 // Test 1.
 // RUN: clang-rename -offset=10 -new-name=clang %s -- | sed 's,//.*,,' | FileCheck %s
 
Index: clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
===================================================================
--- clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
+++ clang/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h
@@ -133,6 +133,16 @@
     return true;
   }
 
+  bool VisitNamespaceAliasDecl(NamespaceAliasDecl *Declaration) {
+    return visit(Declaration->getAliasedNamespace(),
+                 Declaration->getTargetNameLoc(), Declaration->getEndLoc());
+  }
+
+  bool VisitUsingDirectiveDecl(UsingDirectiveDecl *Declaration) {
+    return visit(Declaration->getNominatedNamespace(),
+                 Declaration->getIdentLocation(), Declaration->getEndLoc());
+  }
+
 private:
   const SourceManager &SM;
   const LangOptions &LangOpts;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133298.458010.patch
Type: text/x-patch
Size: 1319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220905/5aa61b35/attachment.bin>


More information about the cfe-commits mailing list