If a line is over 72 characters long, flang's preprocessor cuts it there and continues on the next line. For this purpose it uses the standard way of continuing line with & on each line. However, it doesn't work with long compiler directives, like OpenMP or OpenACC ones. The line that continues the directive also has to contain the corresponding sentinel at the beginning. This change implements the described functionality. Also, some code was refactored in order to simplify and reuse existing code. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D126301
15 lines
1.1 KiB
Fortran
15 lines
1.1 KiB
Fortran
! RUN: %flang -E %s 2>&1 | FileCheck %s
|
|
! CHECK: character(*), parameter :: simple_literal = "!!!!!!!!!!!!!!!!!!!!!&
|
|
! CHECK: &!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&
|
|
! CHECK: &!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&
|
|
! CHECK: &!!!!!!!!!!!!!"
|
|
! CHECK: character(*), parameter :: hollerith_literal = 166H!!!!!!!!!!!!!!!&
|
|
! CHECK: &!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&
|
|
! CHECK: &!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!&
|
|
! CHECK: &!!!!!!!!!!!!!!!!!!!
|
|
! Test correct continuations in string literals
|
|
subroutine foo
|
|
character(*), parameter :: simple_literal = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
character(*), parameter :: hollerith_literal = 166H!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
end subroutine foo
|