Make nomerge attribute a function attribute as well as a statement attribute to extend the functionality of nomerge attribute.
For functions already have nomerge attribute, don't add nomerge attribute at the call-site of this function.
Differential D92800
[Clang] Make nomerge attribute a function attribute as well as a statement attribute. zequanwu on Dec 7 2020, 4:53 PM. Authored by
Details Make nomerge attribute a function attribute as well as a statement attribute to extend the functionality of nomerge attribute. For functions already have nomerge attribute, don't add nomerge attribute at the call-site of this function.
Diff Detail
Event TimelineComment Actions start a new diff to make nomerge attribute a function attribute as well as a statement attribute. Comment Actions Nice, that wasn't too difficult. I had some suggestions for improving the test case, and I'd like to hear from Aaron.
Comment Actions Add test for virutal function.
Comment Actions Add docs.
Comment Actions In general, I think this is reasonable -- there's a bit more work to be done before it's ready to land, but this is heading in the right direction.
Comment Actions address comments.
Comment Actions address comments.
|
I think this should be an InheritableAttr, like DeclOrTypeAttr. With type/decl attributes, those are almost always for things like calling conventions or other cases where inheritance of the attribute is really likely to be the correct default. It's less clear to me that the same is true for stmt/decl attributes aside from the observation that most decl attributes are inheritable. We may need to come up with a better approach for inheritance here at some point when we find a stmt/decl attribute that should not be inheritable.