[CodeGen] Attach no-builtin attributes to function definitions with no Decl
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 27 Jan 2020 18:40:14 +0000 (10:40 -0800)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 28 Jan 2020 21:59:08 +0000 (13:59 -0800)
commit4e799ada5860d1029ea89226b9b867302e792251
tree29962204554680eaef2136012bb21eb67968e6f1
parentc4f6fbe971351273b19a4a819bf6ceae2b70b37e
[CodeGen] Attach no-builtin attributes to function definitions with no Decl

When using -fno-builtin[-<name>], we don't attach the IR attributes to
function definitions with no Decl, like the ones created through
`CreateGlobalInitOrDestructFunction`.

This results in projects using -fno-builtin or -ffreestanding to start
seeing symbols like _memset_pattern16.

The fix changes the behavior to always add the attribute if LangOptions
requests it.

Differential Revision: https://reviews.llvm.org/D73495
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGenCXX/global-init.cpp