[flang-commits] [flang] [flang] Allow continuation of D lines (PR #66242)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Sep 13 09:59:45 PDT 2023


https://github.com/klausler created https://github.com/llvm/llvm-project/pull/66242:

When the old extension of D debug lines in fixed form source is enabled, recognize continuation lines that begin with a D.

(No test is added, since the community's driver doesn't support the GNU Fortran option -fd-lines-as-code.)

>From 21e4f4347ffddd0c553978a5d132a245145859da Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Wed, 6 Sep 2023 17:12:46 -0700
Subject: [PATCH] [flang] Allow continuation of D lines

When the old extension of D debug lines in fixed form source is enabled,
recognize continuation lines that begin with a D.

(No test is added, since the community's driver doesn't support
the GNU Fortran option -fd-lines-as-code.)
---
 flang/lib/Parser/prescan.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp
index 6ed1581209da68e..2f25b02bf7a323d 100644
--- a/flang/lib/Parser/prescan.cpp
+++ b/flang/lib/Parser/prescan.cpp
@@ -1041,8 +1041,11 @@ const char *Prescanner::FixedFormContinuationLine(bool mightNeedSpace) {
       tabInCurrentLine_ = true;
       return nextLine_ + 2; // VAX extension
     }
-    if (col1 == ' ' && nextLine_[1] == ' ' && nextLine_[2] == ' ' &&
-        nextLine_[3] == ' ' && nextLine_[4] == ' ') {
+    if ((col1 == ' ' ||
+            ((col1 == 'D' || col1 == 'd') &&
+                features_.IsEnabled(LanguageFeature::OldDebugLines))) &&
+        nextLine_[1] == ' ' && nextLine_[2] == ' ' && nextLine_[3] == ' ' &&
+        nextLine_[4] == ' ') {
       char col6{nextLine_[5]};
       if (col6 != '\n' && col6 != '\t' && col6 != ' ' && col6 != '0') {
         if ((col6 == 'i' || col6 == 'I') && IsIncludeLine(nextLine_)) {



More information about the flang-commits mailing list