Skip to content

Commit

Permalink
[NFC] Minimize header includes (llvm#66339)
Browse files Browse the repository at this point in the history
Minimize the headers included in header files to reduce the number of
files that need recompiled after a change.
  • Loading branch information
bwendling authored and ZijunZhaoCCK committed Sep 19, 2023
1 parent 419b4cc commit 1db89d2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 8 deletions.
4 changes: 3 additions & 1 deletion clang/include/clang/Basic/AttrSubjectMatchRules.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion clang/include/clang/Basic/AttributeCommonInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 15 additions & 1 deletion clang/lib/Basic/Attributes.cpp
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 1 addition & 3 deletions clang/lib/Basic/IdentifierTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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(); }
};
Expand Down
1 change: 1 addition & 0 deletions clang/lib/Parse/ParseStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 1db89d2

Please sign in to comment.