-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-doc][NFC] Remove unused headers #168806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
evelez7
wants to merge
1
commit into
main
Choose a base branch
from
users/evelez7/clang-doc-remove-unnecessary-headers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+4
−23
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`.
Member
|
@llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) ChangesRemoves unused headers or replaces them with headers that directly Full diff: https://github.com/llvm/llvm-project/pull/168806.diff 11 Files Affected:
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;
|
🐧 Linux x64 Test Results
|
petrhosek
approved these changes
Nov 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Removes unused headers or replaces them with headers that directly
provide the symbol instead. For example,
Serialize.hincludedAST.h,but it was actually
Serialize.cppthat needed concept expressions, sonow it includes just
ExprConcepts.h.