Don't add optnone or noinline if the function is already marked as
authorAkira Hatanaka <ahatanaka@apple.com>
Fri, 15 Nov 2019 23:27:56 +0000 (15:27 -0800)
committerAkira Hatanaka <ahatanaka@apple.com>
Fri, 15 Nov 2019 23:44:04 +0000 (15:44 -0800)
commit4516dc1c20d1e77f20a72e90be876506805b3978
tree85f5cce6ea11bb42499c6ac0ef782e165199583e
parenta578adc1bc8e17b147ed5ef4794cd6f3f82b584b
Don't add optnone or noinline if the function is already marked as
always_inline.

The assertion in SetLLVMFunctionAttributesForDefinition used to fail
when there was attribute OptimizeNone on the AST function and attribute
always_inline on the IR function. This happens because base destructors
are annotated with always_inline when the code is compiled with
-fapple-kext (see r124757).

rdar://problem/57169694
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGenCXX/apple-kext.cpp