summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-14 01:52:53 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-14 01:52:53 +0000
commit538c3d845986a43014574d6a21a030281c266fdb (patch)
treee304449e0a82e5dedd173f7d0bec8e9c618a6625 /clang/lib/Sema/SemaDecl.cpp
parente68c0fcfb239eef2c8468bb8c32e97fe9f58e7be (diff)
downloadbcm5719-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.cpp14
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)
OpenPOWER on IntegriCloud