[flang-commits] [PATCH] D123728: [flang] Handle parameter-dependent types in PDT initializers
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Apr 13 13:15:07 PDT 2022
klausler created this revision.
klausler added a reviewer: clementval.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a reviewer: sscalpone.
Herald added a project: All.
klausler requested review of this revision.
For parameterized derived type component initializers whose
expressions' types depend on parameter values, f18's current
scheme of analyzing the initialization expression once during
name resolution fails. For example,
type :: pdt(k)
integer, kind :: k
real :: component = real(0.0, kind=k)
end type
To handle such cases, it is necessary to re-analyze the parse
trees of these initialization expressions once for each distinct
initialization of the type.
This patch adds code to wipe an expression parse tree of its
typed expressions, and update those of its symbol table pointers
that reference type parameters, and then re-analyze that parse
tree to generate the properly typed component initializers.
https://reviews.llvm.org/D123728
Files:
flang/include/flang/Common/indirection.h
flang/include/flang/Parser/unparse.h
flang/include/flang/Semantics/expression.h
flang/include/flang/Semantics/symbol.h
flang/lib/Parser/unparse.cpp
flang/lib/Semantics/expression.cpp
flang/lib/Semantics/mod-file.cpp
flang/lib/Semantics/resolve-names.cpp
flang/lib/Semantics/symbol.cpp
flang/lib/Semantics/type.cpp
flang/test/Semantics/init01.f90
flang/test/Semantics/modfile48.f90
flang/test/Semantics/structconst02.f90
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123728.422629.patch
Type: text/x-patch
Size: 15115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220413/418d0809/attachment-0001.bin>
More information about the flang-commits
mailing list