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
This commit is contained in:
Chris Lattner
2009-06-14 01:54:56 +00:00
parent 5abdec7978
commit 15ba94987a
14 changed files with 43 additions and 43 deletions

View File

@@ -30,22 +30,20 @@ const Builtin::Info &Builtin::Context::GetRecord(unsigned ID) const {
return TSRecords[ID - Builtin::FirstTSBuiltin];
}
/// \brief Load all of the target builtins. This must be called
/// prior to initializing the builtin identifiers.
void Builtin::Context::InitializeTargetBuiltins(const TargetInfo &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)
if (!BuiltinInfo[i].Suppressed &&
(!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)