Skip to content

Commit e35a0cf

Browse files
committed
Emit a clearer error message
1 parent c7de904 commit e35a0cf

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,9 +2430,9 @@ void OmpStructureChecker::Enter(
24302430
// Do not call CheckAllowed/CheckAllowedClause, because in case of an error
24312431
// it will print "CANCELLATION_CONSTRUCT_TYPE" as the clause name instead
24322432
// of the contained construct name.
2433-
context_.Say(dirName.source,
2434-
"Cancellation construct type is not allowed on %s"_err_en_US,
2435-
parser::ToUpperCaseLetters(getDirectiveName(dir).str()));
2433+
context_.Say(dirName.source, "%s cannot follow %s"_err_en_US,
2434+
parser::ToUpperCaseLetters(getDirectiveName(dirName.v)),
2435+
parser::ToUpperCaseLetters(getDirectiveName(dir)));
24362436
} else {
24372437
switch (dirName.v) {
24382438
case llvm::omp::Directive::OMPD_do:
@@ -2443,7 +2443,7 @@ void OmpStructureChecker::Enter(
24432443
default:
24442444
context_.Say(dirName.source,
24452445
"%s is not a cancellable construct"_err_en_US,
2446-
parser::ToUpperCaseLetters(getDirectiveName(dirName.v).str()));
2446+
parser::ToUpperCaseLetters(getDirectiveName(dirName.v)));
24472447
break;
24482448
}
24492449
}

flang/test/Semantics/OpenMP/cancellation-construct-type.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
subroutine f(x)
44
integer :: x
5-
!ERROR: Cancellation construct type is not allowed on SECTIONS
5+
!ERROR: PARALLEL cannot follow SECTIONS
66
!$omp sections parallel
77
!$omp section
88
x = x + 1

0 commit comments

Comments
 (0)