awarzynski created this revision. awarzynski added reviewers: rovka, jeanPerier, peixin, kiranktp, Leporacanthicus, dpalermo, ekieri, schweitz, shraiysh, h-vetinari, rouson. Herald added a subscriber: mgorny. Herald added a reviewer: sscalpone. Herald added a reviewer: clementval. Herald added projects: Flang, All. awarzynski requested review of this revision. Herald added subscribers: cfe-commits, sstefan1, jdoerfert, MaskRay. Herald added a reviewer: jdoerfert. Herald added a project: clang.
Until now, `flang` has been reserved for the bash script that uses LLVM Flang for parsing/unparsing and an external compiler (`gfortran` by default) to generate machine code/assembly/executables. This patch renames: - `flang` as `flang-to-gfortran` - `flang-new` as `flang` These new names better reflect the functionality of both `flang` and `flang-to-gfortran`. Tests and documentation are updated accordingly. Similarly to Clang, Flang's driver executable will be called `flang-<MAJOR_VERSION>` and `flang` will be a symlink to `flang-<MAJOR_VERSION>`. flang-new` becomes a symlink pointing to the actual driver. We can delete it in the future once we get accustomed to the new name. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D125788 Files: clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/Flang.cpp clang/test/Driver/flang/flang.f90 clang/test/Driver/flang/flang_ucase.F90 clang/test/Driver/flang/multiple-inputs-mixed.f90 clang/test/Driver/flang/multiple-inputs.f90 flang/examples/FlangOmpReport/FlangOmpReport.cpp flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp flang/test/CMakeLists.txt flang/test/Driver/disable-ext-name-interop.f90 flang/test/Driver/driver-help-hidden.f90 flang/test/Driver/driver-version.f90 flang/test/Driver/escaped-backslash.f90 flang/test/Driver/fdefault.f90 flang/test/Driver/flarge-sizes.f90 flang/test/Driver/frontend-forwarding.f90 flang/test/Driver/intrinsic-module-path.f90 flang/test/Driver/macro-def-undef.F90 flang/test/Driver/missing-input.f90 flang/test/Driver/predefined-macros-compiler-version.F90 flang/test/Driver/std2018-wrong.f90 flang/test/Driver/std2018.f90 flang/test/Driver/use-module-error.f90 flang/test/Driver/use-module.f90 flang/test/Frontend/multiple-input-files.f90 flang/test/Lower/Intrinsics/command_argument_count.f90 flang/test/Lower/Intrinsics/exit.f90 flang/test/Lower/Intrinsics/get_command_argument.f90 flang/test/Lower/Intrinsics/get_environment_variable.f90 flang/test/Lower/OpenACC/Todo/acc-declare.f90 flang/test/Lower/OpenACC/Todo/acc-routine.f90 flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 flang/test/Lower/OpenMP/Todo/omp-threadprivate.f90 flang/test/lit.cfg.py flang/tools/f18/CMakeLists.txt flang/tools/f18/flang flang/tools/f18/flang-to-gfortran flang/tools/flang-driver/CMakeLists.txt flang/tools/flang-driver/driver.cpp
Index: flang/tools/flang-driver/driver.cpp =================================================================== --- flang/tools/flang-driver/driver.cpp +++ flang/tools/flang-driver/driver.cpp @@ -80,7 +80,7 @@ clang::driver::ParsedClangName targetandMode("flang", "--driver-mode=flang"); std::string driverPath = getExecutablePath(args[0]); - // Check if flang-new is in the frontend mode + // Check if flang is in the frontend mode auto firstArg = std::find_if( args.begin() + 1, args.end(), [](const char *a) { return a != nullptr; }); if (firstArg != args.end()) { @@ -89,7 +89,7 @@ << "Valid tools include '-fc1'.\n"; return 1; } - // Call flang-new frontend + // Call flang frontend if (llvm::StringRef(args[1]).startswith("-fc1")) { return executeFC1Tool(args); } Index: flang/tools/flang-driver/CMakeLists.txt =================================================================== --- flang/tools/flang-driver/CMakeLists.txt +++ flang/tools/flang-driver/CMakeLists.txt @@ -10,7 +10,7 @@ Support ) -add_flang_tool(flang-new +add_flang_tool(flang driver.cpp fc1_main.cpp @@ -23,23 +23,32 @@ Fortran_main ) -target_link_libraries(flang-new +target_link_libraries(flang PRIVATE flangFrontend flangFrontendTool ) -clang_target_link_libraries(flang-new +clang_target_link_libraries(flang PRIVATE clangDriver clangBasic ) +if(WIN32 AND NOT CYGWIN) + # Prevent versioning if the buildhost is targeting for Win32. +else() + set_target_properties(flang PROPERTIES VERSION ${FLANG_EXECUTABLE_VERSION}) +endif() + option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON) -# Enable support for plugins, which need access to symbols from flang-new +# Enable support for plugins, which need access to symbols from flang if(FLANG_PLUGIN_SUPPORT) - export_executable_symbols_for_plugins(flang-new) + export_executable_symbols_for_plugins(flang) endif() -install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}") +# For backwords compatibility +add_flang_symlink(flang-new flang) + +install(TARGETS flang DESTINATION "${CMAKE_INSTALL_BINDIR}") Index: flang/tools/f18/flang =================================================================== --- /dev/null +++ flang/tools/f18/flang @@ -1,493 +0,0 @@ -#! /usr/bin/env bash -#===-- tools/f18/flang.sh -----------------------------------------*- sh -*-===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# -# A wrapper script for Flang's compiler driver that was developed for testing and -# experimenting. You should be able to use it as a regular compiler driver. It -# will: -# * run Flang's compiler driver to unparse the input source files -# * use the external compiler (defined via FLANG_FC environment variable) to -# compile the unparsed source files -# -# Tested with Bash 4.4. This script will exit immediately if you use an -# older version of Bash. -#===------------------------------------------------------------------------===# -set -euo pipefail - -# Global variables to make the parsing of input arguments a bit easier -INPUT_FILES=() -OPTIONS=() -OUTPUT_FILE="" -MODULE_DIR="" -INTRINSICS_MOD_DIR="" -COMPILE_ONLY="False" -PREPROCESS_ONLY="False" -PRINT_VERSION="False" - -# === check_bash_version ====================================================== -# -# Checks the Bash version that's used to run this script. Exits immediately -# with a non-zero return code if it's lower than 4.4. Otherwise returns 0 -# (success). -# ============================================================================= -check_bash_version() { - message="Error: Your Bash is too old. Please use Bash >= 4.4" - # Major version - [[ "${BASH_VERSINFO[0]:-0}" -lt 4 ]] && echo $message && exit 1 - - # Minor version - if [[ "${BASH_VERSINFO[0]}" == 4 ]]; then - [[ "${BASH_VERSINFO[1]:-0}" -lt 4 ]] && echo $message && exit 1 - fi - - return 0 -} - -# === parse_args ============================================================== -# -# Parse the input arguments passed to this script. Sets the global variables -# declared at the top. -# -# INPUTS: -# $1 - all input arguments -# OUTPUTS: -# Saved in the global variables for this script -# ============================================================================= -parse_args() -{ - while [ "${1:-}" != "" ]; do - # CASE 1: Compiler option - if [[ "${1:0:1}" == "-" ]] ; then - # Output file - extract it into a global variable - if [[ "$1" == "-o" ]] ; then - shift - OUTPUT_FILE="$1" - shift - continue - fi - - # Module directory - extract it into a global variable - if [[ "$1" == "-module-dir" ]]; then - shift - MODULE_DIR="$1" - shift - continue - fi - - # Intrinsics module dir - extract it into a global var - if [[ "$1" == "-intrinsics-module-directory" ]]; then shift - INTRINSICS_MOD_DIR=$1 - shift - continue - fi - - # Module suffix cannot be modified - this script defines it before - # calling the driver. - if [[ "$1" == "-module-suffix" ]]; then - echo "ERROR: \'-module-suffix\' is not available when using the \'flang\' script" - exit 1 - fi - - # Special treatment for `J <dir>` and `-I <dir>`. We translate these - # into `J<dir>` and `-I<dir>` respectively. - if [[ "$1" == "-J" ]] || [[ "$1" == "-I" ]]; then - opt=$1 - shift - OPTIONS+=("$opt$1") - shift - continue - fi - - # This is a regular option - just add it to the list. - OPTIONS+=($1) - if [[ $1 == "-c" ]]; then - COMPILE_ONLY="True" - fi - - if [[ $1 == "-E" ]]; then - PREPROCESS_ONLY="True" - fi - - if [[ $1 == "-v" || $1 == "--version" ]]; then - PRINT_VERSION="True" - fi - - shift - continue - - # CASE 2: A regular file (either source or a library file) - elif [[ -f "$1" ]]; then - INPUT_FILES+=($1) - shift - continue - - else - # CASE 3: Unsupported - echo "ERROR: unrecognised option format: \`$1\`. Perhaps non-existent file?" - exit 1 - fi - done -} - -# === categorise_files ======================================================== -# -# Categorises input files into: -# * Fortran source files (to be compiled) -# * library files (to be linked into the final executable) -# -# INPUTS: -# $1 - all input files to be categorised (array, name reference) -# OUTPUTS: -# $2 - Fortran source files extracted from $1 (array, name reference) -# $3 - other source files extracted from $1 (array, name reference) -# $4 - object files extracted from $1 (array, name reference) -# $5 - lib files extracted from $1 (array, name reference) -# ============================================================================= -categorise_files() -{ - local -n -r all_files=$1 - local -n fortran_sources=$2 - local -n other_sources=$3 - local -n objects=$4 - local -n libs=$5 - - for current_file in "${all_files[@]}"; do - file_ext=${current_file##*.} - if [[ $file_ext == "f" ]] || [[ $file_ext == "f90" ]] || - [[ $file_ext == "f" ]] || [[ $file_ext == "F" ]] || [[ $file_ext == "ff" ]] || - [[ $file_ext == "f90" ]] || [[ $file_ext == "F90" ]] || [[ $file_ext == "ff90" ]] || - [[ $file_ext == "f95" ]] || [[ $file_ext == "F95" ]] || [[ $file_ext == "ff95" ]] || - [[ $file_ext == "cuf" ]] || [[ $file_ext == "CUF" ]] || [[ $file_ext == "f18" ]] || - [[ $file_ext == "F18" ]] || [[ $file_ext == "ff18" ]]; then - fortran_sources+=($current_file) - elif [[ $file_ext == "a" ]] || [[ $file_ext == "so" ]]; then - libs+=($current_file) - elif [[ $file_ext == "o" ]]; then - objects+=($current_file) - else - other_sources+=($current_file) - fi - done -} - -# === categorise_opts ========================================================== -# -# Categorises compiler options into options for: -# * the Flang driver (either new or the "throwaway" driver) -# * the external Fortran driver that will generate the code -# Most options accepted by Flang will be claimed by it. The only exceptions are -# `-I` and `-J`. -# -# INPUTS: -# $1 - all compiler options (array, name reference) -# OUTPUTS: -# $2 - compiler options for the Flang driver (array, name reference) -# $3 - compiler options for the external driver (array, name reference) -# ============================================================================= -categorise_opts() -{ - local -n all_opts=$1 - local -n flang_opts=$2 - local -n fc_opts=$3 - - for opt in "${all_opts[@]}"; do - # These options are claimed by Flang, but should've been dealt with in parse_args. - if [[ $opt == "-module-dir" ]] || - [[ $opt == "-o" ]] || - [[ $opt == "-fintrinsic-modules-path" ]] ; then - echo "ERROR: $opt should've been fully processed by \`parse_args\`" - exit 1 - fi - - if - # The options claimed by Flang. This list needs to be compatible with - # what's supported by Flang's compiler driver (i.e. `flang-new`). - [[ $opt == "-cpp" ]] || - [[ $opt =~ ^-D.* ]] || - [[ $opt == "-E" ]] || - [[ $opt == "-falternative-parameter-statement" ]] || - [[ $opt == "-fbackslash" ]] || - [[ $opt == "-fcolor-diagnostics" ]] || - [[ $opt == "-fdefault-double-8" ]] || - [[ $opt == "-fdefault-integer-8" ]] || - [[ $opt == "-fdefault-real-8" ]] || - [[ $opt == "-ffixed-form" ]] || - [[ $opt =~ ^-ffixed-line-length=.* ]] || - [[ $opt == "-ffree-form" ]] || - [[ $opt == "-fimplicit-none" ]] || - [[ $opt =~ ^-finput-charset=.* ]] || - [[ $opt == "-flarge-sizes" ]] || - [[ $opt == "-flogical-abbreviations" ]] || - [[ $opt == "-fno-color-diagnostics" ]] || - [[ $opt == "-fxor-operator" ]] || - [[ $opt == "-help" ]] || - [[ $opt == "-nocpp" ]] || - [[ $opt == "-pedantic" ]] || - [[ $opt =~ ^-std=.* ]] || - [[ $opt =~ ^-U.* ]] || - [[ $opt == "-Werror" ]]; then - flang_opts+=($opt) - elif - # We translate the following into equivalents understood by `flang-new` - [[ $opt == "-Mfixed" ]] || [[ $opt == "-Mfree" ]]; then - case $opt in - -Mfixed) - flang_opts+=("-ffixed-form") - ;; - - -Mfree) - flang_opts+=("-ffree-form") - ;; - - *) - echo "ERROR: $opt has no equivalent in 'flang-new'" - exit 1 - ;; - esac - elif - # Options that are needed for both Flang and the external driver. - [[ $opt =~ -I.* ]] || - [[ $opt =~ -J.* ]] || - [[ $opt == "-fopenmp" ]] || - [[ $opt == "-fopenacc" ]]; then - flang_opts+=($opt) - fc_opts+=($opt) - else - # All other options are claimed for the external driver. - fc_opts+=($opt) - fi - done -} - -# === get_external_fc_name ==================================================== -# -# Returns the name of external Fortran compiler based on values of -# environment variables. -# ============================================================================= -get_external_fc_name() { - if [[ -v FLANG_FC ]]; then - echo ${FLANG_FC} - elif [[ -v F18_FC ]]; then - # We support F18_FC for backwards compatibility. - echo ${F18_FC} - else - echo gfortran - fi -} - -# === preprocess ============================================================== -# -# Runs the preprocessing. Fortran files are preprocessed using Flang. Other -# files are preprocessed using the external Fortran compiler. -# -# INPUTS: -# $1 - Fortran source files (array, name reference) -# $2 - other source files (array, name reference) -# $3 - compiler flags (array, name reference) -# ============================================================================= -preprocess() { - local -n fortran_srcs=$1 - local -n other_srcs=$2 - local -n opts=$3 - - local ext_fc="$(get_external_fc_name)" - - local -r wd=$(cd "$(dirname "$0")/.." && pwd) - - # Use the provided output file name. - if [[ ! -z ${OUTPUT_FILE:+x} ]]; then - output_definition="-o $OUTPUT_FILE" - fi - - # Preprocess fortran sources using Flang - for idx in "${!fortran_srcs[@]}"; do - if ! "$wd/bin/flang-new" -E "${opts[@]}" "${fortran_srcs[$idx]}" ${output_definition:+$output_definition} - then status=$? - echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2 - exit $status - fi - done - - # Preprocess other sources using Flang - for idx in "${!other_srcs[@]}"; do - if ! $ext_fc -E "${opts[@]}" "${other_srcs[$idx]}" ${output_definition:+$output_definition} - then status=$? - echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2 - exit $status - fi - done -} - -# === get_relocatable_name ====================================================== -# This method generates the name of the output file for the compilation phase -# (triggered with `-c`). If the user of this script is only interested in -# compilation (`flang -c`), use $OUTPUT_FILE provided that it was defined. -# Otherwise, use the usual heuristics: -# * file.f --> file.o -# * file.c --> file.o -# -# INPUTS: -# $1 - input source file for which to generate the output name -# ============================================================================= -get_relocatable_name() { - local -r src_file=$1 - - if [[ $COMPILE_ONLY == "True" ]] && [[ ! -z ${OUTPUT_FILE:+x} ]]; then - out_file="$OUTPUT_FILE" - else - current_ext=${src_file##*.} - new_ext="o" - - out_file=$(basename "${src_file}" "$current_ext")${new_ext} - fi - - echo "$out_file" -} - -# === main ==================================================================== -# Main entry point for this script -# ============================================================================= -main() { - check_bash_version - parse_args "$@" - - if [[ $PRINT_VERSION == "True" ]]; then - echo "flang version @FLANG_VERSION@" - exit 0 - fi - - # Source, object and library files provided by the user - local fortran_source_files=() - local other_source_files=() - local object_files=() - local lib_files=() - categorise_files INPUT_FILES fortran_source_files other_source_files object_files lib_files - - if [[ $PREPROCESS_ONLY == "True" ]]; then - preprocess fortran_source_files other_source_files OPTIONS - exit 0 - fi - - # Options for the Flang driver. - # NOTE: We need `-fc1` to make sure that the frontend driver rather than - # compiler driver is used. We also need to make sure that that's the first - # flag that the driver will see (otherwise it assumes compiler/toolchain - # driver mode). - local flang_options=("-fc1") - # Options for the external Fortran Compiler - local ext_fc_options=() - categorise_opts OPTIONS flang_options ext_fc_options - - local -r wd=$(cd "$(dirname "$0")/.." && pwd) - - # uuidgen is common but not installed by default on some distros - if ! command -v uuidgen &> /dev/null - then - echo "uuidgen is required for generating unparsed file names." - exit 1 - fi - - # STEP 1: Unparse - # Base-name for the unparsed files. These are just temporary files that are - # first generated and then deleted by this script. - # NOTE: We need to make sure that the base-name is unique to every - # invocation. Otherwise we can't use this script in parallel. - local -r unique_id=$(uuidgen | cut -b25-36) - local -r unparsed_file_base="flang_unparsed_file_$unique_id" - - flang_options+=("-module-suffix") - flang_options+=(".f18.mod") - flang_options+=("-fdebug-unparse") - flang_options+=("-fno-analyzed-objects-for-unparse") - - [[ ! -z ${MODULE_DIR} ]] && flang_options+=("-module-dir ${MODULE_DIR}") - [[ ! -z ${INTRINSICS_MOD_DIR} ]] && flang_options+=("-intrinsics-module-directory ${INTRINSICS_MOD_DIR}") - for idx in "${!fortran_source_files[@]}"; do - set +e - "$wd/bin/flang-new" "${flang_options[@]}" "${fortran_source_files[$idx]}" -o "${unparsed_file_base}_${idx}.f90" - ret_status=$? - set -e - if [[ $ret_status != 0 ]]; then - echo flang: in "$PWD", flang-new failed with exit status "$ret_status": "$wd/bin/flang-new" "${flang_options[@]}" "$@" >&2 - exit "$ret_status" - fi - done - - # STEP 2: Compile Fortran Source Files - local ext_fc="$(get_external_fc_name)" - # Temporary object files generated by this script. To be deleted at the end. - local temp_object_files=() - for idx in "${!fortran_source_files[@]}"; do - # We always have to specify the output name with `-o <out_obj_file>`. This - # is because we are using the unparsed rather than the original source file - # below. As a result, we cannot rely on the compiler-generated output name. - out_obj_file=$(get_relocatable_name "${fortran_source_files[$idx]}") - - set +e - $ext_fc "-c" "${ext_fc_options[@]}" "${unparsed_file_base}_${idx}.f90" "-o" "${out_obj_file}" - ret_status=$? - set -e - if [[ $ret_status != 0 ]]; then - echo flang: in "$PWD", "$ext_fc" failed with exit status "$ret_status": "$ext_fc" "${ext_fc_options[@]}" "$@" >&2 - exit "$ret_status" - fi - temp_object_files+=(${out_obj_file}) - done - - # Delete the unparsed files - for idx in "${!fortran_source_files[@]}"; do - rm "${unparsed_file_base}_${idx}.f90" - done - - # STEP 3: Compile Other Source Files - for idx in "${!other_source_files[@]}"; do - # We always specify the output name with `-o <out_obj_file>`. The user - # might have used `-o`, but we never add it to $OPTIONS (or - # $ext_fc_options). Hence we need to use `get_relocatable_name`. - out_obj_file=$(get_relocatable_name "${other_source_files[$idx]}") - - set +e - $ext_fc "-c" "${ext_fc_options[@]}" "${other_source_files[${idx}]}" "-o" "${out_obj_file}" - ret_status=$? - set -e - if [[ $ret_status != 0 ]]; then - echo flang: in "$PWD", "$ext_fc" failed with exit status "$ret_status": "$ext_fc" "${ext_fc_options[@]}" "$@" >&2 - exit "$ret_status" - fi - temp_object_files+=(${out_obj_file}) - done - - # STEP 4: Link - if [[ $COMPILE_ONLY == "True" ]]; then - exit 0; - fi - - if [[ ${#temp_object_files[@]} -ge 1 ]] || [[ ${#object_files[@]} -ge 1 ]] ; then - # If $OUTPUT_FILE was specified, use it for the output name. - if [[ ! -z ${OUTPUT_FILE:+x} ]]; then - output_definition="-o $OUTPUT_FILE" - else - output_definition="" - fi - - set +e - $ext_fc "${ext_fc_options[@]}" "${object_files[@]}" "${temp_object_files[@]}" "${lib_files[@]}" ${output_definition:+$output_definition} - ret_status=$? - set -e - if [[ $ret_status != 0 ]]; then - echo flang: in "$PWD", "$ext_fc" failed with exit status "$ret_status": "$ext_fc" "${ext_fc_options[@]}" "$@" >&2 - exit "$ret_status" - fi - fi - - # Delete intermediate object files - for idx in "${!fortran_source_files[@]}"; do - rm "${temp_object_files[$idx]}" - done -} - -main "${@}" Index: flang/tools/f18/CMakeLists.txt =================================================================== --- flang/tools/f18/CMakeLists.txt +++ flang/tools/f18/CMakeLists.txt @@ -35,9 +35,9 @@ endif() add_custom_command(OUTPUT ${base}.mod COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR} - COMMAND flang-new -fc1 -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR} + COMMAND flang -fc1 -fsyntax-only -module-dir ${FLANG_INTRINSIC_MODULES_DIR} ${FLANG_SOURCE_DIR}/module/${filename}.f90 - DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} + DEPENDS flang ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} ) add_custom_command(OUTPUT ${base}.f18.mod DEPENDS ${base}.mod @@ -48,14 +48,14 @@ add_custom_target(module_files ALL DEPENDS ${MODULE_FILES}) -# This flang shell script will only work in a POSIX shell. +# The flang-to-gfortan shell script will only work in a POSIX shell. if (NOT WIN32) add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/bin/flang - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/flang - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/flang ${CMAKE_BINARY_DIR}/bin) - add_custom_target(flang ALL DEPENDS ${CMAKE_BINARY_DIR}/bin/flang) - install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION "${CMAKE_INSTALL_BINDIR}") + OUTPUT ${CMAKE_BINARY_DIR}/bin/flang-to-gfortran + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/flang-to-gfortran + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/flang-to-gfortran ${CMAKE_BINARY_DIR}/bin) + add_custom_target(flang-to-gfortran ALL DEPENDS ${CMAKE_BINARY_DIR}/bin/flang-to-gfortran) + install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang-to-gfortran DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() # TODO Move this to a more suitable location Index: flang/test/lit.cfg.py =================================================================== --- flang/test/lit.cfg.py +++ flang/test/lit.cfg.py @@ -78,8 +78,8 @@ # For each occurrence of a flang tool name, replace it with the full path to # the build directory holding that tool. tools = [ - ToolSubst('%flang', command=FindTool('flang-new'), unresolved='fatal'), - ToolSubst('%flang_fc1', command=FindTool('flang-new'), extra_args=['-fc1'], + ToolSubst('%flang', command=FindTool('flang'), unresolved='fatal'), + ToolSubst('%flang_fc1', command=FindTool('flang'), extra_args=['-fc1'], unresolved='fatal')] # Flang has several unimplemented features. TODO messages are used to mark and fail if these Index: flang/test/Lower/OpenMP/Todo/omp-threadprivate.f90 =================================================================== --- flang/test/Lower/OpenMP/Todo/omp-threadprivate.f90 +++ flang/test/Lower/OpenMP/Todo/omp-threadprivate.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP threadprivate Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s program main integer, save :: x, y Index: flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 =================================================================== --- flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 +++ flang/test/Lower/OpenMP/Todo/omp-declare-target.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP declare target Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s module mod1 contains Index: flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 =================================================================== --- flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 +++ flang/test/Lower/OpenMP/Todo/omp-declare-simd.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP declare simd Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s subroutine sub(x, y) real, intent(inout) :: x, y Index: flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 =================================================================== --- flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 +++ flang/test/Lower/OpenMP/Todo/omp-declare-reduction.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP declare reduction Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s subroutine declare_red() integer :: my_var Index: flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 =================================================================== --- flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 +++ flang/test/Lower/OpenMP/Todo/omp-declarative-allocate.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenMP allocate Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenmp %s 2>&1 | FileCheck %s program main integer :: x, y Index: flang/test/Lower/OpenACC/Todo/acc-routine.f90 =================================================================== --- flang/test/Lower/OpenACC/Todo/acc-routine.f90 +++ flang/test/Lower/OpenACC/Todo/acc-routine.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenACC routine Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s program main // CHECK: not yet implemented: OpenACC Routine construct not lowered yet! Index: flang/test/Lower/OpenACC/Todo/acc-declare.f90 =================================================================== --- flang/test/Lower/OpenACC/Todo/acc-declare.f90 +++ flang/test/Lower/OpenACC/Todo/acc-declare.f90 @@ -1,6 +1,6 @@ ! This test checks lowering of OpenACC declare Directive. -// RUN: not flang-new -fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s +// RUN: not flang -fc1 -emit-fir -fopenacc %s 2>&1 | FileCheck %s program main real, dimension(10) :: aa, bb Index: flang/test/Lower/Intrinsics/get_environment_variable.f90 =================================================================== --- flang/test/Lower/Intrinsics/get_environment_variable.f90 +++ flang/test/Lower/Intrinsics/get_environment_variable.f90 @@ -1,5 +1,5 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s +! RUN: flang -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s ! CHECK-LABEL: func @_QPnumber_only( ! CHECK-SAME: %[[nameArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "name"}) { Index: flang/test/Lower/Intrinsics/get_command_argument.f90 =================================================================== --- flang/test/Lower/Intrinsics/get_command_argument.f90 +++ flang/test/Lower/Intrinsics/get_command_argument.f90 @@ -1,5 +1,5 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s +! RUN: flang -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s ! CHECK-LABEL: func @_QPnumber_only( ! CHECK-SAME: %[[num:.*]]: !fir.ref<i[[DEFAULT_INTEGER_SIZE]]>{{.*}}) { Index: flang/test/Lower/Intrinsics/exit.f90 =================================================================== --- flang/test/Lower/Intrinsics/exit.f90 +++ flang/test/Lower/Intrinsics/exit.f90 @@ -1,6 +1,6 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-32 -DDEFAULT_INTEGER_SIZE=32 %s -! bbc doesn't have a way to set the default kinds so we use flang-new driver -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s +! bbc doesn't have a way to set the default kinds so we use flang driver +! RUN: flang -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 -DDEFAULT_INTEGER_SIZE=64 %s ! CHECK-LABEL: func @_QPexit_test1() { subroutine exit_test1 Index: flang/test/Lower/Intrinsics/command_argument_count.f90 =================================================================== --- flang/test/Lower/Intrinsics/command_argument_count.f90 +++ flang/test/Lower/Intrinsics/command_argument_count.f90 @@ -1,6 +1,6 @@ ! RUN: bbc -emit-fir %s -o - | FileCheck %s -! bbc doesn't have a way to set the default kinds so we use flang-new driver -! RUN: flang-new -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 %s +! bbc doesn't have a way to set the default kinds so we use flang driver +! RUN: flang -fc1 -fdefault-integer-8 -emit-fir %s -o - | FileCheck --check-prefixes=CHECK,CHECK-64 %s ! CHECK-LABEL: argument_count_test subroutine argument_count_test() Index: flang/test/Frontend/multiple-input-files.f90 =================================================================== --- flang/test/Frontend/multiple-input-files.f90 +++ flang/test/Frontend/multiple-input-files.f90 @@ -8,8 +8,8 @@ ! RUN: %flang -E %s %S/Inputs/hello-world.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG ! TEST 2: None of the files is processed (not possible to specify the output file when multiple input files are present) -! RUN: not %flang -E -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR -! RUN: not %flang -E -o %t %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR +! RUN: not %flang -E -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s -check-prefix=ERROR +! RUN: not %flang -E -o %t %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s -check-prefix=ERROR !---------------------------------------- ! FLANG FRONTEND DRIVER (flang -fc1) @@ -43,7 +43,7 @@ ! FLANG-NEXT:end program hello ! TEST 2: `-o` does not when multiple input files are present -! ERROR: flang-new: error: cannot specify -o when generating multiple output files +! ERROR: error: cannot specify -o when generating multiple output files ! TEST 3: The output file _was not_ specified - `flang_fc1` will process all ! input files and generate one output file for every input file. Index: flang/test/Driver/use-module.f90 =================================================================== --- flang/test/Driver/use-module.f90 +++ flang/test/Driver/use-module.f90 @@ -1,7 +1,7 @@ ! Checks that module search directories specified with `-J/-module-dir` and `-I` are handled correctly !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang -fsyntax-only -I %S/Inputs -I %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty ! RUN: %flang -fsyntax-only -I %S/Inputs -J %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty @@ -16,7 +16,7 @@ ! RUN: not %flang -fsyntax-only -module-dir %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=SINGLEINCLUDE !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -fsyntax-only -I %S/Inputs -I %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty ! RUN: %flang_fc1 -fsyntax-only -I %S/Inputs -J %S/Inputs/module-dir %s 2>&1 | FileCheck %s --check-prefix=INCLUDED --allow-empty Index: flang/test/Driver/use-module-error.f90 =================================================================== --- flang/test/Driver/use-module-error.f90 +++ flang/test/Driver/use-module-error.f90 @@ -1,14 +1,14 @@ ! Ensure that multiple module directories are not allowed !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: not %flang -fsyntax-only -J %S/Inputs/module-dir -J %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE ! RUN: not %flang -fsyntax-only -J %S/Inputs/module-dir -module-dir %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE ! RUN: not %flang -fsyntax-only -module-dir %S/Inputs/module-dir -J%S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: not %flang_fc1 -fsyntax-only -J %S/Inputs/module-dir -J %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE ! RUN: not %flang_fc1 -fsyntax-only -J %S/Inputs/module-dir -module-dir %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=DOUBLEINCLUDE Index: flang/test/Driver/std2018.f90 =================================================================== --- flang/test/Driver/std2018.f90 +++ flang/test/Driver/std2018.f90 @@ -1,7 +1,7 @@ ! Ensure argument -std=f2018 works as expected. !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT ! RUN: %flang_fc1 -fsyntax-only -std=f2018 %s 2>&1 | FileCheck %s --check-prefix=GIVEN Index: flang/test/Driver/std2018-wrong.f90 =================================================================== --- flang/test/Driver/std2018-wrong.f90 +++ flang/test/Driver/std2018-wrong.f90 @@ -1,7 +1,7 @@ ! Ensure argument -std=f2018 works as expected. !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: not %flang_fc1 -std=90 %s 2>&1 | FileCheck %s --check-prefix=WRONG Index: flang/test/Driver/predefined-macros-compiler-version.F90 =================================================================== --- flang/test/Driver/predefined-macros-compiler-version.F90 +++ flang/test/Driver/predefined-macros-compiler-version.F90 @@ -1,12 +1,12 @@ ! Check that the driver correctly defines macros with the compiler version !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --ignore-case !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --ignore-case Index: flang/test/Driver/missing-input.f90 =================================================================== --- flang/test/Driver/missing-input.f90 +++ flang/test/Driver/missing-input.f90 @@ -1,18 +1,18 @@ ! Test the behaviour of the driver when input is missing or is invalid. Note -! that with the compiler driver (flang-new), the input _has_ to be specified. +! that with the compiler driver (flang), the input _has_ to be specified. ! Indeed, the driver decides what "job/command" to create based on the input ! file's extension. No input file means that it doesn't know what to do -! (compile? preprocess? link?). The frontend driver (flang-new -fc1) simply +! (compile? preprocess? link?). The frontend driver (flang -fc1) simply ! assumes that "no explicit input == read from stdin" !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: not %flang 2>&1 | FileCheck %s --check-prefix=FLANG-NO-FILE ! RUN: not %flang %t.f90 2>&1 | FileCheck %s --check-prefix=FLANG-NONEXISTENT-FILE !----------------------------------------- -! FLANG FRONTEND DRIVER (flang-new -fc1) +! FLANG FRONTEND DRIVER (flang -fc1) !----------------------------------------- ! RUN: not %flang_fc1 %t.f90 2>&1 | FileCheck %s --check-prefix=FLANG-FC1-NONEXISTENT-FILE ! RUN: not %flang_fc1 %S 2>&1 | FileCheck %s --check-prefix=FLANG-FC1-DIR @@ -20,10 +20,10 @@ !----------------------- ! EXPECTED OUTPUT !----------------------- -! FLANG-NO-FILE: flang-new: error: no input files +! FLANG-NO-FILE: error: no input files -! FLANG-NONEXISTENT-FILE: flang-new: error: no such file or directory: {{.*}} -! FLANG-NONEXISTENT-FILE: flang-new: error: no input files +! FLANG-NONEXISTENT-FILE: error: no such file or directory: {{.*}} +! FLANG-NONEXISTENT-FILE: error: no input files ! FLANG-FC1-NONEXISTENT-FILE: error: {{.*}} does not exist ! FLANG-FC1-DIR: error: {{.*}} is not a regular file Index: flang/test/Driver/macro-def-undef.F90 =================================================================== --- flang/test/Driver/macro-def-undef.F90 +++ flang/test/Driver/macro-def-undef.F90 @@ -1,14 +1,14 @@ ! Ensure arguments -D and -U work as expected. !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang -E -P %s 2>&1 | FileCheck %s --check-prefix=UNDEFINED ! RUN: %flang -E -P -DX=A %s 2>&1 | FileCheck %s --check-prefix=DEFINED ! RUN: %flang -E -P -DX=A -UX %s 2>&1 | FileCheck %s --check-prefix=UNDEFINED !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -E -P %s 2>&1 | FileCheck %s --check-prefix=UNDEFINED ! RUN: %flang_fc1 -E -P -DX=A %s 2>&1 | FileCheck %s --check-prefix=DEFINED Index: flang/test/Driver/intrinsic-module-path.f90 =================================================================== --- flang/test/Driver/intrinsic-module-path.f90 +++ flang/test/Driver/intrinsic-module-path.f90 @@ -4,7 +4,7 @@ ! default one, causing a CHECKSUM error. !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT ! RUN: not %flang_fc1 -fsyntax-only -fintrinsic-modules-path %S/Inputs/ %s 2>&1 | FileCheck %s --check-prefix=GIVEN Index: flang/test/Driver/frontend-forwarding.f90 =================================================================== --- flang/test/Driver/frontend-forwarding.f90 +++ flang/test/Driver/frontend-forwarding.f90 @@ -1,5 +1,5 @@ -! Test that flang-new forwards Flang frontend -! options to flang-new -fc1 as expected. +! Test that flang forwards Flang frontend +! options to flang -fc1 as expected. ! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \ ! RUN: -finput-charset=utf-8 \ Index: flang/test/Driver/flarge-sizes.f90 =================================================================== --- flang/test/Driver/flarge-sizes.f90 +++ flang/test/Driver/flarge-sizes.f90 @@ -2,20 +2,20 @@ ! TODO: Add checks when actual codegen is possible. !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOLARGE -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -flarge-sizes -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=LARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOLARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -flarge-sizes -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=LARGE !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOLARGE -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -flarge-sizes -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=LARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOLARGE +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -flarge-sizes -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=LARGE !----------------------------------------- ! EXPECTED OUTPUT WITHOUT -flarge-sizes Index: flang/test/Driver/fdefault.f90 =================================================================== --- flang/test/Driver/fdefault.f90 +++ flang/test/Driver/fdefault.f90 @@ -2,25 +2,25 @@ ! TODO: Add checks when actual codegen is possible for this family !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOOPTION -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=REAL8 -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=DOUBLE8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOOPTION +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=REAL8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=DOUBLE8 ! RUN: not %flang -fsyntax-only -fdefault-double-8 %s 2>&1 | FileCheck %s --check-prefix=ERROR !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=NOOPTION -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=REAL8 -! RUN: rm -rf %t/dir-flang-new && mkdir -p %t/dir-flang-new && %flang_fc1 -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang-new %s 2>&1 -! RUN: cat %t/dir-flang-new/m.mod | FileCheck %s --check-prefix=DOUBLE8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=NOOPTION +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -fdefault-real-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=REAL8 +! RUN: rm -rf %t/dir-flang && mkdir -p %t/dir-flang && %flang_fc1 -fsyntax-only -fdefault-real-8 -fdefault-double-8 -module-dir %t/dir-flang %s 2>&1 +! RUN: cat %t/dir-flang/m.mod | FileCheck %s --check-prefix=DOUBLE8 ! RUN: not %flang_fc1 -fsyntax-only -fdefault-double-8 %s 2>&1 | FileCheck %s --check-prefix=ERROR !----------------------------------------- Index: flang/test/Driver/escaped-backslash.f90 =================================================================== --- flang/test/Driver/escaped-backslash.f90 +++ flang/test/Driver/escaped-backslash.f90 @@ -1,14 +1,14 @@ ! Ensure argument -fbackslash works as expected. !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang -E %s 2>&1 | FileCheck %s --check-prefix=ESCAPED ! RUN: %flang -E -fbackslash -fno-backslash %s 2>&1 | FileCheck %s --check-prefix=ESCAPED ! RUN: %flang -E -fbackslash %s 2>&1 | FileCheck %s --check-prefix=UNESCAPED !----------------------------------------- -! FRONTEND FLANG DRIVER (flang-new -fc1) +! FRONTEND FLANG DRIVER (flang -fc1) !----------------------------------------- ! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --check-prefix=ESCAPED ! RUN: %flang_fc1 -E -fbackslash -fno-backslash %s 2>&1 | FileCheck %s --check-prefix=ESCAPED Index: flang/test/Driver/driver-version.f90 =================================================================== --- flang/test/Driver/driver-version.f90 +++ flang/test/Driver/driver-version.f90 @@ -10,12 +10,12 @@ !----------------------- ! EXPECTED OUTPUT !----------------------- -! VERSION: flang-new version +! VERSION: flang version ! VERSION-NEXT: Target: ! VERSION-NEXT: Thread model: ! VERSION-NEXT: InstalledDir: -! ERROR: flang-new: error: unsupported option '--versions'; did you mean '--version'? +! ERROR: error: unsupported option '--versions'; did you mean '--version'? ! VERSION-FC1: LLVM version Index: flang/test/Driver/driver-help-hidden.f90 =================================================================== --- flang/test/Driver/driver-help-hidden.f90 +++ flang/test/Driver/driver-help-hidden.f90 @@ -1,20 +1,20 @@ !-------------------------- -! FLANG DRIVER (flang-new) +! FLANG DRIVER (flang) !-------------------------- ! RUN: %flang --help-hidden 2>&1 | FileCheck %s ! RUN: not %flang -help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG !---------------------------------------- -! FLANG FRONTEND DRIVER (flang-new -fc1) +! FLANG FRONTEND DRIVER (flang -fc1) !---------------------------------------- ! RUN: not %flang_fc1 --help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG-FC1 ! RUN: not %flang_fc1 -help-hidden 2>&1 | FileCheck %s --check-prefix=ERROR-FLANG-FC1 !---------------------------------------------------- -! EXPECTED OUTPUT FOR FLANG DRIVER (flang-new) +! EXPECTED OUTPUT FOR FLANG DRIVER (flang) !---------------------------------------------------- -! CHECK:USAGE: flang-new +! CHECK:USAGE: flang ! CHECK-EMPTY: ! CHECK-NEXT:OPTIONS: ! CHECK-NEXT: -### Print (but do not run) the commands to run for this compilation @@ -70,12 +70,12 @@ ! CHECK-NEXT: -Xflang <arg> Pass <arg> to the flang compiler !------------------------------------------------------------- -! EXPECTED OUTPUT FOR FLANG DRIVER (flang-new) +! EXPECTED OUTPUT FOR FLANG DRIVER (flang) !------------------------------------------------------------- ! ERROR-FLANG: error: unknown argument '-help-hidden'; did you mean '--help-hidden'? !------------------------------------------------------------- -! EXPECTED OUTPUT FOR FLANG FRONTEND DRIVER (flang-new -fc1) +! EXPECTED OUTPUT FOR FLANG FRONTEND DRIVER (flang -fc1) !------------------------------------------------------------- ! Frontend driver -help-hidden is not supported ! ERROR-FLANG-FC1: error: unknown argument: '{{.*}}' Index: flang/test/Driver/disable-ext-name-interop.f90 =================================================================== --- flang/test/Driver/disable-ext-name-interop.f90 +++ flang/test/Driver/disable-ext-name-interop.f90 @@ -1,4 +1,4 @@ -! Test that we can disable the ExternalNameConversion pass in flang-new. +! Test that we can disable the ExternalNameConversion pass in flang. ! RUN: %flang_fc1 -S %s -o - 2>&1 | FileCheck %s --check-prefix=EXTNAMES ! RUN: %flang_fc1 -S -mmlir -disable-external-name-interop %s -o - 2>&1 | FileCheck %s --check-prefix=INTNAMES Index: flang/test/CMakeLists.txt =================================================================== --- flang/test/CMakeLists.txt +++ flang/test/CMakeLists.txt @@ -46,7 +46,7 @@ flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py) set(FLANG_TEST_DEPENDS - flang-new + flang llvm-config FileCheck count Index: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp =================================================================== --- flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -100,8 +100,8 @@ bool executeCompilerInvocation(CompilerInstance *flang) { // Honor -help. if (flang->getFrontendOpts().showHelp) { - clang::driver::getDriverOptTable().printHelp(llvm::outs(), - "flang-new -fc1 [options] file...", "LLVM 'Flang' Compiler", + clang::driver::getDriverOptTable().printHelp( + llvm::outs(), "flang -fc1 [options] file...", "LLVM 'Flang' Compiler", /*Include=*/clang::driver::options::FC1Option, /*Exclude=*/llvm::opt::DriverFlag::HelpHidden, /*ShowAllAliases=*/false); Index: flang/examples/FlangOmpReport/FlangOmpReport.cpp =================================================================== --- flang/examples/FlangOmpReport/FlangOmpReport.cpp +++ flang/examples/FlangOmpReport/FlangOmpReport.cpp @@ -9,7 +9,7 @@ // all the OpenMP constructs and clauses and which line they're located on. // // The plugin may be invoked as: -// ./bin/flang-new -fc1 -load lib/flangOmpReport.so -plugin flang-omp-report +// ./bin/flang -fc1 -load lib/flangOmpReport.so -plugin flang-omp-report // -fopenmp // //===----------------------------------------------------------------------===// Index: clang/test/Driver/flang/multiple-inputs.f90 =================================================================== --- clang/test/Driver/flang/multiple-inputs.f90 +++ clang/test/Driver/flang/multiple-inputs.f90 @@ -1,7 +1,7 @@ ! Check that flang driver can handle multiple inputs at once. ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/two.f90 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s -! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new" "-fc1" +! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90" -! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new" "-fc1" +! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang" "-fc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/two.f90" Index: clang/test/Driver/flang/multiple-inputs-mixed.f90 =================================================================== --- clang/test/Driver/flang/multiple-inputs-mixed.f90 +++ clang/test/Driver/flang/multiple-inputs-mixed.f90 @@ -1,7 +1,7 @@ ! Check that flang can handle mixed C and fortran inputs. ! RUN: %clang --driver-mode=flang -### -fsyntax-only %S/Inputs/one.f90 %S/Inputs/other.c 2>&1 | FileCheck --check-prefixes=CHECK-SYNTAX-ONLY %s -! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang-new{{[^"/]*}}" "-fc1" +! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}flang{{[^"/]*}}" "-fc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/one.f90" ! CHECK-SYNTAX-ONLY-LABEL: "{{[^"]*}}clang{{[^"/]*}}" "-cc1" ! CHECK-SYNTAX-ONLY: "{{[^"]*}}/Inputs/other.c" Index: clang/test/Driver/flang/flang_ucase.F90 =================================================================== --- clang/test/Driver/flang/flang_ucase.F90 +++ clang/test/Driver/flang/flang_ucase.F90 @@ -13,7 +13,7 @@ ! * (no type specified, resulting in an object file) ! All invocations should begin with flang -fc1, consume up to here. -! ALL-LABEL: "{{[^"]*}}flang-new" "-fc1" +! ALL-LABEL: "{{[^"]*}}flang" "-fc1" ! Check that f90 files are not treated as "previously preprocessed" ! ... in --driver-mode=flang. Index: clang/test/Driver/flang/flang.f90 =================================================================== --- clang/test/Driver/flang/flang.f90 +++ clang/test/Driver/flang/flang.f90 @@ -13,7 +13,7 @@ ! * (no type specified, resulting in an object file) ! All invocations should begin with flang -fc1, consume up to here. -! ALL-LABEL: "{{[^"]*}}flang-new" "-fc1" +! ALL-LABEL: "{{[^"]*}}flang" "-fc1" ! Check that f90 files are not treated as "previously preprocessed" ! ... in --driver-mode=flang. Index: clang/lib/Driver/ToolChains/Flang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Flang.cpp +++ clang/lib/Driver/ToolChains/Flang.cpp @@ -129,14 +129,12 @@ CmdArgs.push_back(Input.getFilename()); const auto& D = C.getDriver(); - // TODO: Replace flang-new with flang once the new driver replaces the - // throwaway driver - const char *Exec = Args.MakeArgString(D.GetProgramPath("flang-new", TC)); + const char *Exec = Args.MakeArgString(D.GetProgramPath("flang", TC)); C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileUTF8(), Exec, CmdArgs, Inputs, Output)); } -Flang::Flang(const ToolChain &TC) : Tool("flang-new", "flang frontend", TC) {} +Flang::Flang(const ToolChain &TC) : Tool("flang", "flang frontend", TC) {} Flang::~Flang() {} Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -1776,7 +1776,7 @@ void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const { if (IsFlangMode()) { - OS << getClangToolFullVersion("flang-new") << '\n'; + OS << getClangToolFullVersion("flang") << '\n'; } else { // FIXME: The following handlers should use a callback mechanism, we don't // know what the client would like to do.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits