llvm-project/flang/lib/Semantics
Peter Klausler 93b0638eff [flang] Handle "type(foo) function f" when foo is defined in f
Fortran allows forward references to derived types, including
function results that are typed in a prefix of a FUNCTION statement.
If a type is defined in the body of the function, a reference to
that type from a prefix on the FUNCTION statement must resolve to
the local symbol, even and especially when that type shadows one
from the host scope.

The solution is to defer the processing of that type until the
end of the function's specification part.  But the language doesn't
allow for forward references to other names in the prefix, so defer
the processing of the type only when it is not an intrinsic type.
The data structures in name resolution that track this information
for functions needed to become a stack in order to make this work,
since functions can contain interfaces that are functions.

Differential Revision: https://reviews.llvm.org/D119448
2022-02-10 10:29:36 -08:00
..
CMakeLists.txt [flang] Save binding labels as strings 2021-03-24 11:25:23 -07:00
assignment.cpp [flang][nfc] Fix comments, remove needless API, tweak script 2021-01-22 10:55:53 -08:00
assignment.h
attr.cpp
canonicalize-acc.cpp [flang] Add clang-tidy check for braces around if 2021-06-16 09:13:53 +00:00
canonicalize-acc.h [flang][openacc] Semantic checks for OpenACC 3.0 clauses validity 2020-07-14 20:44:35 -04:00
canonicalize-do.cpp [flang][NFC] Get formatting in sync with latest clang-format 2020-07-01 16:51:46 -07:00
canonicalize-do.h
canonicalize-omp.cpp
canonicalize-omp.h
check-acc-structure.cpp [flang] Add clang-tidy check for braces around if 2021-06-16 09:13:53 +00:00
check-acc-structure.h [flang][directive] Enforce basic semantic check for all clauses 2021-02-01 13:33:30 -05:00
check-allocate.cpp [flang] Rearrange prototype & code placement of IsCoarray() 2021-11-30 15:26:34 -08:00
check-allocate.h
check-arithmeticif.cpp
check-arithmeticif.h
check-call.cpp [flang] Accept BOZ literals for some actual arguments 2022-01-19 17:28:21 -08:00
check-call.h [flang] Fix generic resolution case 2021-10-22 13:38:47 -07:00
check-case.cpp [flang] Fix integer CASE constant typing 2020-09-01 10:59:35 -07:00
check-case.h
check-coarray.cpp [flang] Support for image selectors 2020-07-08 07:31:54 -07:00
check-coarray.h [flang] Support for image selectors 2020-07-08 07:31:54 -07:00
check-data.cpp [flang] Allow initialization in blank COMMON 2022-01-13 15:07:37 -08:00
check-data.h [flang] Implement semantics for DEC STRUCTURE/RECORD 2022-01-13 13:17:13 -08:00
check-deallocate.cpp [flang] Save AllocateObject and PointerObject analyzed expression 2021-03-16 10:27:45 +01:00
check-deallocate.h
check-declarations.cpp [flang] Improve error message (initialized variable in pure subprogram) 2022-01-19 17:27:31 -08:00
check-declarations.h [flang] Improve initializer semantics, esp. for component default values 2020-12-07 14:40:41 -08:00
check-directive-structure.h Fixed erring semantic errors arising from D108904 2021-10-30 03:44:59 +05:30
check-do-forall.cpp [flang] Rearrange prototype & code placement of IsCoarray() 2021-11-30 15:26:34 -08:00
check-do-forall.h [flang] Fix crash on erroneous expressions 2020-06-05 08:46:43 -07:00
check-if-stmt.cpp
check-if-stmt.h
check-io.cpp [flang] Legacy extension: non-character formats 2022-01-14 14:17:05 -08:00
check-io.h [flang] Fold LGE/LGT/LLE/LLT intrinsic functions 2021-10-14 15:24:03 -07:00
check-namelist.cpp
check-namelist.h
check-nullify.cpp [flang] Save AllocateObject and PointerObject analyzed expression 2021-03-16 10:27:45 +01:00
check-nullify.h
check-omp-structure.cpp Added OpenMP 5.0 specification based semantic checks for atomic update construct 2022-01-24 13:24:00 +05:30
check-omp-structure.h Added OpenMP 5.0 specification based semantic checks for atomic update construct 2022-01-24 13:24:00 +05:30
check-purity.cpp
check-purity.h
check-return.cpp [flang][NFC] Add GetTopLevelUnitContaining functions 2020-12-02 10:28:49 -08:00
check-return.h
check-select-rank.cpp [flang] Validate SIZE(x,DIM=n) dimension for assumed-size array x 2021-09-17 10:14:18 -07:00
check-select-rank.h [flang]Semantics for SELECT RANK. 2020-05-08 08:52:31 +05:30
check-select-type.cpp [FLANG] Fix issues in SELECT TYPE construct when intrinsic type specification is specified in TYPE GUARD statement. 2020-08-03 09:24:42 +05:30
check-select-type.h [flang] Semantics for SELECT TYPE 2020-06-12 00:12:24 +05:30
check-stop.cpp
check-stop.h
compute-offsets.cpp [flang] Fix common block size extension mistake in D109156 2021-09-09 09:12:12 +02:00
compute-offsets.h [flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF() 2020-12-15 17:26:20 -08:00
data-to-inits.cpp [flang] Extension: initialization of LOGICAL with INTEGER & vice versa 2022-01-13 14:22:45 -08:00
data-to-inits.h [flang] Implement semantics for DEC STRUCTURE/RECORD 2022-01-13 13:17:13 -08:00
expression.cpp [flang] catch implicit interface incompatibility with global scope symbol 2022-02-09 09:30:32 +01:00
mod-file.cpp [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
mod-file.h [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
pointer-assignment.cpp [Flang][OpenMP] Use the ultimate symbol in a call to the IsPointer function 2021-11-04 19:53:58 +00:00
pointer-assignment.h [flang] DATA stmt processing (part 3/4): Remaining prep work 2020-06-19 09:09:05 -07:00
program-tree.cpp [flang] Accept ENTRY names in generic interfaces 2022-01-14 15:43:21 -08:00
program-tree.h [flang] Accept ENTRY names in generic interfaces 2022-01-14 15:43:21 -08:00
resolve-directives.cpp Added OpenMP 5.0 specification based semantic checks for CRITICAL construct name resolution 2021-10-12 22:18:24 +05:30
resolve-directives.h [flang][NFC] Extract name resolution for OpenACC & OpenMP into new file 2020-07-28 16:38:36 -07:00
resolve-labels.cpp [flang] Allow exterior branch to outermost WHERE construct statement 2021-11-11 13:14:42 -08:00
resolve-labels.h
resolve-names-utils.cpp [flang] Adjust names in Semantics that imply too much (NFC) 2021-12-01 11:19:19 -08:00
resolve-names-utils.h [flang] Revamp C1502 checking of END INTERFACE [generic-spec] 2021-09-17 08:13:10 -07:00
resolve-names.cpp [flang] Handle "type(foo) function f" when foo is defined in f 2022-02-10 10:29:36 -08:00
resolve-names.h [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
rewrite-parse-tree.cpp [flang] Clean up TODO comments and fix one (DATA constant ambiguity) 2020-12-15 13:36:07 -08:00
rewrite-parse-tree.h
runtime-type-info.cpp [flang] Fix crash from USE-associated defined I/O subprograms 2022-01-21 17:49:09 -08:00
scope.cpp [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
semantics.cpp [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
symbol.cpp [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
tools.cpp [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
type.cpp [flang] Intrinsic assignment of distinct but "same" derived types 2022-01-19 10:08:17 -08:00
unparse-with-symbols.cpp [flang][openacc] Basic name resolution infrastructure for OpenACC construct 2020-07-26 20:01:35 -04:00