diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-14 01:54:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-14 01:54:56 +0000 |
commit | 1b63e4f732dbc73d90abf886b4d21f8e3a165f6d (patch) | |
tree | ceacec3ea792cf65e407e1c2988ef31a9d1bc359 /lib/AST/ASTContext.cpp | |
parent | 6b15cdc1312f8fc45c86ee75e2a85106700e97f6 (diff) |
Sink the BuiltinInfo object from ASTContext into the
preprocessor and initialize it early in clang-cc. This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73319 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 4891fd3f73..7ed9e45fce 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -18,6 +18,7 @@ #include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" #include "clang/AST/RecordLayout.h" +#include "clang/Basic/Builtins.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "llvm/ADT/StringExtras.h" @@ -32,18 +33,15 @@ enum FloatingRank { ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM, TargetInfo &t, IdentifierTable &idents, SelectorTable &sels, - bool FreeMem, unsigned size_reserve, - bool InitializeBuiltins) : + Builtin::Context &builtins, + bool FreeMem, unsigned size_reserve) : GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0), ObjCFastEnumerationStateTypeDecl(0), SourceMgr(SM), LangOpts(LOpts), FreeMemory(FreeMem), Target(t), Idents(idents), Selectors(sels), - ExternalSource(0) { + BuiltinInfo(builtins), ExternalSource(0) { if (size_reserve > 0) Types.reserve(size_reserve); InitBuiltinTypes(); TUDecl = TranslationUnitDecl::Create(*this); - BuiltinInfo.InitializeTargetBuiltins(Target); - if (InitializeBuiltins) - this->InitializeBuiltins(idents); PrintingPolicy.CPlusPlus = LangOpts.CPlusPlus; } @@ -86,10 +84,6 @@ ASTContext::~ASTContext() { TUDecl->Destroy(*this); } -void ASTContext::InitializeBuiltins(IdentifierTable &idents) { - BuiltinInfo.InitializeBuiltins(idents, LangOpts.NoBuiltin); -} - void ASTContext::setExternalSource(llvm::OwningPtr<ExternalASTSource> &Source) { ExternalSource.reset(Source.take()); @@ -1979,9 +1973,8 @@ unsigned ASTContext::getIntegerRank(Type *T) { // There are two things which impact the integer rank: the width, and // the ordering of builtins. The builtin ordering is encoded in the // bottom three bits; the width is encoded in the bits above that. - if (FixedWidthIntType* FWIT = dyn_cast<FixedWidthIntType>(T)) { + if (FixedWidthIntType* FWIT = dyn_cast<FixedWidthIntType>(T)) return FWIT->getWidth() << 3; - } switch (cast<BuiltinType>(T)->getKind()) { default: assert(0 && "getIntegerRank(): not a built-in integer"); |