[flang-commits] [flang] [flang] Accept C-style comments in label fields (PR #207012)
Leandro Lupori via flang-commits
flang-commits at lists.llvm.org
Fri Sep 18 11:52:32 PDT 2026
================
@@ -1424,18 +1469,43 @@ bool Prescanner::SkipCommentLine(bool afterAmpersand) {
return false;
}
-const char *Prescanner::FixedFormContinuationLine(bool atNewline) {
+const char *Prescanner::FixedFormContinuationLine(
+ bool atNewline, const char *&cComment, const char *&unterminatedCComment) {
+ cComment = nullptr;
+ unterminatedCComment = nullptr;
if (IsAtEnd()) {
return nullptr;
}
tabInCurrentLine_ = false;
char col1{*nextLine_};
+ const char *afterWhiteSpace{SkipWhiteSpace(nextLine_)};
+ const char *afterCComment{nullptr};
+ if (preprocessingEnabled_ && IsCComment(afterWhiteSpace)) {
+ afterCComment = SkipCComment(afterWhiteSpace);
+ if (afterCComment == nullptr) {
+ unterminatedCComment = afterWhiteSpace;
+ } else {
+ cComment = afterWhiteSpace;
+ }
+ }
+ std::uint64_t maxLineLength{static_cast<std::uint64_t>(limit_ - nextLine_)};
+ std::uint64_t n{maxLineLength < 5 ? maxLineLength - 1 : 4};
+ int trailingSpaces{0};
+ for (std::uint64_t i{afterCComment
+ ? static_cast<std::uint64_t>(afterCComment - nextLine_)
+ : 1};
+ i <= n && nextLine_[i] == ' '; ++i) {
+ ++trailingSpaces;
+ }
+ bool cCommentAndSpaces{afterCComment &&
+ afterCComment - nextLine_ + trailingSpaces == 5 &&
----------------
luporl wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/207012
More information about the flang-commits
mailing list