Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flang/lib/Parser/prescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,9 @@ bool Prescanner::NextToken(TokenSequence &tokens) {
if (InFixedFormSource()) {
SkipSpaces();
}
if (inFixedForm_ && (IsOpenMPDirective() && parenthesisNesting_ > 0)) {
SkipSpaces();
}
if ((*at_ == '\'' || *at_ == '"') &&
tokens.CharAt(tokens.SizeInChars() - 1) == '_') { // kind_"..."
QuotedCharacterLiteral(tokens, start);
Expand Down
3 changes: 3 additions & 0 deletions flang/lib/Parser/prescan.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ class Prescanner {
bool InConditionalLine() const {
return InOpenMPConditionalLine() || InOpenACCOrCUDAConditionalLine();
}
bool IsOpenMPDirective() const {
return directiveSentinel_ && std::strcmp(directiveSentinel_, "$omp") == 0;
}
bool InFixedFormSource() const {
return inFixedForm_ && !inPreprocessorDirective_ && !InCompilerDirective();
}
Expand Down
15 changes: 15 additions & 0 deletions flang/test/Parser/OpenMP/name-with-space.f
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
! RUN: %flang_fc1 -fopenmp -fdebug-unparse-no-sema %s 2>&1 | FileCheck %s

program name_with_space
!CHECK: !$OMP THREADPRIVATE(/cc/, var1)
!$omp threadprivate(/c c/, var 1)

!CHECK: !$OMP PARALLEL PRIVATE(somevar,expr1,expr2) IF(expr2>expr1)
!$omp parallel private(some var, expr 1, ex pr2)
!$omp+ if (exp r2 > ex pr1)
!$omp critical (x_x)
print '(a)', 'Hello World'
!CHECK: !$OMP END CRITICAL(x_x)
!$omp end critical (x _x)
!$omp end parallel
end program name_with_space
Loading