Skip to content

Commit dfbc80f

Browse files
authored
[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 #117297.
1 parent 8115454 commit dfbc80f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

flang/lib/Parser/prescan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void Prescanner::Statement() {
234234
directiveSentinel_ = newLineClass.sentinel;
235235
disableSourceContinuation_ = false;
236236
} else {
237-
disableSourceContinuation_ =
237+
disableSourceContinuation_ = !replaced->empty() &&
238238
newLineClass.kind != LineClassification::Kind::Source;
239239
}
240240
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
! RUN: %flang -E %s 2>&1 | FileCheck %s
2+
!CHECK: CALL myfunc( 'hello ' // 'world' // 'again')
3+
#define NOCOMMENT
4+
NOCOMMENT CALL myfunc( 'hello ' // &
5+
NOCOMMENT 'world' // &
6+
NOCOMMENT 'again' )
7+
end

0 commit comments

Comments
 (0)