Skip to content

Commit 8510115

Browse files
committed
Don't request a display name for an invalid location
1 parent 7dbe049 commit 8510115

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Frontend/SerializedDiagnosticConsumer.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,16 +255,16 @@ unsigned SerializedDiagnosticConsumer::getEmitFile(
255255

256256
// The source range that this buffer was generated from, expressed as
257257
// offsets into the original buffer.
258-
auto originalFilename = SM.getDisplayNameForLoc(generatedInfo->originalSourceRange.Start);
259258
if (generatedInfo->originalSourceRange.isValid()) {
259+
auto originalFilename = SM.getDisplayNameForLoc(generatedInfo->originalSourceRange.Start);
260260
addRangeToRecord(
261261
Lexer::getCharSourceRangeFromSourceRange(
262262
SM, generatedInfo->originalSourceRange),
263263
SM, originalFilename, Record
264264
);
265265
} else {
266-
addLocToRecord(SourceLoc(), SM, originalFilename, Record); // Start
267-
addLocToRecord(SourceLoc(), SM, originalFilename, Record); // End
266+
addLocToRecord(SourceLoc(), SM, "", Record); // Start
267+
addLocToRecord(SourceLoc(), SM, "", Record); // End
268268
}
269269

270270
// Contents of the buffer.

0 commit comments

Comments
 (0)