[flang] Save binding labels as strings
authorTim Keith <tkeith@nvidia.com>
Wed, 24 Mar 2021 15:52:26 +0000 (08:52 -0700)
committerTim Keith <tkeith@nvidia.com>
Wed, 24 Mar 2021 15:52:29 +0000 (08:52 -0700)
commiteb4ad0e3e3635194c21dccdd1c52027e632d2996
treed9885ec4cc7973f9363eca2cfdb7d4c66b9c7dc2
parent41454c30f6a38c3e107d857e63da0561610fd141
[flang] Save binding labels as strings

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.

Differential Revision: https://reviews.llvm.org/D99208
flang/include/flang/Semantics/symbol.h
flang/lib/Semantics/CMakeLists.txt
flang/lib/Semantics/check-declarations.cpp
flang/lib/Semantics/mod-file.cpp
flang/lib/Semantics/resolve-names.cpp
flang/lib/Semantics/symbol.cpp
flang/test/Semantics/modfile04.f90
flang/test/Semantics/modfile21.f90
flang/test/Semantics/separate-mp02.f90