[flang-commits] [flang] [flang] Accept a compiler directive sentinel after a semicolon (PR #96966)
Razvan Lupusoru via flang-commits
flang-commits at lists.llvm.org
Thu Jun 27 14:00:51 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) {
----------------
razvanlupusoru wrote:
tok.size() is compared with "<= blanks + 5" earlier and here it is compared with ">= blanks + 5". There is overlap due to the equality use. Is there an error here?
https://github.com/llvm/llvm-project/pull/96966
More information about the flang-commits
mailing list