diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:31:57 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2025-01-09 18:33:27 +0900 |
commit | df025ebf872052c0761d44a3ef9b65e9675af8a8 (patch) | |
tree | 9b4e94583e2536546d6606270bcdf846c95e1ba2 /flang/lib/Parser/prescan.cpp | |
parent | 4428c9d0b1344179f85a72e183a44796976521e3 (diff) | |
parent | bdcf47e4bcb92889665825654bb80a8bbe30379e (diff) | |
download | llvm-users/chapuni/cov/single/loop.zip llvm-users/chapuni/cov/single/loop.tar.gz llvm-users/chapuni/cov/single/loop.tar.bz2 |
Merge branch 'users/chapuni/cov/single/base' into users/chapuni/cov/single/loopusers/chapuni/cov/single/loop
Conflicts:
clang/lib/CodeGen/CoverageMappingGen.cpp
Diffstat (limited to 'flang/lib/Parser/prescan.cpp')
-rw-r--r-- | flang/lib/Parser/prescan.cpp | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/flang/lib/Parser/prescan.cpp b/flang/lib/Parser/prescan.cpp index 3cd32d7..703a0279 100644 --- a/flang/lib/Parser/prescan.cpp +++ b/flang/lib/Parser/prescan.cpp @@ -709,9 +709,22 @@ bool Prescanner::NextToken(TokenSequence &tokens) { QuotedCharacterLiteral(tokens, start); } else if (IsLetter(*at_) && !preventHollerith_ && parenthesisNesting_ > 0) { - // Handles FORMAT(3I9HHOLLERITH) by skipping over the first I so that - // we don't misrecognize I9HOLLERITH as an identifier in the next case. - EmitCharAndAdvance(tokens, *at_); + const char *p{at_}; + int digits{0}; + for (;; ++digits) { + ++p; + if (InFixedFormSource()) { + p = SkipWhiteSpace(p); + } + if (!IsDecimalDigit(*p)) { + break; + } + } + if (digits > 0 && (*p == 'h' || *p == 'H')) { + // Handles FORMAT(3I9HHOLLERITH) by skipping over the first I so that + // we don't misrecognize I9HOLLERITH as an identifier in the next case. + EmitCharAndAdvance(tokens, *at_); + } } preventHollerith_ = false; } else if (*at_ == '.') { @@ -1289,14 +1302,18 @@ 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)) { - return nullptr; + if (*p == '!') { + ++p; + if (InCompilerDirective()) { + for (const char *s{directiveSentinel_}; *s != '\0'; ++p, ++s) { + if (*s != ToLowerCaseLetter(*p)) { + return nullptr; + } } + } else if (features_.IsEnabled(LanguageFeature::OpenMP) && *p == '$') { + ++p; + } else { + return nullptr; } p = SkipWhiteSpace(p); if (*p == '&') { |