Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Handle parameter-dependent types in PDT initializers
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. Differential Revision: https://reviews.llvm.org/D123728
- Loading branch information
Showing
13 changed files
with
133 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
! RUN: %python %S/test_modfile.py %s %flang_fc1 | ||
! Ensure proper formatting of component initializers in PDTs; | ||
! they should be unparsed from their parse trees. | ||
module m | ||
type :: t(k) | ||
integer, kind :: k | ||
real(kind=k) :: x = real(0., kind=k) | ||
end type | ||
end module | ||
|
||
!Expect: m.mod | ||
!module m | ||
!type::t(k) | ||
!integer(4),kind::k | ||
!real(int(int(k,kind=4),kind=8))::x=real(0., kind=k) | ||
!end type | ||
!intrinsic::real | ||
!end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters