[flang-commits] [flang] 7c1b289 - [flang] Accept compiler directives between module subprograms (#91230)

via flang-commits flang-commits at lists.llvm.org
Thu May 9 10:29:47 PDT 2024


Author: Peter Klausler
Date: 2024-05-09T10:29:43-07:00
New Revision: 7c1b2898302c9f84fa43952f746d79817e1ead40

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

LOG: [flang] Accept compiler directives between module subprograms (#91230)

Parse and represent compiler directives in a modules
module-subprogram-part between the module subprograms.

Added: 
    

Modified: 
    flang/include/flang/Parser/parse-tree.h
    flang/lib/Parser/program-parsers.cpp

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 4641f9d20d5b9..c063544583790 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -2905,7 +2905,8 @@ struct ModuleSubprogram {
   UNION_CLASS_BOILERPLATE(ModuleSubprogram);
   std::variant<common::Indirection<FunctionSubprogram>,
       common::Indirection<SubroutineSubprogram>,
-      common::Indirection<SeparateModuleSubprogram>>
+      common::Indirection<SeparateModuleSubprogram>,
+      common::Indirection<CompilerDirective>>
       u;
 };
 

diff  --git a/flang/lib/Parser/program-parsers.cpp b/flang/lib/Parser/program-parsers.cpp
index e24559bf14f7c..ff5e58ebc721c 100644
--- a/flang/lib/Parser/program-parsers.cpp
+++ b/flang/lib/Parser/program-parsers.cpp
@@ -247,7 +247,8 @@ TYPE_CONTEXT_PARSER("module subprogram part"_en_US,
 //         separate-module-subprogram
 TYPE_PARSER(construct<ModuleSubprogram>(indirect(functionSubprogram)) ||
     construct<ModuleSubprogram>(indirect(subroutineSubprogram)) ||
-    construct<ModuleSubprogram>(indirect(Parser<SeparateModuleSubprogram>{})))
+    construct<ModuleSubprogram>(indirect(Parser<SeparateModuleSubprogram>{})) ||
+    construct<ModuleSubprogram>(indirect(compilerDirective)))
 
 // R1410 module-nature -> INTRINSIC | NON_INTRINSIC
 constexpr auto moduleNature{


        


More information about the flang-commits mailing list