[flang-commits] [flang] [Flang][OpenMP] Fix issue with empty critical or critical without surrounding context (PR #71944)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Fri Nov 10 06:13:13 PST 2023
https://github.com/kiranchandramohan created https://github.com/llvm/llvm-project/pull/71944
Add the sourcerange for critical directive.
Fixes #65571
>From 4740fe15c629e30e86de8d5be322920efc6e1db6 Mon Sep 17 00:00:00 2001
From: Kiran Chandramohan <kiran.chandramohan at arm.com>
Date: Fri, 10 Nov 2023 13:02:15 +0000
Subject: [PATCH] [Flang][OpenMP] Fix issue with empty critical section
Add the sourcerange for critical directive.
Fixes #65571
---
flang/lib/Semantics/resolve-names.cpp | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 98773a1b9d6ab45..58d88f1bb428387 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1452,6 +1452,20 @@ class OmpVisitor : public virtual DeclarationVisitor {
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) {
More information about the flang-commits
mailing list