This is an archive of the discontinued LLVM Phabricator instance.

[flang] Save binding labels as strings
ClosedPublic

Authored by tskeith on Mar 23 2021, 12:49 PM.

Details

Summary

Binding labels start as expressions but they have to evaluate to
constant character of default kind, so they can be represented as an
std::string. Leading and trailing blanks have to be removed, so the
folded expression isn't exactly right anyway.

So all BIND(C) symbols now have a string binding label, either the
default or user-supplied one. This is recorded in the .mod file.

Add WithBindName mix-in for details classes that can have a binding
label so that they are all consistent. Add GetBindName() and
SetBindName() member functions to Symbol.

Add tests that verifies that leading and trailing blanks are ignored
in binding labels and that the default label is folded to lower case.

Diff Detail

Event Timeline

tskeith created this revision.Mar 23 2021, 12:49 PM
tskeith requested review of this revision.Mar 23 2021, 12:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2021, 12:49 PM
tskeith updated this revision to Diff 332773.Mar 23 2021, 1:22 PM

Remove debugging code

klausler accepted this revision.Mar 23 2021, 1:48 PM
klausler added inline comments.
flang/include/flang/Evaluate/type.h
55 ↗(On Diff #332773)

CHARACTER(1) may not be the default CHARACTER kind in all compilations; I'm specifically thinking about legacy Kanji modes. You might want a different name.

This revision is now accepted and ready to land.Mar 23 2021, 1:48 PM
tskeith updated this revision to Diff 332814.Mar 23 2021, 3:59 PM

Remove misleading DefaultCharacter typedef.

tskeith marked an inline comment as done.Mar 23 2021, 4:00 PM
tskeith added inline comments.
flang/include/flang/Evaluate/type.h
55 ↗(On Diff #332773)

I've removed DefaultCharacter.

jeanPerier accepted this revision.Mar 24 2021, 1:32 AM

LGTM, thanks that will make the lowering part cleaner.

This revision was landed with ongoing or failed builds.Mar 24 2021, 8:52 AM
This revision was automatically updated to reflect the committed changes.
tskeith marked an inline comment as done.
tskeith reopened this revision.Mar 24 2021, 10:55 AM
This revision is now accepted and ready to land.Mar 24 2021, 10:55 AM
tskeith updated this revision to Diff 333049.Mar 24 2021, 10:55 AM

Fix assignment to label.

klausler accepted this revision.Mar 24 2021, 10:59 AM
This revision was landed with ongoing or failed builds.Mar 24 2021, 11:25 AM
This revision was automatically updated to reflect the committed changes.