When generating the fir.dispatch_table operation, the name of the parent
derived-type needs to be mangled. For this the type instantiation
DerivedTypeSpec needs to be retrieved to have the correct kind type parameters.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@klausler Is it ok to modify FindParentComponent like this or is there a better way to retrieve the parent type instantiation DerivedTypeSpec from a DerivedTypeSpec?
flang/lib/Evaluate/type.cpp | ||
---|---|---|
213–214 | Looking at the comment same as typeSymbol_.scope() unless PDT here: https://github.com/llvm/llvm-project/blob/main/flang/include/flang/Semantics/type.h#L310, I think using derived.scope() should be enough, but I did not check that this comment was honored. |
flang/lib/Evaluate/type.cpp | ||
---|---|---|
213–214 | If "derived" is not a PDT instantiation the two scopes should be the same. If it is a PDT instantiation, "derived" will have its own scope for all of the object and pointer components, including the parent; generics and bindings are still found in the original scope. In any case, yes, "derived.scope()" should not be null outside error recovery situations. Please always use braces around "if" statement bodies here, thanks. |
Aside from Peter's comment on adding braces, all builds and tests correctly and looks good.
Looking at the comment same as typeSymbol_.scope() unless PDT here: https://github.com/llvm/llvm-project/blob/main/flang/include/flang/Semantics/type.h#L310, I think using derived.scope() should be enough, but I did not check that this comment was honored.