[PATCH] D57918: Add an attribute that causes clang to emit fortified calls to C stdlib functions

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 7 11:37:04 PST 2019


erik.pilkington created this revision.
erik.pilkington added reviewers: aaron.ballman, rjmccall, eli.friedman.
Herald added subscribers: dexonsmith, jkorous.
Herald added a project: clang.

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. Without this attribute, its impossible to write `gnu_inline`-style wrappers to the variadic functions because we don't support `__builtin_va_arg_pack`, and don't intend to (see https://reviews.llvm.org/D57635).

Thanks for taking a look!
Erik


Repository:
  rC Clang

https://reviews.llvm.org/D57918

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/Builtins.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Builtins.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/test/CodeGen/fortify-std-lib.c
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/Sema/fortify-std-lib.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57918.185836.patch
Type: text/x-patch
Size: 22377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190207/006c7532/attachment-0001.bin>


More information about the cfe-commits mailing list