From 3c385e5f8d9008fff18597ca302be19fa86e51f6 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 14 Feb 2009 18:57:46 +0000 Subject: Add hook to add attributes to function declarations that we know about, whether they are builtins or not. Use this to add the appropriate "format" attribute to NSLog, NSLogv, asprintf, and vasprintf, and to translate builtin attributes (from Builtins.def) into actual attributes on the function declaration. Use the "printf" format attribute on function declarations to determine whether we should do format string checking, rather than looking at an ad hoc list of builtins and "known" function names. Be a bit more careful about when we consider a function a "builtin" in C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64561 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CGExprConstant.cpp') diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 91153f796b..bfb523bb32 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -582,7 +582,8 @@ public: } case Expr::CallExprClass: { CallExpr* CE = cast(E); - if (CE->isBuiltinCall() != Builtin::BI__builtin___CFStringMakeConstantString) + if (CE->isBuiltinCall(CGM.getContext()) != + Builtin::BI__builtin___CFStringMakeConstantString) break; const Expr *Arg = CE->getArg(0)->IgnoreParenCasts(); const StringLiteral *Literal = cast(Arg); -- cgit v1.2.3