ΒΆvoid addDefaultFunctionDefinitionAttributes(
    clang::CodeGen::CodeGenModule& CGM,
    llvm::AttrBuilder& attrs)

Description

Given the language and code-generation options that Clang was configured with, set the default LLVM IR attributes for a function definition. The attributes set here are mostly global target-configuration and pipeline-configuration options like the target CPU, variant stack rules, whether to optimize for size, and so on. This is useful for frontends (such as Swift) that generally intend to interoperate with C code and rely on Clang's target configuration logic. As a general rule, this function assumes that meaningful attributes haven't already been added to the builder. It won't intentionally displace any existing attributes, but it also won't check to avoid overwriting them. Callers should generally apply customizations after making this call. This function assumes that the caller is not defining a function that requires special no-builtin treatment.

Declared at: clang/include/clang/CodeGen/CodeGenABITypes.h:123

Parameters

clang::CodeGen::CodeGenModule& CGM
llvm::AttrBuilder& attrs