As brought up by Richard Smith on https://reviews.llvm.org/D51650:
Sorry, I don't think it's acceptable from a design perspective to have mutable state in an Attr object, even if you can ensure that only one client of the Attr will be using the state at a time. CodeGen is going to need to track its own index into the attribute's list of clones.
The proposed fix was to put it into GlobalDecl, which this patch does.
However, doing this also requires making GlobalDecl be passed around
more often instead of FunctionDecl, so this does that as well.