Skip to content

Conversation

@evelez7
Copy link
Member

@evelez7 evelez7 commented Nov 20, 2025

Removes unused headers or replaces them with headers that directly
provide the symbol instead. For example, Serialize.h included AST.h,
but it was actually Serialize.cpp that needed concept expressions, so
now it includes just ExprConcepts.h.

Removes unused headers or replaces them with headers that directly
provide the symbol instead. For example, `Serialize.h` included `AST.h`,
but it was actually `Serialize.cpp` that needed concept expressions, so
now it includes just `ExprConcepts.h`.
Copy link
Member Author

evelez7 commented Nov 20, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@evelez7 evelez7 marked this pull request as ready for review November 20, 2025 01:47
@llvmbot
Copy link
Member

llvmbot commented Nov 20, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Erick Velez (evelez7)

Changes

Removes unused headers or replaces them with headers that directly
provide the symbol instead. For example, Serialize.h included AST.h,
but it was actually Serialize.cpp that needed concept expressions, so
now it includes just ExprConcepts.h.


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

11 Files Affected:

  • (modified) clang-tools-extra/clang-doc/BitcodeReader.cpp (-1)
  • (modified) clang-tools-extra/clang-doc/BitcodeReader.h (-2)
  • (modified) clang-tools-extra/clang-doc/BitcodeWriter.h (-4)
  • (modified) clang-tools-extra/clang-doc/ClangDoc.cpp (-4)
  • (modified) clang-tools-extra/clang-doc/ClangDoc.h (-2)
  • (modified) clang-tools-extra/clang-doc/Mapper.h (-1)
  • (modified) clang-tools-extra/clang-doc/Representation.h (+1-3)
  • (modified) clang-tools-extra/clang-doc/Serialize.cpp (+2)
  • (modified) clang-tools-extra/clang-doc/Serialize.h (-3)
  • (modified) clang-tools-extra/clang-doc/support/File.h (+1-1)
  • (modified) clang-tools-extra/clang-doc/tool/ClangDocMain.cpp (-2)
diff --git a/clang-tools-extra/clang-doc/BitcodeReader.cpp b/clang-tools-extra/clang-doc/BitcodeReader.cpp
index 4efbbd34730cf..dd5bbcd998784 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.cpp
+++ b/clang-tools-extra/clang-doc/BitcodeReader.cpp
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "BitcodeReader.h"
-#include "llvm/ADT/IndexedMap.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/clang-tools-extra/clang-doc/BitcodeReader.h b/clang-tools-extra/clang-doc/BitcodeReader.h
index 4947721f0a06d..d51ac8bb83311 100644
--- a/clang-tools-extra/clang-doc/BitcodeReader.h
+++ b/clang-tools-extra/clang-doc/BitcodeReader.h
@@ -17,8 +17,6 @@
 
 #include "BitcodeWriter.h"
 #include "Representation.h"
-#include "clang/AST/AST.h"
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/Bitstream/BitstreamReader.h"
 #include "llvm/Support/Error.h"
 #include <optional>
diff --git a/clang-tools-extra/clang-doc/BitcodeWriter.h b/clang-tools-extra/clang-doc/BitcodeWriter.h
index 688f886b45308..9c1b6abe983bb 100644
--- a/clang-tools-extra/clang-doc/BitcodeWriter.h
+++ b/clang-tools-extra/clang-doc/BitcodeWriter.h
@@ -16,12 +16,8 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_BITCODEWRITER_H
 
 #include "Representation.h"
-#include "clang/AST/AST.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
 #include "llvm/Bitstream/BitstreamWriter.h"
-#include <initializer_list>
 #include <vector>
 
 namespace clang {
diff --git a/clang-tools-extra/clang-doc/ClangDoc.cpp b/clang-tools-extra/clang-doc/ClangDoc.cpp
index da4165a18d04c..ec802d64fb609 100644
--- a/clang-tools-extra/clang-doc/ClangDoc.cpp
+++ b/clang-tools-extra/clang-doc/ClangDoc.cpp
@@ -15,13 +15,9 @@
 #include "ClangDoc.h"
 #include "Mapper.h"
 #include "Representation.h"
-#include "clang/AST/AST.h"
 #include "clang/AST/ASTConsumer.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/AST/RecursiveASTVisitor.h"
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/Frontend/CompilerInstance.h"
-#include "clang/Frontend/FrontendActions.h"
 
 namespace clang {
 namespace doc {
diff --git a/clang-tools-extra/clang-doc/ClangDoc.h b/clang-tools-extra/clang-doc/ClangDoc.h
index 1f0c43d70db17..860b6709acb06 100644
--- a/clang-tools-extra/clang-doc/ClangDoc.h
+++ b/clang-tools-extra/clang-doc/ClangDoc.h
@@ -17,8 +17,6 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_CLANGDOC_H
 
 #include "Representation.h"
-#include "clang/Tooling/Execution.h"
-#include "clang/Tooling/StandaloneExecution.h"
 #include "clang/Tooling/Tooling.h"
 
 namespace clang {
diff --git a/clang-tools-extra/clang-doc/Mapper.h b/clang-tools-extra/clang-doc/Mapper.h
index 322df6d594b3d..91e9668e6412a 100644
--- a/clang-tools-extra/clang-doc/Mapper.h
+++ b/clang-tools-extra/clang-doc/Mapper.h
@@ -19,7 +19,6 @@
 
 #include "Representation.h"
 #include "clang/AST/RecursiveASTVisitor.h"
-#include "clang/Tooling/Execution.h"
 
 using namespace clang::comments;
 using namespace clang::tooling;
diff --git a/clang-tools-extra/clang-doc/Representation.h b/clang-tools-extra/clang-doc/Representation.h
index 79e9bfc291c3a..1ae067f736476 100644
--- a/clang-tools-extra/clang-doc/Representation.h
+++ b/clang-tools-extra/clang-doc/Representation.h
@@ -16,10 +16,8 @@
 
 #include "clang/AST/Type.h"
 #include "clang/Basic/Specifiers.h"
-#include "clang/Tooling/StandaloneExecution.h"
-#include "llvm/ADT/APSInt.h"
+#include "clang/Tooling/Execution.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
 #include <array>
 #include <optional>
 #include <string>
diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp
index 7f8691d63622f..e1d60570da4ca 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -11,7 +11,9 @@
 
 #include "clang/AST/Attr.h"
 #include "clang/AST/Comment.h"
+#include "clang/AST/CommentVisitor.h"
 #include "clang/AST/DeclFriend.h"
+#include "clang/AST/ExprConcepts.h"
 #include "clang/AST/Mangle.h"
 #include "clang/Index/USRGeneration.h"
 #include "clang/Lex/Lexer.h"
diff --git a/clang-tools-extra/clang-doc/Serialize.h b/clang-tools-extra/clang-doc/Serialize.h
index 06c4d64c51494..30ed836d57de3 100644
--- a/clang-tools-extra/clang-doc/Serialize.h
+++ b/clang-tools-extra/clang-doc/Serialize.h
@@ -16,10 +16,7 @@
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_SERIALIZE_H
 
 #include "Representation.h"
-#include "clang/AST/AST.h"
-#include "clang/AST/CommentVisitor.h"
 #include <string>
-#include <vector>
 
 using namespace clang::comments;
 
diff --git a/clang-tools-extra/clang-doc/support/File.h b/clang-tools-extra/clang-doc/support/File.h
index 7036d5e672b72..bab988f0e5c86 100644
--- a/clang-tools-extra/clang-doc/support/File.h
+++ b/clang-tools-extra/clang-doc/support/File.h
@@ -8,7 +8,7 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_FILE_H
 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_FILE_H
 
-#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Error.h"
 
 namespace clang {
diff --git a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
index c86fd720d996b..62fa6a17df2ee 100644
--- a/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
+++ b/clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
@@ -22,7 +22,6 @@
 #include "Generators.h"
 #include "Representation.h"
 #include "support/Utils.h"
-#include "clang/ASTMatchers/ASTMatchersInternal.h"
 #include "clang/Tooling/AllTUsExecution.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Execution.h"
@@ -41,7 +40,6 @@
 #include <mutex>
 #include <string>
 
-using namespace clang::ast_matchers;
 using namespace clang::tooling;
 using namespace clang;
 

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 3053 tests passed
  • 7 tests skipped

@evelez7 evelez7 changed the title [clang-doc] Remove unused headers [clang-doc][NFC] Remove unused headers Nov 20, 2025
@evelez7 evelez7 requested review from ilovepi and petrhosek November 20, 2025 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants