[flang-commits] [flang] [FLANG][OPENMP] Fix handling of continuation lines in mixed OpenMP an… (PR #120714)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri Dec 20 10:55:45 PST 2024


================
@@ -1289,29 +1289,49 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) {
     return nullptr;
   }
   p = SkipWhiteSpace(p);
-  if (InCompilerDirective()) {
-    if (*p++ != '!') {
-      return nullptr;
-    }
-    for (const char *s{directiveSentinel_}; *s != '\0'; ++p, ++s) {
-      if (*s != ToLowerCaseLetter(*p)) {
+  if (*p == '!') {
+    if (InCompilerDirective()) {
+      if (*p++ != '!') {
         return nullptr;
       }
-    }
-    p = SkipWhiteSpace(p);
-    if (*p == '&') {
-      if (!ampersand) {
-        insertASpace_ = true;
+      for (const char *s{directiveSentinel_}; *s != '\0'; ++p, ++s) {
+        if (*s != ToLowerCaseLetter(*p)) {
+          return nullptr;
+        }
+      }
+      p = SkipWhiteSpace(p);
+      if (*p == '&') {
+        if (!ampersand) {
+          insertASpace_ = true;
+        }
+        return p + 1;
+      } else if (ampersand) {
+        return p;
+      } else {
+        return nullptr;
+      }
+    } else if (features_.IsEnabled(LanguageFeature::OpenMP)) {
+      if (*p + 1 == '$')
----------------
klausler wrote:

```
if (p[1] == '$') {
  return nullptr;
}
```

https://github.com/llvm/llvm-project/pull/120714


More information about the flang-commits mailing list