This is an archive of the discontinued LLVM Phabricator instance.

[flang] Fixes for problems with declaring procedure entities
ClosedPublic

Authored by PeteSteinfeld on May 22 2020, 12:38 PM.

Details

Summary

We were not detecting declaring multiple interfaces to the same procedure.
Also, we were not handling the initialization of entitiies where the associated
Symbol had previously had errors.

I added a boolean to ProcEntityDetails to indicate if set_interface() had been
called. I then checked that boolean when calling set_interface() and emitting
an error message if the interface was already set.

Also, in situations where we were emitting error messages for symbols, I set
the Error flag on the Symbol. Then when performing initialization on the
Symbol, I first check to see if the Symbol had an error.

Diff Detail

Event Timeline

PeteSteinfeld created this revision.May 22 2020, 12:38 PM
Herald added a project: Restricted Project. · View Herald Transcript
PeteSteinfeld added a project: Restricted Project.May 22 2020, 1:16 PM
tskeith added inline comments.May 25 2020, 10:02 AM
flang/include/flang/Semantics/symbol.h
238

ProcInterface already has an "unset" state. When it is default-initialized it has neither a symbol nor type. So isInterfaceSet could be determined by checking that rather than maintaining a separate boolean.

PeteSteinfeld planned changes to this revision.May 26 2020, 6:55 AM
PeteSteinfeld marked an inline comment as done.

I plan to change the implementation of isInterfaceSet() to IsInterfaceSet() and make it be based on the contents of the ProcInterface.

flang/include/flang/Semantics/symbol.h
238

Thanks, Tim. I'll change the implementation of isInterfaceSet(). Since it's no longer an accessor, I'll capitalize it.

Changed the implementation of the test to see if the ProcInterface of the
ProcEntityDetails had already been set.

tskeith accepted this revision.May 26 2020, 9:58 AM
tskeith added inline comments.
flang/include/flang/Semantics/symbol.h
222

This could be CHECK(!interface_.IsInterfaceSet()).

This revision is now accepted and ready to land.May 26 2020, 9:58 AM
PeteSteinfeld marked an inline comment as done.May 26 2020, 10:47 AM
PeteSteinfeld added inline comments.
flang/include/flang/Semantics/symbol.h
222

Good suggestion. Actually, though, I think it's `CHECK(!IsInterfaceSet()). Stay tuned for another updates.

This revision was automatically updated to reflect the committed changes.