forked from OSchip/llvm-project
[flang] Make the frontend driver error out when requesting multiple actions
With this change, the following invocations will be treated as errors (multiple actions are specified): ``` $ flang-new -fc1 -E -fsyntax-only file.95 $ flang-new -fc1 -fsyntax-only -fdebug-dump-symbols file.95 ``` In the examples above it is not clear whether it is `-fsyntax-only` or the other action that is run (i.e. `-E` or `-fdebug-dump-symbols`). It makes sense to disallow such usage. This should also lead to cleaner and clearer tests (the `RUN` lines using `%flang_fc1` will only allow one action). This change means that `flang-new -fc1` and `clang -cc1` will behave differently when multiple action options are specified. As frontend drivers are mostly used by compiler developers, this shouldn't affect or confuse the compiler end-users. Also, `flang-new` and `clang` remain consistent. Tests are updated accordingly. More specifically, I've made sure that every test specifies only one action. I've also taken the opportunity to simplify "multiple-input-files.f90" a bit. Differential Revision: https://reviews.llvm.org/D111781
This commit is contained in:
parent
78a392cf9f
commit
d18a9aeae9
|
@ -107,6 +107,16 @@ static bool ParseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args,
|
|||
// By default the frontend driver creates a ParseSyntaxOnly action.
|
||||
opts.programAction = ParseSyntaxOnly;
|
||||
|
||||
// Treat multiple action options as an invocation error. Note that `clang
|
||||
// -cc1` does accept multiple action options, but will only consider the
|
||||
// rightmost one.
|
||||
if (args.hasMultipleArgs(clang::driver::options::OPT_Action_Group)) {
|
||||
const unsigned diagID = diags.getCustomDiagID(
|
||||
clang::DiagnosticsEngine::Error, "Only one action option is allowed");
|
||||
diags.Report(diagID);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Identify the action (i.e. opts.ProgramAction)
|
||||
if (const llvm::opt::Arg *a =
|
||||
args.getLastArg(clang::driver::options::OPT_Action_Group)) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
!----------
|
||||
! RUN LINE
|
||||
!----------
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-measure-parse-tree %s 2>&1 | FileCheck %s --check-prefix=FRONTEND
|
||||
! RUN: %flang_fc1 -fdebug-measure-parse-tree %s 2>&1 | FileCheck %s --check-prefix=FRONTEND
|
||||
|
||||
!-----------------
|
||||
! EXPECTED OUTPUT
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
!-----------
|
||||
! RUN LINES
|
||||
!-----------
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition 45 1 2 %s 2>&1 | FileCheck --check-prefix=OK %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition a 1 1 %s 2>&1 | FileCheck --check-prefix=ERROR-a %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition 1 b 1 %s 2>&1 | FileCheck --check-prefix=ERROR-b %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition 1 1 c %s 2>&1 | FileCheck --check-prefix=ERROR-c %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition a b 1 %s 2>&1 | FileCheck --check-prefix=ERROR-ab %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition a b c %s 2>&1 | FileCheck --check-prefix=ERROR-abc %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition 1 b c %s 2>&1 | FileCheck --check-prefix=ERROR-bc %s
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fget-definition a 1 c %s 2>&1 | FileCheck --check-prefix=ERROR-ac %s
|
||||
! RUN: not %flang_fc1 -fget-definition 45 1 2 %s 2>&1 | FileCheck --check-prefix=OK %s
|
||||
! RUN: not %flang_fc1 -fget-definition a 1 1 %s 2>&1 | FileCheck --check-prefix=ERROR-a %s
|
||||
! RUN: not %flang_fc1 -fget-definition 1 b 1 %s 2>&1 | FileCheck --check-prefix=ERROR-b %s
|
||||
! RUN: not %flang_fc1 -fget-definition 1 1 c %s 2>&1 | FileCheck --check-prefix=ERROR-c %s
|
||||
! RUN: not %flang_fc1 -fget-definition a b 1 %s 2>&1 | FileCheck --check-prefix=ERROR-ab %s
|
||||
! RUN: not %flang_fc1 -fget-definition a b c %s 2>&1 | FileCheck --check-prefix=ERROR-abc %s
|
||||
! RUN: not %flang_fc1 -fget-definition 1 b c %s 2>&1 | FileCheck --check-prefix=ERROR-bc %s
|
||||
! RUN: not %flang_fc1 -fget-definition a 1 c %s 2>&1 | FileCheck --check-prefix=ERROR-ac %s
|
||||
|
||||
!-----------------
|
||||
! EXPECTED OUTPUT
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
! Verify that the frontend driver error-out if multiple actions are specified
|
||||
|
||||
! RUN: not %flang_fc1 -E -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=ERROR
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=ERROR
|
||||
|
||||
! ERROR: error: Only one action option is allowed
|
||||
|
||||
end progream
|
|
@ -3,17 +3,17 @@
|
|||
! Multiple RUN lines are added to make sure that the behavior is consistent across multiple actions.
|
||||
|
||||
! RUN: not %flang_fc1 -fsyntax-only -std=f2018 -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -std=f2018 -Werror -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -std=f2018 -Werror -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -std=f2018 -Werror -fdebug-unparse %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -std=f2018 -Werror -fdebug-dump-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -std=f2018 -Werror -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -std=f2018 -Werror -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -std=f2018 -Werror -fdebug-unparse %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -std=f2018 -Werror -fdebug-dump-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -std=f2018 %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -std=f2018 -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -std=f2018 -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -std=f2018 -fdebug-unparse %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -std=f2018 -fdebug-dump-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -std=f2018 -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -std=f2018 -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -std=f2018 -fdebug-unparse %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -std=f2018 -fdebug-dump-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
|
||||
!-----------------------------------------
|
||||
! EXPECTED OUTPUT WITH -Werror
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
! actions that extend the PrescanAction
|
||||
! Multiple RUN lines are added to make sure that the behavior is consistent across multiple actions.
|
||||
|
||||
! RUN: not %flang_fc1 -fsyntax-only -E -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fdebug-dump-parsing-log -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fdebug-dump-provenance -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -fdebug-measure-parse-tree -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: %flang_fc1 -fsyntax-only -E %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-parsing-log %s 2>&1 | FileCheck %s --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-provenance %s 2>&1 | FileCheck %s --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-measure-parse-tree %s 2>&1 | FileCheck %s --check-prefix=WITHOUT
|
||||
! RUN: not %flang_fc1 -E -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fdebug-dump-parsing-log -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fdebug-dump-provenance -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fdebug-measure-parse-tree -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: %flang_fc1 -E %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-dump-parsing-log %s 2>&1 | FileCheck %s --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-dump-provenance %s 2>&1 | FileCheck %s --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-measure-parse-tree %s 2>&1 | FileCheck %s --check-prefix=WITHOUT
|
||||
|
||||
!-----------------------------------------
|
||||
! EXPECTED OUTPUT WITH -Werror
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
! Multiple RUN lines are added to make sure that the behavior is consistent across multiple actions.
|
||||
|
||||
! RUN: not %flang_fc1 -fsyntax-only -Werror %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -Werror -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -Werror -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -Werror -fdebug-unparse %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -fsyntax-only -Werror -fdebug-dump-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -Werror -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -Werror -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -Werror -fdebug-unparse %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
! RUN: not %flang_fc1 -Werror -fdebug-dump-symbols %s 2>&1 | FileCheck %s --check-prefix=WITH
|
||||
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-unparse %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-unparse-with-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s --allow-empty --check-prefix=WITHOUT
|
||||
|
||||
!-----------------------------------------
|
||||
! EXPECTED OUTPUT WITH -Werror
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
! NOTE: Use `-E` so that the compiler driver stops after the 1st compilation phase, preprocessing. That's all we need.
|
||||
|
||||
! TEST 1: Print to stdout (implicit)
|
||||
! RUN: %flang -E -Xflang -test-io %s 2>&1 | FileCheck %s --match-full-lines
|
||||
! RUN: %flang -E %s 2>&1 | FileCheck %s --match-full-lines
|
||||
|
||||
! TEST 2: Print to stdout (explicit)
|
||||
! RUN: %flang -E -Xflang -test-io -o - %s 2>&1 | FileCheck %s --match-full-lines
|
||||
! RUN: %flang -E -o - %s 2>&1 | FileCheck %s --match-full-lines
|
||||
|
||||
! TEST 3: Print to a file
|
||||
! RUN: %flang -E -Xflang -test-io -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t
|
||||
! RUN: %flang -E -o %t %s 2>&1 && FileCheck %s --match-full-lines --input-file=%t
|
||||
|
||||
!----------------------------------------
|
||||
! FLANG FRONTEND DRIVER (flang -fc1)
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
! NOTE: Use `-E` so that the compiler driver stops after the 1st compilation phase, preprocessing. That's all we need.
|
||||
|
||||
! TEST 1: Both input files are processed (output is printed to stdout)
|
||||
! RUN: %flang -E -Xflang -test-io %s %S/Inputs/hello-world.f90 | FileCheck %s --match-full-lines -check-prefix=FLANG
|
||||
! 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 -Xflang -test-io -o - %S/Inputs/hello-world.f90 %s 2>&1 | FileCheck %s --match-full-lines -check-prefix=ERROR
|
||||
! RUN: not %flang -E -Xflang -test-io -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 --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
|
||||
|
||||
!----------------------------------------
|
||||
! FLANG FRONTEND DRIVER (flang -fc1)
|
||||
|
@ -36,13 +36,13 @@
|
|||
! FLANG-NEXT: Integer :: i, j
|
||||
! FLANG-NEXT: i = 2; j = 3; i= i * j;
|
||||
! FLANG-NEXT: End Program arithmetic
|
||||
! FLANG-NEXT:!This is a test file with a hello world in Fortran
|
||||
! FLANG-NEXT:program hello
|
||||
|
||||
! FLANG-LABEL: program hello
|
||||
! FLANG-NEXT: implicit none
|
||||
! FLANG-NEXT: write(*,*) 'Hello world!'
|
||||
! FLANG-NEXT:end program hello
|
||||
|
||||
! TEST 2: `-o` does not work for `flang` when multiple input files are present
|
||||
! TEST 2: `-o` does not when multiple input files are present
|
||||
! ERROR: flang-new: error: cannot specify -o when generating multiple output files
|
||||
|
||||
! TEST 3: The output file _was not_ specified - `flang_fc1` will process all
|
||||
|
@ -52,16 +52,14 @@
|
|||
! FC1-OUTPUT1-NEXT: i = 2; j = 3; i= i * j;
|
||||
! FC1-OUTPUT1-NEXT: End Program arithmetic
|
||||
|
||||
! FC1-OUTPUT2-LABEL:!This is a test file with a hello world in Fortran
|
||||
! FC1-OUTPUT2-NEXT:program hello
|
||||
! FC1-OUTPUT2-LABEL:program hello
|
||||
! FC1-OUTPUT2-NEXT: implicit none
|
||||
! FC1-OUTPUT2-NEXT: write(*,*) 'Hello world!'
|
||||
! FC1-OUTPUT2-NEXT:end program hello
|
||||
|
||||
! TEST 4: The output file _was_ specified - `flang_fc1` will process only
|
||||
! the last input file and generate the corresponding output.
|
||||
! FC1-OUTPUT3-LABEL:!This is a test file with a hello world in Fortran
|
||||
! FC1-OUTPUT3-NEXT:program hello
|
||||
! FC1-OUTPUT3-LABEL:program hello
|
||||
! FC1-OUTPUT3-NEXT: implicit none
|
||||
! FC1-OUTPUT3-NEXT: write(*,*) 'Hello world!'
|
||||
! FC1-OUTPUT3-NEXT:end program hello
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-pre-fir-tree %s | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-pre-fir-tree %s | FileCheck %s
|
||||
|
||||
! Test structure of the Pre-FIR tree
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-pre-fir-tree %s | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-pre-fir-tree %s | FileCheck %s
|
||||
|
||||
! Test Pre-FIR Tree captures all the intended nodes from the parse-tree
|
||||
! Coarray and OpenMP related nodes are tested in other files.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenmp %s | FileCheck %s
|
||||
|
||||
! Test Pre-FIR Tree captures OpenMP related constructs
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-pre-fir-tree %s | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-pre-fir-tree %s | FileCheck %s
|
||||
|
||||
! Test Pre-FIR Tree captures all the coarray related statements
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-pre-fir-tree -fopenacc %s | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenacc %s | FileCheck %s
|
||||
|
||||
! Test structure of the Pre-FIR tree with OpenACC construct
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
||||
! CHECK: init:[INTEGER(4)::1065353216_4,1073741824_4,1077936128_4,1082130432_4]
|
||||
! Verify that the closure of EQUIVALENCE'd symbols with any DATA
|
||||
! initialization produces a combined initializer.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
||||
! CHECK: Implied DO index 'j' uses an object of the same name in its bounds expressions
|
||||
! CHECK: ObjectEntity type: REAL(4) shape: 1_8:5_8 init:[REAL(4)::1._4,2._4,3._4,4._4,5._4]
|
||||
! Verify that the scope of a DATA statement implied DO loop index does
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
! RUN: %flang_fc1 -fsyntax-only -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fdebug-dump-symbols %s 2>&1 | FileCheck %s
|
||||
! Verify that the closure of EQUIVALENCE'd symbols with any DATA
|
||||
! initialization produces a combined initializer, with explicit
|
||||
! initialization overriding any default component initialization.
|
||||
|
|
|
@ -16,9 +16,9 @@ contains
|
|||
end module
|
||||
|
||||
! RUN and CHECK lines at the bottom as this test is sensitive to line numbers
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 6 17 18 %s | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 7 20 23 %s | FileCheck --check-prefix=CHECK2 %s
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 14 3 4 %s | FileCheck --check-prefix=CHECK3 %s
|
||||
! RUN: %flang_fc1 -fget-definition 6 17 18 %s | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fget-definition 7 20 23 %s | FileCheck --check-prefix=CHECK2 %s
|
||||
! RUN: %flang_fc1 -fget-definition 14 3 4 %s | FileCheck --check-prefix=CHECK3 %s
|
||||
! CHECK1: x:{{.*}}getdefinition01.f90, 5, 21-22
|
||||
! CHECK2: yyy:{{.*}}getdefinition01.f90, 5, 24-27
|
||||
! CHECK3: x:{{.*}}getdefinition01.f90, 13, 24-25
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
end module
|
||||
|
||||
! RUN and CHECK lines here as test is sensitive to line numbers
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 7 9 10 %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 8 26 29 %s 2>&1 | FileCheck --check-prefix=CHECK2 %s
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 15 9 10 %s 2>&1 | FileCheck --check-prefix=CHECK3 %s
|
||||
! RUN: %flang_fc1 -fget-definition 7 9 10 %s 2>&1 | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fget-definition 8 26 29 %s 2>&1 | FileCheck --check-prefix=CHECK2 %s
|
||||
! RUN: %flang_fc1 -fget-definition 15 9 10 %s 2>&1 | FileCheck --check-prefix=CHECK3 %s
|
||||
! CHECK1: x:{{.*}}getdefinition02.f, 5, 27-28
|
||||
! CHECK2: yyy:{{.*}}getdefinition02.f, 5, 30-33
|
||||
! CHECK3: x:{{.*}}getdefinition02.f, 14, 30-31
|
||||
|
|
|
@ -7,7 +7,7 @@ program main
|
|||
x = f
|
||||
end program
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 7 6 7 %s | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 7 2 3 %s | FileCheck --check-prefix=CHECK2 %s
|
||||
! RUN: %flang_fc1 -fget-definition 7 6 7 %s | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fget-definition 7 2 3 %s | FileCheck --check-prefix=CHECK2 %s
|
||||
! CHECK1: f:{{.*}}getdefinition03-b.f90, 2, 12-13
|
||||
! CHECK2: x:{{.*}}getdefinition03-a.f90, 6, 13-14
|
||||
|
|
|
@ -6,5 +6,5 @@ program main
|
|||
x = y
|
||||
end program
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 6 3 4 %s | FileCheck %s
|
||||
! RUN: %flang_fc1 -fget-definition 6 3 4 %s | FileCheck %s
|
||||
! CHECK: x:{{.*}}getdefinition04.f90, 3, 14-15
|
||||
|
|
|
@ -12,8 +12,8 @@ program main
|
|||
end program
|
||||
|
||||
!! Inner x
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 9 5 6 %s | FileCheck --check-prefix=CHECK1 %s
|
||||
! RUN: %flang_fc1 -fget-definition 9 5 6 %s | FileCheck --check-prefix=CHECK1 %s
|
||||
! CHECK1: x:{{.*}}getdefinition05.f90, 7, 16-17
|
||||
!! Outer y
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-definition 11 7 8 %s | FileCheck --check-prefix=CHECK2 %s
|
||||
! RUN: %flang_fc1 -fget-definition 11 7 8 %s | FileCheck --check-prefix=CHECK2 %s
|
||||
! CHECK2: y:{{.*}}getdefinition05.f90, 5, 14-15
|
||||
|
|
|
@ -15,7 +15,7 @@ contains
|
|||
end function
|
||||
end module
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! CHECK-COUNT-1:f:{{.*}}getsymbols01.f90, 12, 26-27
|
||||
! CHECK-COUNT-1:mm1:{{.*}}getsymbols01.f90, 2, 8-11
|
||||
! CHECK-COUNT-1:s:{{.*}}getsymbols01.f90, 5, 18-19
|
||||
|
|
|
@ -9,6 +9,6 @@ ENDPROGRAM
|
|||
|
||||
! RUN: %flang_fc1 -fsyntax-only %S/Inputs/getsymbols02-a.f90
|
||||
! RUN: %flang_fc1 -fsyntax-only %S/Inputs/getsymbols02-b.f90
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! CHECK: callget5: .{{[/\\]}}mm2b.mod,
|
||||
! CHECK: get5: .{{[/\\]}}mm2a.mod,
|
||||
|
|
|
@ -7,7 +7,7 @@ program main
|
|||
x = f
|
||||
end program
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! CHECK:f:{{.*}}getsymbols03-b.f90, 2, 12-13
|
||||
! CHECK:main:{{.*}}getsymbols03-a.f90, 4, 9-13
|
||||
! CHECK:mm3:{{.*}}getsymbols03-a.f90, 5, 6-9
|
||||
|
|
|
@ -6,7 +6,7 @@ program main
|
|||
x = y
|
||||
end program
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! CHECK:x:{{.*}}getsymbols04.f90, 3, 14-15
|
||||
! CHECK:x:{{.*}}getsymbols04.f90, 5, 11-12
|
||||
! CHECK:y:{{.*}}getsymbols04.f90, 4, 14-15
|
||||
|
|
|
@ -9,7 +9,7 @@ program main
|
|||
x = y
|
||||
end program
|
||||
|
||||
! RUN: %flang_fc1 -fsyntax-only -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! RUN: %flang_fc1 -fget-symbols-sources %s 2>&1 | FileCheck %s
|
||||
! CHECK:x:{{.*}}getsymbols05.f90, 3, 14-15
|
||||
! CHECK:x:{{.*}}getsymbols05.f90, 6, 16-17
|
||||
! CHECK:y:{{.*}}getsymbols05.f90, 4, 14-15
|
||||
|
|
|
@ -245,6 +245,12 @@ public:
|
|||
return getLastArg(Ids...) != nullptr;
|
||||
}
|
||||
|
||||
/// Return true if the arg list contains multiple arguments matching \p Id.
|
||||
bool hasMultipleArgs(OptSpecifier Id) const {
|
||||
auto Args = filtered(Id);
|
||||
return (Args.begin() != Args.end()) && (++Args.begin()) != Args.end();
|
||||
}
|
||||
|
||||
/// Return the last argument matching \p Id, or null.
|
||||
template<typename ...OptSpecifiers>
|
||||
Arg *getLastArg(OptSpecifiers ...Ids) const {
|
||||
|
|
Loading…
Reference in New Issue