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.