[PATCH] D84077: [flang] Support <name>=<integer> syntax in compiler directives
Peter Klausler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 17:06:38 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e2b4e50f270: [flang] Support <name>=<integer> syntax in compiler directives (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84077/new/
https://reviews.llvm.org/D84077
Files:
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Parser/Fortran-parsers.cpp
flang/lib/Parser/unparse.cpp
Index: flang/lib/Parser/unparse.cpp
===================================================================
--- flang/lib/Parser/unparse.cpp
+++ flang/lib/Parser/unparse.cpp
@@ -1761,7 +1761,9 @@
Word("!DIR$ IGNORE_TKR"); // emitted even if tkr list is empty
Walk(" ", tkr, ", ");
},
- [&](const std::list<Name> &names) { Walk("!DIR$ ", names, " "); },
+ [&](const std::list<CompilerDirective::NameValue> &names) {
+ Walk("!DIR$ ", names, " ");
+ },
},
x.u);
Put('\n');
@@ -1777,6 +1779,10 @@
}
Walk(std::get<Name>(x.t));
}
+ void Unparse(const CompilerDirective::NameValue &x) {
+ Walk(std::get<Name>(x.t));
+ Walk("=", std::get<std::optional<std::uint64_t>>(x.t));
+ }
// OpenACC Directives & Clauses
void Unparse(const AccAtomicCapture &x) {
Index: flang/lib/Parser/Fortran-parsers.cpp
===================================================================
--- flang/lib/Parser/Fortran-parsers.cpp
+++ flang/lib/Parser/Fortran-parsers.cpp
@@ -1173,7 +1173,9 @@
defaulted(parenthesized(some("tkr"_ch))), name))};
TYPE_PARSER(
beginDirective >> sourced(construct<CompilerDirective>(ignore_tkr) ||
- construct<CompilerDirective>("DIR$" >> many(name))) /
+ construct<CompilerDirective>("DIR$" >>
+ many(construct<CompilerDirective::NameValue>(
+ name, maybe("=" >> digitString64))))) /
endDirective)
TYPE_PARSER(extension<LanguageFeature::CrayPointer>(construct<BasedPointerStmt>(
Index: flang/include/flang/Parser/parse-tree.h
===================================================================
--- flang/include/flang/Parser/parse-tree.h
+++ flang/include/flang/Parser/parse-tree.h
@@ -3211,8 +3211,12 @@
TUPLE_CLASS_BOILERPLATE(IgnoreTKR);
std::tuple<std::list<const char *>, Name> t;
};
+ struct NameValue {
+ TUPLE_CLASS_BOILERPLATE(NameValue);
+ std::tuple<Name, std::optional<std::uint64_t>> t;
+ };
CharBlock source;
- std::variant<std::list<IgnoreTKR>, std::list<Name>> u;
+ std::variant<std::list<IgnoreTKR>, std::list<NameValue>> u;
};
// Legacy extensions
Index: flang/include/flang/Parser/dump-parse-tree.h
===================================================================
--- flang/include/flang/Parser/dump-parse-tree.h
+++ flang/include/flang/Parser/dump-parse-tree.h
@@ -222,6 +222,7 @@
NODE(CommonStmt, Block)
NODE(parser, CompilerDirective)
NODE(CompilerDirective, IgnoreTKR)
+ NODE(CompilerDirective, NameValue)
NODE(parser, ComplexLiteralConstant)
NODE(parser, ComplexPart)
NODE(parser, ComponentArraySpec)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84077.278938.patch
Type: text/x-patch
Size: 2772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200718/42e6d587/attachment.bin>
More information about the llvm-commits
mailing list