Add a new attribute, fortify_stdlib

Authored by erik.pilkington on Feb 11 2019, 3:21 PM.


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

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.


Differential revision: https://reviews.llvm.org/D57918

llvm-svn: 353765