mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[Flang] Nested directives are comments (#166348)
Directives cannot be nested. A directive sentinel that appears within another directive should be ignored, and instead fall back to be treated as a line comment. Fixes: #165874
This commit is contained in:
@@ -557,7 +557,7 @@ bool Prescanner::MustSkipToEndOfLine() const {
|
||||
return true; // skip over ignored columns in right margin (73:80)
|
||||
} else if (*at_ == '!' && !inCharLiteral_ &&
|
||||
(!inFixedForm_ || tabInCurrentLine_ || column_ != 6)) {
|
||||
return !IsCompilerDirectiveSentinel(at_ + 1);
|
||||
return InCompilerDirective() || !IsCompilerDirectiveSentinel(at_ + 1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
7
flang/test/Parser/OpenMP/nested-directive.f90
Normal file
7
flang/test/Parser/OpenMP/nested-directive.f90
Normal file
@@ -0,0 +1,7 @@
|
||||
! RUN: %flang_fc1 -fdebug-unparse -fopenmp %s 2>&1 | FileCheck %s --match-full-lines
|
||||
|
||||
subroutine func
|
||||
implicit none
|
||||
! CHECK: !$OMP NOTHING
|
||||
!$omp nothing !$omp Cannot nest directives inside directives; must be interpreted as a comment
|
||||
end subroutine func
|
||||
Reference in New Issue
Block a user