summaryrefslogtreecommitdiff
path: root/flang/lib/Parser/provenance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Parser/provenance.cpp')
-rw-r--r--flang/lib/Parser/provenance.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/flang/lib/Parser/provenance.cpp b/flang/lib/Parser/provenance.cpp
index 55ef67fd6288..6e2e7326e216 100644
--- a/flang/lib/Parser/provenance.cpp
+++ b/flang/lib/Parser/provenance.cpp
@@ -513,6 +513,16 @@ void CookedSource::Marshal(AllCookedSources &allCookedSources) {
"(after end of source)"));
data_ = buffer_.Marshal();
buffer_.clear();
+ for (std::size_t ffStart : possibleFixedFormContinuations_) {
+ if (ffStart > 0 && ffStart + 1 < data_.size() &&
+ data_[ffStart - 1] == '\n' && data_[ffStart] == ' ') {
+ // This fixed form include line is the first source line in an
+ // #include file (or after an empty one). Connect it with the previous
+ // source line by deleting its terminal newline.
+ data_[ffStart - 1] = ' ';
+ }
+ }
+ possibleFixedFormContinuations_.clear();
allCookedSources.Register(*this);
}