From: Chris Lattner Date: Tue, 16 Jun 2009 16:18:48 +0000 (+0000) Subject: my refactoring of builtins changed target-specific builtins to only be X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=030e8fe5aabe6a50ed7da3182df8cbce446bfeab;p=clang my refactoring of builtins changed target-specific builtins to only be registered when PCH wasn't being used. We should always install (in BuiltinInfo) information about target-specific builtins, but we shouldn't register any builtin identifier infos. This fixes the build of apps that use PCH and target specific builtins together. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73492 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index 73ef1beeca..c5098b534b 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -1712,6 +1712,7 @@ GCC_ENABLE_CPP_RTTI = NO; GCC_ENABLE_PASCAL_STRINGS = NO; GCC_ENABLE_SYMBOL_SEPARATION = NO; + GCC_ENABLE_TRIGRAPHS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -1723,6 +1724,7 @@ GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_THREADSAFE_STATICS = NO; GCC_USE_GCC3_PFE_SUPPORT = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INSTALL_PATH = "$(HOME)/bin"; OTHER_LDFLAGS = ( "-lLLVMBitWriter", diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index 6463a4f6e5..f770c5089e 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -53,13 +53,12 @@ class Context { const Info *TSRecords; unsigned NumTSRecords; public: - Context() : TSRecords(0), NumTSRecords(0) {} + Context(const TargetInfo &Target); /// InitializeBuiltins - Mark the identifiers for all the builtins with their /// appropriate builtin ID # and mark any non-portable builtin identifiers as /// such. - void InitializeBuiltins(IdentifierTable &Table, const TargetInfo &Target, - bool NoBuiltins = false); + void InitializeBuiltins(IdentifierTable &Table, bool NoBuiltins = false); /// \brief Popular the vector with the names of all of the builtins. void GetBuiltinNames(llvm::SmallVectorImpl &Names, diff --git a/lib/Basic/Builtins.cpp b/lib/Basic/Builtins.cpp index ebe0514fa0..2662114b4c 100644 --- a/lib/Basic/Builtins.cpp +++ b/lib/Basic/Builtins.cpp @@ -30,11 +30,15 @@ const Builtin::Info &Builtin::Context::GetRecord(unsigned ID) const { return TSRecords[ID - Builtin::FirstTSBuiltin]; } +Builtin::Context::Context(const TargetInfo &Target) { + // Get the target specific builtins from the target. + Target.getTargetBuiltins(TSRecords, NumTSRecords); +} + /// InitializeBuiltins - Mark the identifiers for all the builtins with their /// appropriate builtin ID # and mark any non-portable builtin identifiers as /// such. void Builtin::Context::InitializeBuiltins(IdentifierTable &Table, - const TargetInfo &Target, bool NoBuiltins) { // Step #1: mark all target-independent builtins with their ID's. for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i) @@ -42,9 +46,6 @@ void Builtin::Context::InitializeBuiltins(IdentifierTable &Table, (!NoBuiltins || !strchr(BuiltinInfo[i].Attributes, 'f'))) Table.get(BuiltinInfo[i].Name).setBuiltinID(i); - // Get the target specific builtins from the target. - Target.getTargetBuiltins(TSRecords, NumTSRecords); - // Step #2: Register target-specific builtins. for (unsigned i = 0, e = NumTSRecords; i != e; ++i) if (!TSRecords[i].Suppressed && diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 0a7d92eb83..24ee5d8a8f 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -51,7 +51,7 @@ Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts, IdentifierInfoLookup* IILookup) : Diags(&diags), Features(opts), Target(target),FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers), Identifiers(opts, IILookup), - CurPPLexer(0), CurDirLookup(0), Callbacks(0) { + BuiltinInfo(Target), CurPPLexer(0), CurDirLookup(0), Callbacks(0) { ScratchBuf = new ScratchBuffer(SourceMgr); CounterValue = 0; // __COUNTER__ starts at 0. diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index 840f0157cf..04b871c4e1 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -2305,7 +2305,6 @@ int main(int argc, char **argv) { // Initialize builtin info. PP->getBuiltinInfo().InitializeBuiltins(PP->getIdentifierTable(), - PP->getTargetInfo(), PP->getLangOptions().NoBuiltin); }