diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-14 01:52:53 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-14 01:52:53 +0000 |
commit | 370ab3f1373841d70582feac9e35c3c6b3489f63 (patch) | |
tree | 1371980207aa58ccfea3e8ee70c2fbeab5d49b39 /lib/Sema/SemaDecl.cpp | |
parent | 41573ebf8fb971f40fa8a3e20648362c359b4916 (diff) |
Make it possible for builtins to expression FILE* arguments, so that
we can define builtins such as fprintf, vfprintf, and
__builtin___fprintf_chk. Give a nice error message when we need to
implicitly declare a function like fprintf.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 3c02d4b294..16e8691f10 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -298,7 +298,19 @@ NamedDecl *Sema::LazilyCreateBuiltin(IdentifierInfo *II, unsigned bid, if (Context.BuiltinInfo.hasVAListUse(BID)) InitBuiltinVaListType(); - QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context); + Builtin::Context::GetBuiltinTypeError Error; + QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context, Error); + switch (Error) { + case Builtin::Context::GE_None: + // Okay + break; + + case Builtin::Context::GE_Missing_FILE: + if (ForRedeclaration) + Diag(Loc, diag::err_implicit_decl_requires_stdio) + << Context.BuiltinInfo.GetName(BID); + return 0; + } if (!ForRedeclaration && Context.BuiltinInfo.isPredefinedLibFunction(BID)) { Diag(Loc, diag::ext_implicit_lib_function_decl) |