[all-commits] [llvm/llvm-project] 9e7eef: [flang] Handle parameter-dependent types in PDT in...

Peter Klausler via All-commits all-commits at lists.llvm.org
Fri Apr 15 16:20:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e7eef9989d365214b2b62be630d0bc9d9e94968
      https://github.com/llvm/llvm-project/commit/9e7eef9989d365214b2b62be630d0bc9d9e94968
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2022-04-15 (Fri, 15 Apr 2022)

  Changed paths:
    M flang/include/flang/Common/indirection.h
    M flang/include/flang/Parser/unparse.h
    M flang/include/flang/Semantics/expression.h
    M flang/include/flang/Semantics/symbol.h
    M flang/lib/Parser/unparse.cpp
    M flang/lib/Semantics/expression.cpp
    M flang/lib/Semantics/mod-file.cpp
    M flang/lib/Semantics/resolve-names.cpp
    M flang/lib/Semantics/symbol.cpp
    M flang/lib/Semantics/type.cpp
    M flang/test/Semantics/init01.f90
    A flang/test/Semantics/modfile48.f90
    M flang/test/Semantics/structconst02.f90

  Log Message:
  -----------
  [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




More information about the All-commits mailing list