[flang-commits] [flang] [flang] Lower PRIVATE component names safely (PR #66076)

via flang-commits flang-commits at lists.llvm.org
Tue Sep 12 16:56:57 PDT 2023


vdonaldson wrote:

This change will make IR harder to read. It's a somewhat heavy weight fix for a minor issue. I'm not sure I understand the details, such as why PRIVATE is relevant, but it would be nice if there were a lighter weight fix for this. Is it possible to have a 3-way or a 4-way component name conflict? (If this is limited to a 2-way conflict, then it might be better to mangle the (unique?) child name.)

But if I'm understanding this to some degree, you really can't put the mangling on the child component. Mangling must be proactively applied to the parent component, just in case there are one or more extensions that introduce conflicting names, possibly in a different file. (If not, it seems like it would be better to mangle child names.)

Would it be possible to solve the problem by always adding a prefix or suffix tag to private components? Something like `Pv`, `Priv`, or 'Private`, with a connecting dot and/or a capital letter to avoid user name conflicts. Or can both components (or 3 or 4 same-name components) all be private, in which case that would merely change the name that conflicts?

Or can some kind of numeric "extension depth" tag be used to a differentiate names and avoid conflicts?

Another possibility would be to put more effort into checking for a conflict, if separate compilation doesn't make that impossible or impractible. That's also kind of heavy weight, but the cost is compile time rather than changing the IR.

If nothing else helps to avoid adding type name tags, I think it would be better to swap the order and put the containing type name first.

https://github.com/llvm/llvm-project/pull/66076


More information about the flang-commits mailing list