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 | 15ba94987aa1620a75e6766f022228bd48cacfdf (patch) | |
tree | be5f07cfa86ef04eba08774981a9adcb87443ee7 /clang/lib/AST/ASTContext.cpp | |
parent | 5abdec7978e984a2b9f4fe0067b3af3337ba6d9c (diff) | |
download | bcm5719-llvm-15ba94987aa1620a75e6766f022228bd48cacfdf.tar.gz bcm5719-llvm-15ba94987aa1620a75e6766f022228bd48cacfdf.zip |
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.
llvm-svn: 73319
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 4891fd3f733..7ed9e45fcee 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/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"); |