[flang-commits] [flang] [flang] Accept a compiler directive sentinel after a semicolon (PR #96966)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu Jun 27 14:33:29 PDT 2024


================
@@ -266,20 +266,17 @@ TokenSequence &TokenSequence::ClipComment(
     if (std::size_t blanks{tok.CountLeadingBlanks()};
         blanks < tok.size() && tok[blanks] == '!') {
       // Retain active compiler directive sentinels (e.g. "!dir$")
-      for (std::size_t k{j + 1}; k < tokens && tok.size() < blanks + 5; ++k) {
+      for (std::size_t k{j + 1}; k < tokens && tok.size() <= blanks + 5; ++k) {
         if (tok.begin() + tok.size() == TokenAt(k).begin()) {
           tok.ExtendToCover(TokenAt(k));
         } else {
           break;
         }
       }
       bool isSentinel{false};
-      if (tok.size() == blanks + 5) {
-        char sentinel[4];
-        for (int k{0}; k < 4; ++k) {
-          sentinel[k] = ToLowerCaseLetter(tok[blanks + k + 1]);
-        }
-        isSentinel = prescanner.IsCompilerDirectiveSentinel(sentinel, 4);
+      if (tok.size() >= blanks + 5) {
----------------
klausler wrote:

Not really, but I will tweak it for clarity.

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


More information about the flang-commits mailing list