[flang-commits] [flang] d18a9ae - [flang] Make the frontend driver error out when requesting multiple actions
Andrzej Warzynski via flang-commits
flang-commits at lists.llvm.org
Fri Dec 17 02:10:54 PST 2021
Author: Andrzej Warzynski
Date: 2021-12-17T10:05:28Z
New Revision: d18a9aeae9e6b7514186188ba71d1d9b6956fe16
URL: https://github.com/llvm/llvm-project/commit/d18a9aeae9e6b7514186188ba71d1d9b6956fe16
DIFF: https://github.com/llvm/llvm-project/commit/d18a9aeae9e6b7514186188ba71d1d9b6956fe16.diff
LOG: [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
Added:
flang/test/Driver/multiple-actions-error.f95
Modified:
flang/lib/Frontend/CompilerInvocation.cpp
flang/test/Driver/debug-measure-parse-tree.f90
flang/test/Driver/get-definition.f90
flang/test/Driver/werror-parse.f
flang/test/Driver/werror-scan.f
flang/test/Driver/werror-sema.f90
flang/test/Frontend/input-output-file.f90
flang/test/Frontend/multiple-input-files.f90
flang/test/Lower/pre-fir-tree01.f90
flang/test/Lower/pre-fir-tree02.f90
flang/test/Lower/pre-fir-tree03.f90
flang/test/Lower/pre-fir-tree04.f90
flang/test/Lower/pre-fir-tree05.f90
flang/test/Semantics/data09.f90
flang/test/Semantics/data11.f90
flang/test/Semantics/data13.f90
flang/test/Semantics/getdefinition01.f90
flang/test/Semantics/getdefinition02.f
flang/test/Semantics/getdefinition03-a.f90
flang/test/Semantics/getdefinition04.f90
flang/test/Semantics/getdefinition05.f90
flang/test/Semantics/getsymbols01.f90
flang/test/Semantics/getsymbols02.f90
flang/test/Semantics/getsymbols03-a.f90
flang/test/Semantics/getsymbols04.f90
flang/test/Semantics/getsymbols05.f90
llvm/include/llvm/Option/ArgList.h
Removed:
################################################################################
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index acdfcb804390a..159c5632c0e48 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -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)) {
diff --git a/flang/test/Driver/debug-measure-parse-tree.f90 b/flang/test/Driver/debug-measure-parse-tree.f90
index 5a7e0898a5f34..3599acc40ef34 100644
--- 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
index 5e6d5ff2345fe..f8cf92692049d 100644
--- 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
index 0000000000000..5ec4e9166657f
--- /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
index f5425f5306dc4..466799c0b66e4 100644
--- 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
index 8643635069da1..deb7967e3cb7e 100644
--- 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
index 1a7b6cc47ff68..f6cd167afa3d9 100644
--- 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
index e68041f664781..d7aaac7d7f306 100644
--- 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
index 977fea2d6b3e6..95cea4f450ab5 100644
--- 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,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
diff --git a/flang/test/Lower/pre-fir-tree01.f90 b/flang/test/Lower/pre-fir-tree01.f90
index 707dbc1a86b5b..ba26510d58f03 100644
--- 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
index 6f64b60b23ef5..5692505a9bdb7 100644
--- 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
index 19cf098320920..313dab4d6ec7c 100644
--- 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
index f7256f700a269..a04bf14c3a5fd 100644
--- 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
index 9096e38423850..0e4576cf7c14d 100644
--- 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
index a6f5865399d55..6f904b12f5ff0 100644
--- 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
index 213b92bc628a7..df36abf12ebd5 100644
--- 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
index 4d7ecf9939e07..75e572e0dbc2f 100644
--- 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
index b5149e84f6e36..486672370bb78 100644
--- a/flang/test/Semantics/getdefinition01.f90
+++ b/flang/test/Semantics/getdefinition01.f90
@@ -16,9 +16,9 @@ recursive pure function f() result(x)
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
index 29f13ef1b5099..223f247c9d516 100644
--- a/flang/test/Semantics/getdefinition02.f
+++ b/flang/test/Semantics/getdefinition02.f
@@ -17,9 +17,9 @@ recursive pure function f() result(x)
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
index 3c0ba61c1f793..dd9d4cd9d8a68 100644
--- a/flang/test/Semantics/getdefinition03-a.f90
+++ b/flang/test/Semantics/getdefinition03-a.f90
@@ -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
diff --git a/flang/test/Semantics/getdefinition04.f90 b/flang/test/Semantics/getdefinition04.f90
index 6084f69e7fe1a..877d340f640f7 100644
--- a/flang/test/Semantics/getdefinition04.f90
+++ b/flang/test/Semantics/getdefinition04.f90
@@ -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
diff --git a/flang/test/Semantics/getdefinition05.f90 b/flang/test/Semantics/getdefinition05.f90
index 74e3d71b6a279..c504711dc31cd 100644
--- a/flang/test/Semantics/getdefinition05.f90
+++ b/flang/test/Semantics/getdefinition05.f90
@@ -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
diff --git a/flang/test/Semantics/getsymbols01.f90 b/flang/test/Semantics/getsymbols01.f90
index 9a52ee7cbf2ab..1a1851e83c114 100644
--- a/flang/test/Semantics/getsymbols01.f90
+++ b/flang/test/Semantics/getsymbols01.f90
@@ -15,7 +15,7 @@ recursive pure function f() result(x)
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
index 32929904fb7a4..25a4c30809fb2 100644
--- a/flang/test/Semantics/getsymbols02.f90
+++ b/flang/test/Semantics/getsymbols02.f90
@@ -9,6 +9,6 @@ PROGRAM helloworld
! 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
index 0bc19b4fe8d08..95b7fb418367d 100644
--- a/flang/test/Semantics/getsymbols03-a.f90
+++ b/flang/test/Semantics/getsymbols03-a.f90
@@ -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
diff --git a/flang/test/Semantics/getsymbols04.f90 b/flang/test/Semantics/getsymbols04.f90
index 28027ea759b64..478b662623efe 100644
--- a/flang/test/Semantics/getsymbols04.f90
+++ b/flang/test/Semantics/getsymbols04.f90
@@ -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
diff --git a/flang/test/Semantics/getsymbols05.f90 b/flang/test/Semantics/getsymbols05.f90
index 99771e227c3fe..2da46f0d86053 100644
--- a/flang/test/Semantics/getsymbols05.f90
+++ b/flang/test/Semantics/getsymbols05.f90
@@ -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
diff --git a/llvm/include/llvm/Option/ArgList.h b/llvm/include/llvm/Option/ArgList.h
index f6abf2a62aa53..74897de52a935 100644
--- a/llvm/include/llvm/Option/ArgList.h
+++ b/llvm/include/llvm/Option/ArgList.h
@@ -245,6 +245,12 @@ class ArgList {
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 {
More information about the flang-commits
mailing list