[flang] Fix continuation when line begins with empty macro expansion (#117407)

A free form source line that begins with a macro should still be
classified as a source line, and have its continuation lines work, even
if the macro expands to an empty replacement.

Fixes https://github.com/llvm/llvm-project/issues/117297.
This commit is contained in:
Peter Klausler 2024-12-02 12:26:07 -08:00 committed by GitHub
parent 8115454aa0
commit dfbc80febb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -234,7 +234,7 @@ void Prescanner::Statement() {
directiveSentinel_ = newLineClass.sentinel;
disableSourceContinuation_ = false;
} else {
disableSourceContinuation_ =
disableSourceContinuation_ = !replaced->empty() &&
newLineClass.kind != LineClassification::Kind::Source;
}
}

View File

@ -0,0 +1,7 @@
! RUN: %flang -E %s 2>&1 | FileCheck %s
!CHECK: CALL myfunc( 'hello ' // 'world' // 'again')
#define NOCOMMENT
NOCOMMENT CALL myfunc( 'hello ' // &
NOCOMMENT 'world' // &
NOCOMMENT 'again' )
end