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 | 538c3d845986a43014574d6a21a030281c266fdb (patch) | |
| tree | e304449e0a82e5dedd173f7d0bec8e9c618a6625 /clang/lib/Sema/SemaDecl.cpp | |
| parent | e68c0fcfb239eef2c8468bb8c32e97fe9f58e7be (diff) | |
| download | bcm5719-llvm-538c3d845986a43014574d6a21a030281c266fdb.tar.gz bcm5719-llvm-538c3d845986a43014574d6a21a030281c266fdb.zip | |
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.
llvm-svn: 64526
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 3c02d4b2946..16e8691f10b 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/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) |

