[clang] [clang] Rename overloaded virtual member function to prevent shadowing, NFCI (PR #157501)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 8 09:04:22 PDT 2025


https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/157501

Resolves warnings triggered by `Woverloaded-virtual`

>From 54fee3ec74c6f7b75f2aba5fc796d034311df830 Mon Sep 17 00:00:00 2001
From: Cyndy Ishida <cyndy_ishida at apple.com>
Date: Mon, 8 Sep 2025 09:00:27 -0700
Subject: [PATCH] [clang] Rename overloaded virtual member function to prevent
 shadowing, NFCI

---
 clang/include/clang/Serialization/ASTReader.h       | 13 +++++++------
 clang/lib/Frontend/FrontendActions.cpp              |  7 ++++---
 clang/lib/Serialization/ASTReader.cpp               |  2 +-
 .../DependencyScanning/DependencyScanningWorker.cpp |  7 ++++---
 4 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index 3ede0925676e8..af856a8097ab1 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -246,15 +246,16 @@ class ASTReaderListener {
     return true;
   }
 
-  /// Overloaded member function of \c visitInputFile that should
-  /// be defined when there is a distinction between
-  /// the file name and name-as-requested. For example, when deserializing input
+  /// Similiar to member function of \c visitInputFile but should
+  /// be defined when there is a distinction between the file name
+  /// and the name-as-requested. For example, when deserializing input
   /// files from precompiled AST files.
   ///
   /// \returns true to continue receiving the next input file, false to stop.
-  virtual bool visitInputFile(StringRef FilenameAsRequested, StringRef Filename,
-                              bool isSystem, bool isOverridden,
-                              bool isExplicitModule) {
+  virtual bool visitInputFileAsRequested(StringRef FilenameAsRequested,
+                                         StringRef Filename, bool isSystem,
+                                         bool isOverridden,
+                                         bool isExplicitModule) {
     return true;
   }
 
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index ccda2c4ce4b6d..f18318478d7a7 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -796,9 +796,10 @@ namespace {
     /// Indicates that the AST file contains particular input file.
     ///
     /// \returns true to continue receiving the next input file, false to stop.
-    bool visitInputFile(StringRef FilenameAsRequested, StringRef Filename,
-                        bool isSystem, bool isOverridden,
-                        bool isExplicitModule) override {
+    bool visitInputFileAsRequested(StringRef FilenameAsRequested,
+                                   StringRef Filename, bool isSystem,
+                                   bool isOverridden,
+                                   bool isExplicitModule) override {
 
       Out.indent(2) << "Input file: " << FilenameAsRequested;
 
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 9b0e699b1a829..1b3a8b13f1fb1 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -5987,7 +5987,7 @@ bool ASTReader::readASTFileControlBlock(
                 AdditionalPathBuf, UnresolvedFilename, ModuleDir);
             Filename = *FilenameBuf;
           }
-          shouldContinue = Listener.visitInputFile(
+          shouldContinue = Listener.visitInputFileAsRequested(
               *FilenameAsRequestedBuf, Filename, isSystemFile, Overridden,
               /*IsExplicitModule=*/false);
           break;
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index b2b61de790e8f..f32747ddf8183 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -127,9 +127,10 @@ class PrebuiltModuleListener : public ASTReaderListener {
   /// For each input file discovered, check whether it's external path is in a
   /// stable directory. Traversal is stopped if the current module is not
   /// considered stable.
-  bool visitInputFile(StringRef FilenameAsRequested, StringRef Filename,
-                      bool isSystem, bool isOverridden,
-                      bool isExplicitModule) override {
+  bool visitInputFileAsRequested(StringRef FilenameAsRequested,
+                                 StringRef Filename, bool isSystem,
+                                 bool isOverridden,
+                                 bool isExplicitModule) override {
     if (StableDirs.empty())
       return false;
     auto PrebuiltEntryIt = PrebuiltModulesASTMap.find(CurrentFile);



More information about the cfe-commits mailing list