forked from OSchip/llvm-project
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.
This commit is contained in:
parent
4d23764ddd
commit
979da9a4c3
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <memory>
|
||||
|
||||
namespace clang {
|
||||
class ASTContext;
|
||||
namespace clangd {
|
||||
class ParsedAST;
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
namespace clang {
|
||||
class TargetInfo;
|
||||
class IdentifierTable;
|
||||
class ASTContext;
|
||||
class QualType;
|
||||
class LangOptions;
|
||||
|
||||
enum LanguageID {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/Analysis/AnalysisDeclContext.h"
|
||||
#include "clang/Analysis/CFG.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "clang/AST/ASTConsumer.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclGroup.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/LangStandard.h"
|
||||
#include "clang/Frontend/ASTUnit.h"
|
||||
#include "clang/Frontend/CompilerInstance.h"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Basic/Attributes.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
#include "clang/Basic/LLVM.h"
|
||||
|
@ -35,9 +36,9 @@
|
|||
#include "llvm/ADT/FoldingSet.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/FileManager.h"
|
||||
#include "clang/Basic/FileSystemStatCache.h"
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
|
@ -53,9 +54,9 @@
|
|||
#include "llvm/ADT/APInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/Support/Capacity.h"
|
||||
|
@ -202,7 +203,8 @@ void Preprocessor::Initialize(const TargetInfo &Target,
|
|||
this->AuxTarget = AuxTarget;
|
||||
|
||||
// Initialize information about built-ins.
|
||||
BuiltinInfo.InitializeTarget(Target, AuxTarget);
|
||||
BuiltinInfo = std::make_unique<Builtin::Context>();
|
||||
BuiltinInfo->InitializeTarget(Target, AuxTarget);
|
||||
HeaderInfo.setTarget(Target);
|
||||
|
||||
// Populate the identifier table with info about keywords for the current language.
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/ExprCXX.h"
|
||||
#include "clang/AST/StmtCXX.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
#include "clang/Sema/Initialization.h"
|
||||
#include "clang/Sema/Overload.h"
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "clang/AST/ExprOpenMP.h"
|
||||
#include "clang/AST/RecursiveASTVisitor.h"
|
||||
#include "clang/AST/TypeLoc.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/FixedPoint.h"
|
||||
#include "clang/Basic/PartialDiagnostic.h"
|
||||
#include "clang/Basic/SourceManager.h"
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "clang/Sema/SemaInternal.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/DeclObjC.h"
|
||||
#include "clang/AST/ExprObjC.h"
|
||||
#include "clang/AST/StmtVisitor.h"
|
||||
#include "clang/AST/TypeLoc.h"
|
||||
#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Edit/Commit.h"
|
||||
#include "clang/Edit/Rewriters.h"
|
||||
#include "clang/Lex/Preprocessor.h"
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include "clang/Sema/Lookup.h"
|
||||
#include "clang/Sema/Scope.h"
|
||||
#include "clang/Sema/ScopeInfo.h"
|
||||
#include "clang/Sema/SemaInternal.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/ConvertUTF.h"
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "clang/AST/ASTDiagnostic.h"
|
||||
#include "clang/AST/ExternalASTSource.h"
|
||||
#include "clang/AST/PrettyPrinter.h"
|
||||
#include "clang/Basic/Builtins.h"
|
||||
#include "clang/Basic/DiagnosticIDs.h"
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "clang/Basic/TargetInfo.h"
|
||||
|
|
Loading…
Reference in New Issue