Commit 60573ae6 authored by Reid Kleckner's avatar Reid Kleckner
Browse files

Remove Expr.h include from ASTContext.h, NFC

ASTContext.h is popular, prune its includes. Expr.h brings in Attr.h,
which is also expensive.

Move BlockVarCopyInit to Expr.h to accomplish this.
parent 6555995a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include "ClangTidyOptions.h"
#include "GlobList.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/Attr.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Frontend/DiagnosticRenderer.h"
+1 −17
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/PrettyPrinter.h"
@@ -124,6 +123,7 @@ class UnresolvedSetIterator;
class UsingShadowDecl;
class VarTemplateDecl;
class VTableContextBase;
struct BlockVarCopyInit;

namespace Builtin {

@@ -158,22 +158,6 @@ struct TypeInfo {
/// Holds long-lived AST nodes (such as types and decls) that can be
/// referred to throughout the semantic analysis of a file.
class ASTContext : public RefCountedBase<ASTContext> {
public:
  /// Copy initialization expr of a __block variable and a boolean flag that
  /// indicates whether the expression can throw.
  struct BlockVarCopyInit {
    BlockVarCopyInit() = default;
    BlockVarCopyInit(Expr *CopyExpr, bool CanThrow)
        : ExprAndFlag(CopyExpr, CanThrow) {}
    void setExprAndFlag(Expr *CopyExpr, bool CanThrow) {
      ExprAndFlag.setPointerAndInt(CopyExpr, CanThrow);
    }
    Expr *getCopyExpr() const { return ExprAndFlag.getPointer(); }
    bool canThrow() const { return ExprAndFlag.getInt(); }
    llvm::PointerIntPair<Expr *, 1, bool> ExprAndFlag;
  };

private:
  friend class NestedNameSpecifier;

  mutable SmallVector<Type *, 0> Types;
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ class Type;
#define TYPE(DERIVED, BASE) class DERIVED##Type;
#include "clang/AST/TypeNodes.inc"
class CXXCtorInitializer;
class OMPClause;
#define OPENMP_CLAUSE(KIND, CLASSNAME) class CLASSNAME;
#include "clang/Basic/OpenMPKinds.def"


} // end namespace clang

+0 −3
Original line number Diff line number Diff line
@@ -16,10 +16,7 @@
#define LLVM_CLANG_AST_ASTTYPETRAITS_H

#include "clang/AST/ASTFwd.h"
#include "clang/AST/Decl.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/LLVM.h"
+14 −0
Original line number Diff line number Diff line
@@ -5610,6 +5610,20 @@ public:
  }
};

/// Copy initialization expr of a __block variable and a boolean flag that
/// indicates whether the expression can throw.
struct BlockVarCopyInit {
  BlockVarCopyInit() = default;
  BlockVarCopyInit(Expr *CopyExpr, bool CanThrow)
      : ExprAndFlag(CopyExpr, CanThrow) {}
  void setExprAndFlag(Expr *CopyExpr, bool CanThrow) {
    ExprAndFlag.setPointerAndInt(CopyExpr, CanThrow);
  }
  Expr *getCopyExpr() const { return ExprAndFlag.getPointer(); }
  bool canThrow() const { return ExprAndFlag.getInt(); }
  llvm::PointerIntPair<Expr *, 1, bool> ExprAndFlag;
};

/// AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2]
/// This AST node provides support for reinterpreting a type to another
/// type of the same size.
Loading