This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add ClassIs runtime function
ClosedPublic

Authored by clementval on Nov 18 2022, 2:42 AM.

Details

Summary

Add a ClassIs function that takes a descriptor and a
type desc to implement the check needed by the CLASS IS type guard
in SELECT TYPE construct.
Since the kind type parameter are directly folded in the type itself
in Flang and the type descriptor is a global, the function just check
if the type descriptor address of the descriptor is equivalent to
the type descriptor address of the global. If not, it check in the
parents of the descriptor's type descriptor.

Diff Detail

Event Timeline

clementval created this revision.Nov 18 2022, 2:42 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 18 2022, 2:42 AM
clementval requested review of this revision.Nov 18 2022, 2:42 AM

Add missing class

jeanPerier accepted this revision.Nov 18 2022, 7:50 AM

Other than the two runtime code style nits, LGTM

flang/runtime/derived-api.cpp
46

braces around all if/else in the runtime code (also below).

48

{} init in the runtime code.

This revision is now accepted and ready to land.Nov 18 2022, 7:50 AM

Fix runtime format issue

clementval marked 2 inline comments as done.Nov 18 2022, 11:41 AM
clementval added inline comments.
flang/runtime/derived-api.cpp
46

Thanks! I forgot about these style differences.

This revision was automatically updated to reflect the committed changes.
clementval marked an inline comment as done.