From fafc158270aa454253d885111c297ab0aaaca7dc Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 14 Sep 2023 01:21:51 -0700 Subject: [PATCH] [NFC] Minimize header includes Minimize the headers included in header files to reduce the number of files that need recompiled after a change. --- .../include/clang/Basic/AttrSubjectMatchRules.h | 4 +++- clang/include/clang/Basic/AttributeCommonInfo.h | 4 +++- clang/include/clang/Basic/Attributes.h | 4 ++-- clang/lib/Basic/Attributes.cpp | 16 +++++++++++++++- clang/lib/Basic/IdentifierTable.cpp | 4 +--- clang/lib/Parse/ParseStmt.cpp | 1 + 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/clang/include/clang/Basic/AttrSubjectMatchRules.h b/clang/include/clang/Basic/AttrSubjectMatchRules.h index e3dcb943e59d4..bec8122ea930a 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 e57adc4bf5b99..7dc05418498d0 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 3fc5fbacdb2cb..61666a6f4d9ac 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 1308e2d72f25f..bb495216ca93c 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 afb30268f2973..e5599d5455410 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 #include @@ -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 fb883c08a745c..2531147c23196 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"