When a Decl is imported over an already existing similar one,
the isUsed flag is updated if it is set in the imported Decl.
This can happen if the Decl is used somewhere in the imported code
but was not used in the existing code.
Originally this change was made after the patch in D47632 was done. It is here back-ported to the state before it. I like the idea of integrating this change into D47632. (This is a new functionality: Attributes are updated when something is found to be already imported, in contrast to copy of the attributes when a new object is created.)
I have a strong feeling of duplication with attribute and flags merging move in D47632. Maybe it is better to be resolved in that review by using the same code for attr/flag merging for both newly-created and mapped decls?
Ok, then I'll integrate this into https://reviews.llvm.org/D47632.
Thanks for the review!