summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-09 15:51:07 +0000
committerpatrick <patrick@openbsd.org>2020-08-09 15:51:07 +0000
commit389bb291c0c8961ca40ac7a2636e1ca69ca7653c (patch)
treee027d0b3ed5ed27fe08d1bcaa20e3c191232a53b /gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
parentImport LLVM 10.0.1 including clang, lld and lldb. (diff)
downloadwireguard-openbsd-389bb291c0c8961ca40ac7a2636e1ca69ca7653c.tar.xz
wireguard-openbsd-389bb291c0c8961ca40ac7a2636e1ca69ca7653c.zip
Import LLVM 10.0.1 including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp b/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
index f8866ac4f7f..a735bdd814e 100644
--- a/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/gnu/llvm/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1847,9 +1847,16 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
else if (const auto *SA = FD->getAttr<SectionAttr>())
F->setSection(SA->getName());
+ // If we plan on emitting this inline builtin, we can't treat it as a builtin.
if (FD->isInlineBuiltinDeclaration()) {
- F->addAttribute(llvm::AttributeList::FunctionIndex,
- llvm::Attribute::NoBuiltin);
+ const FunctionDecl *FDBody;
+ bool HasBody = FD->hasBody(FDBody);
+ (void)HasBody;
+ assert(HasBody && "Inline builtin declarations should always have an "
+ "available body!");
+ if (shouldEmitFunction(FDBody))
+ F->addAttribute(llvm::AttributeList::FunctionIndex,
+ llvm::Attribute::NoBuiltin);
}
if (FD->isReplaceableGlobalAllocationFunction()) {