This is an archive of the discontinued LLVM Phabricator instance.

[flang] Defer all function result type processing
ClosedPublic

Authored by klausler on Apr 13 2022, 12:20 PM.

Details

Summary

When a type specification appears in the prefix of a FUNCTION statement,
defer its processing as late as possible so that any symbols in the
tpe specification can be resolved in the function's scope to local
declarations, including use-associated symbols. f18 was already doing
this deferral in a limited form for derived types, and this patch
makes it work for intrinsic type parameter values as well.

In short, "real(kind(x)) function foo(x)" now works as it should.

"As late as possible" means the end of the specification part, or
the first appearance of the function result name in the specification
part.

Diff Detail

Event Timeline

klausler created this revision.Apr 13 2022, 12:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 12:20 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Apr 13 2022, 12:20 PM
jeanPerier accepted this revision.Apr 14 2022, 2:16 AM

Looks good

This revision is now accepted and ready to land.Apr 14 2022, 2:16 AM
This revision was automatically updated to reflect the committed changes.