Skip to content

Conversation

@cachemeifyoucan
Copy link
Collaborator

Rename ReadPCHAndPreprocessAction class. This frontend action is used
for dependency scanning only and the current name is confusing for what
it actually does. Rename the class to DependencyScanningFrontendAction
to be clear for its usage.

Created using spr 1.3.5
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jan 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 9, 2025

@llvm/pr-subscribers-clang

Author: Steven Wu (cachemeifyoucan)

Changes

Rename ReadPCHAndPreprocessAction class. This frontend action is used
for dependency scanning only and the current name is confusing for what
it actually does. Rename the class to DependencyScanningFrontendAction
to be clear for its usage.


Full diff: https://github.com/llvm/llvm-project/pull/122390.diff

3 Files Affected:

  • (modified) clang/include/clang/Frontend/FrontendActions.h (+2-2)
  • (modified) clang/lib/Frontend/FrontendActions.cpp (+2-2)
  • (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+1-1)
diff --git a/clang/include/clang/Frontend/FrontendActions.h b/clang/include/clang/Frontend/FrontendActions.h
index a620ddfc40447d..f16c68344479e4 100644
--- a/clang/include/clang/Frontend/FrontendActions.h
+++ b/clang/include/clang/Frontend/FrontendActions.h
@@ -32,8 +32,8 @@ class InitOnlyAction : public FrontendAction {
   bool usesPreprocessorOnly() const override { return false; }
 };
 
-/// Preprocessor-based frontend action that also loads PCH files.
-class ReadPCHAndPreprocessAction : public FrontendAction {
+/// Preprocessor-based frontend action that is used for dependency scanning.
+class DependencyScanningFrontendAction : public FrontendAction {
   void ExecuteAction() override;
 
   std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI,
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 30dfa5481d070a..f2a9602bdcafaf 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -69,7 +69,7 @@ void InitOnlyAction::ExecuteAction() {
 }
 
 // Basically PreprocessOnlyAction::ExecuteAction.
-void ReadPCHAndPreprocessAction::ExecuteAction() {
+void DependencyScanningFrontendAction::ExecuteAction() {
   Preprocessor &PP = getCompilerInstance().getPreprocessor();
 
   // Ignore unknown pragmas.
@@ -84,7 +84,7 @@ void ReadPCHAndPreprocessAction::ExecuteAction() {
 }
 
 std::unique_ptr<ASTConsumer>
-ReadPCHAndPreprocessAction::CreateASTConsumer(CompilerInstance &CI,
+DependencyScanningFrontendAction::CreateASTConsumer(CompilerInstance &CI,
                                               StringRef InFile) {
   return std::make_unique<ASTConsumer>();
 }
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index 5a648df05e4fd3..6db5a1cb41da1f 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -439,7 +439,7 @@ class DependencyScanningAction : public tooling::ToolAction {
     else if (ModuleName)
       Action = std::make_unique<GetDependenciesByModuleNameAction>(*ModuleName);
     else
-      Action = std::make_unique<ReadPCHAndPreprocessAction>();
+      Action = std::make_unique<DependencyScanningFrontendAction>();
 
     if (ScanInstance.getDiagnostics().hasErrorOccurred())
       return false;

@github-actions
Copy link

github-actions bot commented Jan 9, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Created using spr 1.3.5
@jansvoboda11
Copy link
Contributor

I agree that the name can be confusing. I think the original motivation for this name was to avoid spreading the concept of modular dependency scanning through the Clang codebase. Could we move this class into Tooling/DependencyScanning to keep that concept self-contained and outside the base Clang libraries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants