diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -107,6 +107,15 @@ // By default the frontend driver creates a ParseSyntaxOnly action. opts.programAction = ParseSyntaxOnly; + // Treat multiple action options as an invocation error. Note that + // `clang -cc1` behaves differently here. + 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)) { diff --git a/flang/test/Driver/debug-measure-parse-tree.f90 b/flang/test/Driver/debug-measure-parse-tree.f90 --- a/flang/test/Driver/debug-measure-parse-tree.f90 +++ b/flang/test/Driver/debug-measure-parse-tree.f90 @@ -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 diff --git a/flang/test/Driver/get-definition.f90 b/flang/test/Driver/get-definition.f90 --- a/flang/test/Driver/get-definition.f90 +++ b/flang/test/Driver/get-definition.f90 @@ -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 diff --git a/flang/test/Driver/multiple-actions-error.f95 b/flang/test/Driver/multiple-actions-error.f95 new file mode 100644 --- /dev/null +++ b/flang/test/Driver/multiple-actions-error.f95 @@ -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 diff --git a/flang/test/Driver/werror-parse.f b/flang/test/Driver/werror-parse.f --- a/flang/test/Driver/werror-parse.f +++ b/flang/test/Driver/werror-parse.f @@ -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 diff --git a/flang/test/Driver/werror-scan.f b/flang/test/Driver/werror-scan.f --- a/flang/test/Driver/werror-scan.f +++ b/flang/test/Driver/werror-scan.f @@ -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 diff --git a/flang/test/Driver/werror-sema.f90 b/flang/test/Driver/werror-sema.f90 --- a/flang/test/Driver/werror-sema.f90 +++ b/flang/test/Driver/werror-sema.f90 @@ -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 diff --git a/flang/test/Frontend/input-output-file.f90 b/flang/test/Frontend/input-output-file.f90 --- a/flang/test/Frontend/input-output-file.f90 +++ b/flang/test/Frontend/input-output-file.f90 @@ -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) diff --git a/flang/test/Frontend/multiple-input-files.f90 b/flang/test/Frontend/multiple-input-files.f90 --- a/flang/test/Frontend/multiple-input-files.f90 +++ b/flang/test/Frontend/multiple-input-files.f90 @@ -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,8 +36,8 @@ ! 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: program hello ! FLANG-NEXT: implicit none ! FLANG-NEXT: write(*,*) 'Hello world!' ! FLANG-NEXT:end program hello diff --git a/flang/test/Lower/pre-fir-tree01.f90 b/flang/test/Lower/pre-fir-tree01.f90 --- a/flang/test/Lower/pre-fir-tree01.f90 +++ b/flang/test/Lower/pre-fir-tree01.f90 @@ -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 diff --git a/flang/test/Lower/pre-fir-tree02.f90 b/flang/test/Lower/pre-fir-tree02.f90 --- a/flang/test/Lower/pre-fir-tree02.f90 +++ b/flang/test/Lower/pre-fir-tree02.f90 @@ -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. diff --git a/flang/test/Lower/pre-fir-tree03.f90 b/flang/test/Lower/pre-fir-tree03.f90 --- a/flang/test/Lower/pre-fir-tree03.f90 +++ b/flang/test/Lower/pre-fir-tree03.f90 @@ -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 diff --git a/flang/test/Lower/pre-fir-tree04.f90 b/flang/test/Lower/pre-fir-tree04.f90 --- a/flang/test/Lower/pre-fir-tree04.f90 +++ b/flang/test/Lower/pre-fir-tree04.f90 @@ -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 diff --git a/flang/test/Lower/pre-fir-tree05.f90 b/flang/test/Lower/pre-fir-tree05.f90 --- a/flang/test/Lower/pre-fir-tree05.f90 +++ b/flang/test/Lower/pre-fir-tree05.f90 @@ -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 diff --git a/flang/test/Semantics/data09.f90 b/flang/test/Semantics/data09.f90 --- a/flang/test/Semantics/data09.f90 +++ b/flang/test/Semantics/data09.f90 @@ -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. diff --git a/flang/test/Semantics/data11.f90 b/flang/test/Semantics/data11.f90 --- a/flang/test/Semantics/data11.f90 +++ b/flang/test/Semantics/data11.f90 @@ -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 diff --git a/flang/test/Semantics/data13.f90 b/flang/test/Semantics/data13.f90 --- a/flang/test/Semantics/data13.f90 +++ b/flang/test/Semantics/data13.f90 @@ -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. diff --git a/flang/test/Semantics/getdefinition01.f90 b/flang/test/Semantics/getdefinition01.f90 --- a/flang/test/Semantics/getdefinition01.f90 +++ b/flang/test/Semantics/getdefinition01.f90 @@ -16,9 +16,9 @@ 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 diff --git a/flang/test/Semantics/getdefinition02.f b/flang/test/Semantics/getdefinition02.f --- a/flang/test/Semantics/getdefinition02.f +++ b/flang/test/Semantics/getdefinition02.f @@ -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 diff --git a/flang/test/Semantics/getdefinition03-a.f90 b/flang/test/Semantics/getdefinition03-a.f90 --- a/flang/test/Semantics/getdefinition03-a.f90 +++ b/flang/test/Semantics/getdefinition03-a.f90 @@ -7,7 +7,7 @@ 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 diff --git a/flang/test/Semantics/getdefinition04.f90 b/flang/test/Semantics/getdefinition04.f90 --- a/flang/test/Semantics/getdefinition04.f90 +++ b/flang/test/Semantics/getdefinition04.f90 @@ -6,5 +6,5 @@ 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 diff --git a/flang/test/Semantics/getdefinition05.f90 b/flang/test/Semantics/getdefinition05.f90 --- a/flang/test/Semantics/getdefinition05.f90 +++ b/flang/test/Semantics/getdefinition05.f90 @@ -12,8 +12,8 @@ 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 diff --git a/flang/test/Semantics/getsymbols01.f90 b/flang/test/Semantics/getsymbols01.f90 --- a/flang/test/Semantics/getsymbols01.f90 +++ b/flang/test/Semantics/getsymbols01.f90 @@ -15,7 +15,7 @@ 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 diff --git a/flang/test/Semantics/getsymbols02.f90 b/flang/test/Semantics/getsymbols02.f90 --- a/flang/test/Semantics/getsymbols02.f90 +++ b/flang/test/Semantics/getsymbols02.f90 @@ -9,6 +9,6 @@ ! 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, diff --git a/flang/test/Semantics/getsymbols03-a.f90 b/flang/test/Semantics/getsymbols03-a.f90 --- a/flang/test/Semantics/getsymbols03-a.f90 +++ b/flang/test/Semantics/getsymbols03-a.f90 @@ -7,7 +7,7 @@ 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 diff --git a/flang/test/Semantics/getsymbols04.f90 b/flang/test/Semantics/getsymbols04.f90 --- a/flang/test/Semantics/getsymbols04.f90 +++ b/flang/test/Semantics/getsymbols04.f90 @@ -6,7 +6,7 @@ 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 diff --git a/flang/test/Semantics/getsymbols05.f90 b/flang/test/Semantics/getsymbols05.f90 --- a/flang/test/Semantics/getsymbols05.f90 +++ b/flang/test/Semantics/getsymbols05.f90 @@ -9,7 +9,7 @@ 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 diff --git a/llvm/include/llvm/Option/ArgList.h b/llvm/include/llvm/Option/ArgList.h --- a/llvm/include/llvm/Option/ArgList.h +++ b/llvm/include/llvm/Option/ArgList.h @@ -245,6 +245,12 @@ 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 Arg *getLastArg(OptSpecifiers ...Ids) const {