[flang-commits] [flang] [flang][OpenACC] Relax COMMON block usage restriction in OpenACC directives (PR #162659)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Thu Oct 16 13:05:47 PDT 2025
================
@@ -189,7 +189,29 @@ class Scope {
mapType &commonBlocks() { return commonBlocks_; }
const mapType &commonBlocks() const { return commonBlocks_; }
Symbol &MakeCommonBlock(SourceName, SourceName location);
- Symbol *FindCommonBlock(const SourceName &) const;
+ bool AddCommonBlockUse(const SourceName &name, Symbol &cbSymbol);
+ mapType &commonBlockUses() { return commonBlockUses_; }
+
+ // Find COMMON block that is not USE-associated in the current scope
+ Symbol *FindCommonBlock(const SourceName &name) const {
+ if (const auto it{commonBlocks_.find(name)}; it != commonBlocks_.end()) {
+ return &*it->second;
+ }
+ return nullptr;
+ }
+
+ // Find USE-associated COMMON block in the current scope
+ Symbol *FindCommonBlockUse(const SourceName &name) const {
+ if (const auto it{commonBlockUses_.find(name)};
+ it != commonBlockUses_.end()) {
+ return &*it->second;
+ }
+ return nullptr;
+ }
+
+ // Find COMMON block in current and surrounding scopes, follow USE
+ // associations
+ Symbol *FindCommonBlockInSurroundingScopes(const SourceName &) const;
----------------
klausler wrote:
The name isn't consistent with the comment; will this member function detect a common block in this scope, or only in its parents?
https://github.com/llvm/llvm-project/pull/162659
More information about the flang-commits
mailing list