AddGlobalAnnotations for function with or without function body.
When AnnotateAttr is on a function, AddGlobalAnnotations is only called in CodeGenModule::EmitGlobalFunctionDefinition which means AnnotateAttr on function declaration without function body will be ignored. The patch will move AddGlobalAnnotations to CodeGenModule::SetFunctionAttributes, so with or without function body, the AnnotateAttr will get code gen for a function. It'll help case when AnnotateAttr is on external function, and the AnnotateAttr will be consumed in IR level. For example, a pass to collect num of uses for functions with __attribute((annotate("count_use"))) after optimizations, As long as there's __attribute((annotate("count_use"))), function with or without function body should be counted. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D111109 Patch by: python3kgae (Xiang Li)
Loading
Please register or sign in to comment