@@ -155,7 +155,7 @@ void Parsing::EmitPreprocessedSource(
155155 const auto getOriginalChar{[&](char ch) {
156156 if (IsLetter (ch) && provenance && provenance->size () == 1 ) {
157157 if (const char *orig{allSources.GetSource (*provenance)}) {
158- const char upper{ToUpperCaseLetter (ch)};
158+ char upper{ToUpperCaseLetter (ch)};
159159 if (*orig == upper) {
160160 return upper;
161161 }
@@ -184,21 +184,23 @@ void Parsing::EmitPreprocessedSource(
184184 std::optional<SourcePosition> position{provenance
185185 ? allSources.GetSourcePosition (provenance->start ())
186186 : std::nullopt };
187- if (lineDirectives && column == 1 && position) {
188- if (&*position->path != sourcePath) {
189- out << " #line \" " << *position->path << " \" " << position->line
190- << ' \n ' ;
191- } else if (position->line != sourceLine) {
192- if (sourceLine < position->line &&
193- sourceLine + 10 >= position->line ) {
194- // Emit a few newlines to catch up when they'll likely
195- // require fewer bytes than a #line directive would have
196- // occupied.
197- while (sourceLine++ < position->line ) {
198- out << ' \n ' ;
187+ if (column == 1 && position) {
188+ if (lineDirectives) {
189+ if (&*position->path != sourcePath) {
190+ out << " #line \" " << *position->path << " \" " << position->line
191+ << ' \n ' ;
192+ } else if (position->line != sourceLine) {
193+ if (sourceLine < position->line &&
194+ sourceLine + 10 >= position->line ) {
195+ // Emit a few newlines to catch up when they'll likely
196+ // require fewer bytes than a #line directive would have
197+ // occupied.
198+ while (sourceLine++ < position->line ) {
199+ out << ' \n ' ;
200+ }
201+ } else {
202+ out << " #line " << position->line << ' \n ' ;
199203 }
200- } else {
201- out << " #line " << position->line << ' \n ' ;
202204 }
203205 }
204206 sourcePath = &*position->path ;
@@ -244,7 +246,7 @@ void Parsing::EmitPreprocessedSource(
244246 }
245247 }
246248 } else if (!inContinuation && !inDirectiveSentinel && position &&
247- position->column <= 72 ) {
249+ position->line == sourceLine && position-> column < 72 ) {
248250 // Preserve original indentation
249251 for (; column < position->column ; ++column) {
250252 out << ' ' ;
0 commit comments