-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[NFC] Minimize header includes #66339
Merged
Merged
Conversation
This file contains 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
Minimize the headers included in header files to reduce the number of files that need recompiled after a change.
@llvm/pr-subscribers-clang ChangesMinimize the headers included in header files to reduce the number of files that need recompiled after a change. -- Full diff: https://github.com//pull/66339.diff6 Files Affected:
diff --git a/clang/include/clang/Basic/AttrSubjectMatchRules.h b/clang/include/clang/Basic/AttrSubjectMatchRules.h index e3dcb943e59d424..bec8122ea930a6a 100644 --- a/clang/include/clang/Basic/AttrSubjectMatchRules.h +++ b/clang/include/clang/Basic/AttrSubjectMatchRules.h @@ -9,10 +9,12 @@ #ifndef LLVM_CLANG_BASIC_ATTRSUBJECTMATCHRULES_H #define LLVM_CLANG_BASIC_ATTRSUBJECTMATCHRULES_H -#include "clang/Basic/SourceLocation.h" #include "llvm/ADT/DenseMap.h" namespace clang { + +class SourceRange; + namespace attr { /// A list of all the recognized kinds of attributes. diff --git a/clang/include/clang/Basic/AttributeCommonInfo.h b/clang/include/clang/Basic/AttributeCommonInfo.h index e57adc4bf5b99a2..7dc05418498d0ae 100644 --- a/clang/include/clang/Basic/AttributeCommonInfo.h +++ b/clang/include/clang/Basic/AttributeCommonInfo.h @@ -13,12 +13,14 @@ #ifndef LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H #define LLVM_CLANG_BASIC_ATTRIBUTECOMMONINFO_H + #include "clang/Basic/SourceLocation.h" #include "clang/Basic/TokenKinds.h" namespace clang { -class IdentifierInfo; + class ASTRecordWriter; +class IdentifierInfo; class AttributeCommonInfo { public: diff --git a/clang/include/clang/Basic/Attributes.h b/clang/include/clang/Basic/Attributes.h index 3fc5fbacdb2cbd6..61666a6f4d9ac4a 100644 --- a/clang/include/clang/Basic/Attributes.h +++ b/clang/include/clang/Basic/Attributes.h @@ -10,12 +10,12 @@ #define LLVM_CLANG_BASIC_ATTRIBUTES_H #include "clang/Basic/AttributeCommonInfo.h" -#include "clang/Basic/LangOptions.h" -#include "clang/Basic/TargetInfo.h" namespace clang { class IdentifierInfo; +class LangOptions; +class TargetInfo; /// Return the version number associated with the attribute if we /// recognize and implement the attribute specified by the given information. diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp index 1308e2d72f25f5b..bb495216ca93ca5 100644 --- a/clang/lib/Basic/Attributes.cpp +++ b/clang/lib/Basic/Attributes.cpp @@ -1,8 +1,22 @@ +//===--- Attributes.cpp ---------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file implements the AttributeCommonInfo interface. +// +//===----------------------------------------------------------------------===// + #include "clang/Basic/Attributes.h" #include "clang/Basic/AttrSubjectMatchRules.h" -#include "clang/Basic/AttributeCommonInfo.h" #include "clang/Basic/IdentifierTable.h" +#include "clang/Basic/LangOptions.h" #include "clang/Basic/ParsedAttrInfo.h" +#include "clang/Basic/TargetInfo.h" + using namespace clang; static int hasAttributeImpl(AttributeCommonInfo::Syntax Syntax, StringRef Name, diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index afb30268f2973ce..e5599d545541085 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -25,7 +25,6 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" -#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" #include <cassert> #include <cstdio> @@ -52,8 +51,7 @@ namespace { /// A simple identifier lookup iterator that represents an /// empty sequence of identifiers. -class EmptyLookupIterator : public IdentifierIterator -{ +class EmptyLookupIterator : public IdentifierIterator { public: StringRef Next() override { return StringRef(); } }; diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index fb883c08a745cfa..2531147c23196ae 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -14,6 +14,7 @@ #include "clang/AST/PrettyDeclStackTrace.h" #include "clang/Basic/Attributes.h" #include "clang/Basic/PrettyStackTrace.h" +#include "clang/Basic/TargetInfo.h" #include "clang/Basic/TokenKinds.h" #include "clang/Parse/LoopHint.h" #include "clang/Parse/Parser.h" |
wanders
approved these changes
Sep 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Assuming that clang/examples/Attribute/ still compiles fine (it should be part of clang/test/Frontend/ tests)
kstoimenov
pushed a commit
to kstoimenov/llvm-project
that referenced
this pull request
Sep 14, 2023
Minimize the headers included in header files to reduce the number of files that need recompiled after a change.
This was referenced Sep 14, 2023
ZijunZhaoCCK
pushed a commit
to ZijunZhaoCCK/llvm-project
that referenced
this pull request
Sep 19, 2023
Minimize the headers included in header files to reduce the number of files that need recompiled after a change.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang
Clang issues not falling into any other category
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.
Minimize the headers included in header files to reduce the number of files that need recompiled after a change.