[PATCH] D13610: [CodeGen] Fix CodeGenModule::CreateGlobalInitOrDestructFunction
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 21 14:17:51 PDT 2015
ahatanak added a comment.
The patch isn't fixing any serious bugs, but is fixing what seems to me inconsistencies in the code. It makes the following changes:
1. Currently, SetLLVMFunctionAttributes is called to add function attributes to the internal function definitions, but SetLLVMFunctionAttributes doesn't call SetLLVMFunctionAttributesForDefinition which should be called to add function attributes to function definitions (but not to declarations). This patch replaces calls to SetLLVMFunctionAttributes with calls to SetInternalFunctionAttributes, which I think is the right thing to do since the functions created are all internal functions.
2. Currently, CodeGenModule::CreateGlobalInitOrDestructFunction always passes a CGFunctionInfo instance for void() functions (created by arrangeNullaryFunction) to SetLLVMFunctionAttributes. Strictly speaking, this is not correct for CodeGenFunction::generateDestroyHelper (near line 582) because the function type is void(*void.). That's why I made changes to have the callers of CreateGlobalInitOrDestructFunction pass a reference to CGFunctionInfo.
More information about the cfe-commits