mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 07:01:03 +08:00
[Flang][OpenMP] Fix issue with empty critical or critical without surrounding context (#71944)
Add the sourcerange for critical directive. Fixes #65571
This commit is contained in:
committed by
GitHub
parent
12bb2910c3
commit
63a6e51f8a
@@ -1459,6 +1459,20 @@ public:
|
||||
void Post(const parser::OmpEndSectionsDirective &) {
|
||||
messageHandler().set_currStmtSource(std::nullopt);
|
||||
}
|
||||
bool Pre(const parser::OmpCriticalDirective &x) {
|
||||
AddOmpSourceRange(x.source);
|
||||
return true;
|
||||
}
|
||||
void Post(const parser::OmpCriticalDirective &) {
|
||||
messageHandler().set_currStmtSource(std::nullopt);
|
||||
}
|
||||
bool Pre(const parser::OmpEndCriticalDirective &x) {
|
||||
AddOmpSourceRange(x.source);
|
||||
return true;
|
||||
}
|
||||
void Post(const parser::OmpEndCriticalDirective &) {
|
||||
messageHandler().set_currStmtSource(std::nullopt);
|
||||
}
|
||||
};
|
||||
|
||||
bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) {
|
||||
|
||||
6
flang/test/Semantics/OpenMP/critical-empty.f90
Normal file
6
flang/test/Semantics/OpenMP/critical-empty.f90
Normal file
@@ -0,0 +1,6 @@
|
||||
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
|
||||
! Test that there are no errors for an empty critical construct
|
||||
|
||||
!$omp critical
|
||||
!$omp end critical
|
||||
end
|
||||
Reference in New Issue
Block a user