[flang-commits] [flang] e2e7d56 - [flang][OpenMP] Make Symbol::OmpFlagToClauseName static (#113586)

via flang-commits flang-commits at lists.llvm.org
Thu Oct 24 10:10:22 PDT 2024


Author: Krzysztof Parzyszek
Date: 2024-10-24T12:10:18-05:00
New Revision: e2e7d565bf7228b5c4994257950c64d419cc8f03

URL: https://github.com/llvm/llvm-project/commit/e2e7d565bf7228b5c4994257950c64d419cc8f03
DIFF: https://github.com/llvm/llvm-project/commit/e2e7d565bf7228b5c4994257950c64d419cc8f03.diff

LOG: [flang][OpenMP] Make Symbol::OmpFlagToClauseName static (#113586)

It doesn't need the Symbol object for anything.

Added: 
    

Modified: 
    flang/include/flang/Semantics/symbol.h
    flang/lib/Semantics/resolve-directives.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h
index cf0350735b5b94..0767d8ea84bc6b 100644
--- a/flang/include/flang/Semantics/symbol.h
+++ b/flang/include/flang/Semantics/symbol.h
@@ -778,7 +778,7 @@ class Symbol {
   void set_offset(std::size_t offset) { offset_ = offset; }
   // Give the symbol a name with a 
diff erent source location but same chars.
   void ReplaceName(const SourceName &);
-  std::string OmpFlagToClauseName(Flag ompFlag);
+  static std::string OmpFlagToClauseName(Flag ompFlag);
 
   // Does symbol have this type of details?
   template <typename D> bool has() const {

diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 490d802cddf42f..33936ba4c2b34f 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2320,7 +2320,7 @@ void OmpAttributeVisitor::ResolveOmpObject(
               if (auto *symbol{ResolveOmp(*name, ompFlag, currScope())}) {
                 auto checkExclusivelists =
                     [&](const Symbol *symbol1, Symbol::Flag firstOmpFlag,
-                        Symbol *symbol2, Symbol::Flag secondOmpFlag) {
+                        const Symbol *symbol2, Symbol::Flag secondOmpFlag) {
                       if ((symbol1->test(firstOmpFlag) &&
                               symbol2->test(secondOmpFlag)) ||
                           (symbol1->test(secondOmpFlag) &&
@@ -2330,9 +2330,8 @@ void OmpAttributeVisitor::ResolveOmpObject(
                             "appear on both %s and %s "
                             "clauses on a %s construct"_err_en_US,
                             symbol2->name(),
-                            const_cast<Symbol *>(symbol1)->OmpFlagToClauseName(
-                                firstOmpFlag),
-                            symbol2->OmpFlagToClauseName(secondOmpFlag),
+                            Symbol::OmpFlagToClauseName(firstOmpFlag),
+                            Symbol::OmpFlagToClauseName(secondOmpFlag),
                             parser::ToUpperCaseLetters(
                                 llvm::omp::getOpenMPDirectiveName(
                                     GetContext().directive)


        


More information about the flang-commits mailing list