aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Parser/token-sequence.cpp
diff options
context:
space:
mode:
authorPeter Klausler <35819229+klausler@users.noreply.github.com>2024-06-12 10:11:35 -0700
committerGitHub <noreply@github.com>2024-06-12 10:11:35 -0700
commite286ecfecf50fd8eff2e7003131d2c845cb6045f (patch)
treeb954b3d330bc11515a54ce945e5ffd8cccb8991f /flang/lib/Parser/token-sequence.cpp
parent1a0e67d73023e7ad9e7e79f66afb43a6f2561d04 (diff)
downloadllvm-e286ecfecf50fd8eff2e7003131d2c845cb6045f.zip
llvm-e286ecfecf50fd8eff2e7003131d2c845cb6045f.tar.gz
llvm-e286ecfecf50fd8eff2e7003131d2c845cb6045f.tar.bz2
[flang] Disable Fortran free form line continuation in non-source lin… (#94663)
…e produced by keyword macro replacement When later initial keyword macro replacement will yield a line that is not Fortran source, don't interpret "&" as a Fortran source line continuation marker during tokenization of the line. Fixes https://github.com/llvm/llvm-project/issues/82579.
Diffstat (limited to 'flang/lib/Parser/token-sequence.cpp')
-rw-r--r--flang/lib/Parser/token-sequence.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/flang/lib/Parser/token-sequence.cpp b/flang/lib/Parser/token-sequence.cpp
index d0254ec..40560bb 100644
--- a/flang/lib/Parser/token-sequence.cpp
+++ b/flang/lib/Parser/token-sequence.cpp
@@ -347,7 +347,8 @@ ProvenanceRange TokenSequence::GetProvenanceRange() const {
}
const TokenSequence &TokenSequence::CheckBadFortranCharacters(
- Messages &messages, const Prescanner &prescanner) const {
+ Messages &messages, const Prescanner &prescanner,
+ bool allowAmpersand) const {
std::size_t tokens{SizeInTokens()};
for (std::size_t j{0}; j < tokens; ++j) {
CharBlock token{TokenAt(j)};
@@ -362,6 +363,8 @@ const TokenSequence &TokenSequence::CheckBadFortranCharacters(
++j;
continue;
}
+ } else if (ch == '&' && allowAmpersand) {
+ continue;
}
if (ch < ' ' || ch >= '\x7f') {
messages.Say(GetTokenProvenanceRange(j),