Skip to content

Commit ceebece

Browse files
committed
[Diagnostics] Add buffer offset information to the serialized diagnostics
Some of the tools rely on the presence of buffer offset to correctly navigate to the diagnostic area from the serialized diagnostics output, let's get it based on the source location provided. Resolves: rdar://problem/22935476
1 parent 664948e commit ceebece

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Frontend/SerializedDiagnosticConsumer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,14 @@ void SerializedDiagnosticConsumer::addLocToRecord(SourceLoc Loc,
266266
return;
267267
}
268268

269+
auto bufferId = SM.findBufferContainingLoc(Loc);
269270
unsigned line, col;
270271
std::tie(line, col) = SM.getLineAndColumn(Loc);
271272

272273
Record.push_back(getEmitFile(Filename));
273274
Record.push_back(line);
274275
Record.push_back(col);
275-
Record.push_back(0);
276+
Record.push_back(SM.getLocOffsetInBuffer(Loc, bufferId));
276277
}
277278

278279
void SerializedDiagnosticConsumer::addRangeToRecord(CharSourceRange Range,

0 commit comments

Comments
 (0)