aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/mod-file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r--flang/lib/Semantics/mod-file.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index 7b15ce5..4822673 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -331,9 +331,6 @@ void ModFileWriter::PutSymbol(
[&](const auto &) {
PutEntity(decls_, symbol);
PutDirective(decls_, symbol);
- if (symbol.test(Symbol::Flag::OmpThreadprivate)) {
- decls_ << "!$omp threadprivate(" << symbol.name() << ")\n";
- }
},
},
symbol.details());
@@ -875,7 +872,7 @@ llvm::raw_ostream &PutLower(llvm::raw_ostream &os, std::string_view str) {
return os;
}
-void ModFileWriter::PutDirective(llvm::raw_ostream &os, const Symbol &symbol) {
+void PutOpenACCDirective(llvm::raw_ostream &os, const Symbol &symbol) {
if (symbol.test(Symbol::Flag::AccDeclare)) {
os << "!$acc declare ";
if (symbol.test(Symbol::Flag::AccCopy)) {
@@ -899,6 +896,17 @@ void ModFileWriter::PutDirective(llvm::raw_ostream &os, const Symbol &symbol) {
}
}
+void PutOpenMPDirective(llvm::raw_ostream &os, const Symbol &symbol) {
+ if (symbol.test(Symbol::Flag::OmpThreadprivate)) {
+ os << "!$omp threadprivate(" << symbol.name() << ")\n";
+ }
+}
+
+void ModFileWriter::PutDirective(llvm::raw_ostream &os, const Symbol &symbol) {
+ PutOpenACCDirective(os, symbol);
+ PutOpenMPDirective(os, symbol);
+}
+
struct Temp {
Temp(int fd, std::string path) : fd{fd}, path{path} {}
Temp(Temp &&t) : fd{std::exchange(t.fd, -1)}, path{std::move(t.path)} {}