[flang-commits] [PATCH] D89017: [flang] Allow "name: value" in compiler directives

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Oct 7 16:09:24 PDT 2020


klausler created this revision.
klausler added a reviewer: PeteSteinfeld.
klausler added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
klausler requested review of this revision.

Some legacy compiler directives use colons rather than
equals signs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89017

Files:
  flang/lib/Parser/Fortran-parsers.cpp
  flang/test/Parser/compiler-directives.f90


Index: flang/test/Parser/compiler-directives.f90
===================================================================
--- flang/test/Parser/compiler-directives.f90
+++ flang/test/Parser/compiler-directives.f90
@@ -9,4 +9,8 @@
   !dir$ integer
   implicit integer(a-z)
   !dir$ integer
+  !dir$ integer=64
+  !dir$ integer = 64
+  !dir$ optimize:1
+  !dir$ optimize : 1
 end
Index: flang/lib/Parser/Fortran-parsers.cpp
===================================================================
--- flang/lib/Parser/Fortran-parsers.cpp
+++ flang/lib/Parser/Fortran-parsers.cpp
@@ -1172,11 +1172,11 @@
 constexpr auto ignore_tkr{
     "DIR$ IGNORE_TKR" >> optionalList(construct<CompilerDirective::IgnoreTKR>(
                              defaulted(parenthesized(some("tkr"_ch))), name))};
-TYPE_PARSER(
-    beginDirective >> sourced(construct<CompilerDirective>(ignore_tkr) ||
-                          construct<CompilerDirective>("DIR$" >>
-                              many(construct<CompilerDirective::NameValue>(
-                                  name, maybe("=" >> digitString64))))) /
+TYPE_PARSER(beginDirective >>
+    sourced(construct<CompilerDirective>(ignore_tkr) ||
+        construct<CompilerDirective>(
+            "DIR$" >> many(construct<CompilerDirective::NameValue>(name,
+                          maybe(("="_tok || ":"_tok) >> digitString64))))) /
         endDirective)
 
 TYPE_PARSER(extension<LanguageFeature::CrayPointer>(construct<BasedPointerStmt>(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89017.296824.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201007/5c57fd43/attachment-0001.bin>


More information about the flang-commits mailing list