File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -159,8 +159,9 @@ void Parsing::EmitPreprocessedSource(
159159 // which signifies a comment (directive) in both source forms.
160160 inDirective = true ;
161161 }
162- if (inDirective && directive.size () < directiveNameLength &&
163- IsLetter (ch)) {
162+ bool inDirectiveSentinel{
163+ inDirective && directive.size () < directiveNameLength};
164+ if (inDirectiveSentinel && IsLetter (ch)) {
164165 directive += getOriginalChar (ch);
165166 }
166167
@@ -211,7 +212,8 @@ void Parsing::EmitPreprocessedSource(
211212 out << ' ' ;
212213 }
213214 }
214- if (!inContinuation && position && position->column <= 72 && ch != ' ' ) {
215+ if (!inContinuation && !inDirectiveSentinel && position &&
216+ position->column <= 72 && ch != ' ' ) {
215217 // Preserve original indentation
216218 for (; column < position->column ; ++column) {
217219 out << ' ' ;
Original file line number Diff line number Diff line change 1- ! RUN: %flang -E -fopenmp -fopenacc %s 2>&1 | FileCheck %s
2- ! CHECK: !$OMP parallel default(shared) private(super_very_long_name_for_the_va&
3- ! CHECK: !$OMP&riable)
4- ! CHECK: !$acc data copyin(super_very_long_name_for_the_variable, another_super&
5- ! CHECK: !$acc&_wordy_variable_to_test)
6- ! Test correct continuations in compiler directives
1+ ! RUN: %flang -E -fopenmp -fopenacc %s 2>&1 | FileCheck --strict-whitespace %s
2+ ! CHECK: {{^}}!$OMP parallel default(shared) private(super_very_long_name_for_the_va&
3+ ! CHECK-NEXT: {{^}}!$OMP&riable)
4+ ! CHECK: {{^}}!$acc data copyin(super_very_long_name_for_the_variable, another_super&
5+ ! CHECK-NEXT: {{^}}!$acc&_wordy_variable_to_test)
6+ ! CHECK: {{^}}!$OMP something something
7+ ! Test correct continuations in compiler directives and left-alignment of sentinels
78subroutine foo
89 integer :: super_very_long_name_for_the_variable
910 integer :: another_super_wordy_variable_to_test
@@ -15,4 +16,6 @@ subroutine foo
1516
1617 ! $acc data copyin(super_very_long_name_for_the_variable, another_super_wordy_variable_to_test)
1718 ! $acc end data
19+
20+ ! $OMP something something
1821end subroutine foo
You can’t perform that action at this time.
0 commit comments