[flang-commits] [flang] 24b03d3 - [flang][OpenMP] Move helper functions further up the file, NFC (#159803)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 19 09:14:01 PDT 2025


Author: Krzysztof Parzyszek
Date: 2025-09-19T11:13:57-05:00
New Revision: 24b03d3217e41536cee7c868860b5930160ad526

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

LOG: [flang][OpenMP] Move helper functions further up the file, NFC (#159803)

Move them to before any potential users.

Added: 
    

Modified: 
    flang/lib/Parser/openmp-parsers.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/openmp-parsers.cpp b/flang/lib/Parser/openmp-parsers.cpp
index a8f2f0056fe4a..8ab9905123135 100644
--- a/flang/lib/Parser/openmp-parsers.cpp
+++ b/flang/lib/Parser/openmp-parsers.cpp
@@ -1281,6 +1281,16 @@ TYPE_PARSER(sourced(construct<OmpErrorDirective>(
 
 // --- Parsers for directives and constructs --------------------------
 
+static inline constexpr auto IsDirective(llvm::omp::Directive dir) {
+  return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; };
+}
+
+static inline constexpr auto IsMemberOf(const DirectiveSet &dirs) {
+  return [&dirs](const OmpDirectiveName &name) -> bool {
+    return dirs.test(llvm::to_underlying(name.v));
+  };
+}
+
 TYPE_PARSER(sourced(construct<OmpDirectiveName>(OmpDirectiveNameParser{})))
 
 OmpDirectiveSpecification static makeFlushFromOldSyntax(Verbatim &&text,
@@ -1366,16 +1376,6 @@ TYPE_PARSER(sourced(construct<OpenMPUtilityConstruct>(
 TYPE_PARSER(sourced(construct<OmpMetadirectiveDirective>(
     verbatim("METADIRECTIVE"_tok), Parser<OmpClauseList>{})))
 
-static inline constexpr auto IsDirective(llvm::omp::Directive dir) {
-  return [dir](const OmpDirectiveName &name) -> bool { return dir == name.v; };
-}
-
-static inline constexpr auto IsMemberOf(const DirectiveSet &dirs) {
-  return [&dirs](const OmpDirectiveName &name) -> bool {
-    return dirs.test(llvm::to_underlying(name.v));
-  };
-}
-
 struct OmpBeginDirectiveParser {
   using resultType = OmpDirectiveSpecification;
 


        


More information about the flang-commits mailing list