Rearrange the contents of builtin_* module files a little and
make sure that semantics implicitly USEs the module Fortran_builtins
before processing each source file. This ensures that the special derived
types for TEAM_TYPE, EVENT_TYPE, LOCK_TYPE, &c. exist in the symbol table
where they will be available for use in coarray intrinsic function
processing.
Update IsTeamType() to exploit access to the __Fortran_builtins
module rather than applying ad hoc name tests. Move it and some
other utilities from Semantics/tools.* to Evaluate/tools.* to make
them available to intrinsics processing.
Add/correct the intrinsic table definitions for GET_TEAM, TEAM_NUMBER,
and THIS_IMAGE to exercise the built-in TEAM_TYPE as an argument and
as a result.
Add/correct/extend tests accordingly.
In LLVM Flang, -J is just an alias for -module-dir: https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Options.td#L4589-L4592.
So, -J ${FLANG_INTRINSIC_MODULES_DIR} is identical to -module-dir ${FLANG_INTRINSIC_MODULES_DIR} and hence this change is not needed.