llvm-project/flang/test/Driver/get-definition.f90
Andrzej Warzynski d18a9aeae9 [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
2021-12-17 10:05:28 +00:00

47 lines
1.6 KiB
Fortran

! Verify that the driver correctly rejects invalid values for -fget-definition
!-----------
! RUN LINES
!-----------
! 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
!-----------------
! OK: String range: >m<
! OK-NOT: error
! ERROR-a: error: invalid value 'a' in 'fget-definition'
! ERROR-a-NOT: String range: >m<
! ERROR-b: error: invalid value 'b' in 'fget-definition'
! ERROR-b-NOT: String range: >m<
! ERROR-c: error: invalid value 'c' in 'fget-definition'
! ERROR-c-NOT: String range: >m<
! ERROR-ab: error: invalid value 'a' in 'fget-definition'
! ERROR-ab-NOT: String range: >m<
! ERROR-ac: error: invalid value 'a' in 'fget-definition'
! ERROR-ac-NOT: String range: >m<
! ERROR-bc: error: invalid value 'b' in 'fget-definition'
! ERROR-bc-NOT: String range: >m<
! ERROR-abc: error: invalid value 'a' in 'fget-definition'
! ERROR-abc-NOT: String range: >m<
!-------
! INPUT
!-------
module m
end module