From e3cd735ea6378e5dd7765828f560ed49be845a95 Mon Sep 17 00:00:00 2001 From: Erik Pilkington Date: Mon, 11 Feb 2019 23:21:39 +0000 Subject: Add a new attribute, fortify_stdlib This attribute applies to declarations of C stdlib functions (sprintf, memcpy...) that have known fortified variants (__sprintf_chk, __memcpy_chk, ...). When applied, clang will emit calls to the fortified variant functions instead of calls to the defaults. In GCC, this is done by adding gnu_inline-style wrapper functions, but that doesn't work for us for variadic functions because we don't support __builtin_va_arg_pack (and have no intention to). This attribute takes two arguments, the first is 'type' argument passed through to __builtin_object_size, and the second is a flag argument that gets passed through to the variadic checking variants. rdar://47905754 Differential revision: https://reviews.llvm.org/D57918 llvm-svn: 353765 --- clang/lib/CodeGen/CodeGenFunction.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenFunction.h') diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 027ab0d6a20..9452de899fb 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -3697,6 +3697,10 @@ public: RValue EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue); + RValue emitFortifiedStdLibCall(CodeGenFunction &CGF, const CallExpr *CE, + unsigned BuiltinID, unsigned BOSType, + unsigned Flag); + RValue emitRotate(const CallExpr *E, bool IsRotateRight); /// Emit IR for __builtin_os_log_format. -- cgit v1.2.3