[flang-commits] [flang] [flang] Accept compiler directives between module subprograms (PR #91230)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon May 6 08:46:54 PDT 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/91230
Parse and represent compiler directives in a modules module-subprogram-part between the module subprograms.
>From e79c13b815c3fe81482c0e074a0c003441477bef Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Mon, 6 May 2024 08:44:57 -0700
Subject: [PATCH] [flang] Accept compiler directives between module subprograms
Parse and represent compiler directives in a modules module-subprogram-part
between the module subprograms.
---
flang/include/flang/Parser/parse-tree.h | 3 ++-
flang/lib/Parser/program-parsers.cpp | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 4641f9d20d5b956..c06354458379040 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 e24559bf14f7c92..ff5e58ebc721c5c 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