Skip to content

Commit 9763bc4

Browse files
committed
Merge pull request #3987 from awallace-cray/chapdev-104.3935
Attempt to turn cpp #line directives back on when debugging (from #3935)
2 parents 5b6e861 + 663e25e commit 9763bc4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: compiler/util/files.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,16 @@ void openCFile(fileinfo* fi, const char* name, const char* ext) {
277277

278278
void closeCFile(fileinfo* fi, bool beautifyIt) {
279279
fclose(fi->fptr);
280-
if (beautifyIt && saveCDir[0])
280+
//
281+
// We should beautify if (1) we were asked to and (2) either (a) we
282+
// were asked to save the C code or (b) we're debugging and were
283+
// asked to codegen cpp #line information.
284+
//
285+
// TODO: With some refactoring, we could simply do the #line part of
286+
// beautify without also improving indentation and such which could
287+
// save some time.
288+
//
289+
if (beautifyIt && (saveCDir[0] || (debugCCode && printCppLineno)))
281290
beautify(fi);
282291
}
283292

0 commit comments

Comments
 (0)