Commit 979da9a4 authored by Reid Kleckner's avatar Reid Kleckner
Browse files

Avoid including Builtins.h in Preprocessor.h

Builtins are rarely if ever accessed via the Preprocessor. They are
typically found on the ASTContext, so there should be no performance
penalty to using a pointer indirection to store the builtin context.
parent 4d23764d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//

#include "MacroRepeatedSideEffectsCheck.h"
#include "clang/Basic/Builtins.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/MacroArgs.h"
#include "clang/Lex/PPCallbacks.h"
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include "index/Merge.h"
#include "index/SymbolOrigin.h"
#include "index/dex/Dex.h"
#include "clang/AST/ASTContext.h"
#include "clang/Index/IndexingAction.h"
#include "clang/Index/IndexingOptions.h"
#include "clang/Lex/MacroInfo.h"
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <memory>

namespace clang {
class ASTContext;
namespace clangd {
class ParsedAST;

+0 −2
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@
namespace clang {
class TargetInfo;
class IdentifierTable;
class ASTContext;
class QualType;
class LangOptions;

enum LanguageID {
+6 −3
Original line number Diff line number Diff line
@@ -14,7 +14,6 @@
#ifndef LLVM_CLANG_LEX_PREPROCESSOR_H
#define LLVM_CLANG_LEX_PREPROCESSOR_H

#include "clang/Basic/Builtins.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
@@ -81,6 +80,10 @@ class PreprocessorOptions;
class ScratchBuffer;
class TargetInfo;

namespace Builtin {
class Context;
}

/// Stores token information for comparing actual tokens with
/// predefined values.  Only handles simple tokens and identifiers.
class TokenValue {
@@ -239,7 +242,7 @@ class Preprocessor {
  SelectorTable Selectors;

  /// Information about builtins.
  Builtin::Context BuiltinInfo;
  std::unique_ptr<Builtin::Context> BuiltinInfo;

  /// Tracks all of the pragmas that the client registered
  /// with this preprocessor.
@@ -911,7 +914,7 @@ public:
  IdentifierTable &getIdentifierTable() { return Identifiers; }
  const IdentifierTable &getIdentifierTable() const { return Identifiers; }
  SelectorTable &getSelectorTable() { return Selectors; }
  Builtin::Context &getBuiltinInfo() { return BuiltinInfo; }
  Builtin::Context &getBuiltinInfo() { return *BuiltinInfo; }
  llvm::BumpPtrAllocator &getPreprocessorAllocator() { return BP; }

  void setExternalSource(ExternalPreprocessorSource *Source) {
Loading