Merge pull request #63223 from DougGregor/colorize-swift-syntax-diagnostics

Colorize swift syntax diagnostics
This commit is contained in:
swift-ci
2023-01-26 01:16:31 -08:00
committed by GitHub
2 changed files with 9 additions and 3 deletions

View File

@@ -42,7 +42,8 @@ extern "C" void swift_ASTGen_addQueuedDiagnostic(
const void *sourceLoc
);
extern "C" void swift_ASTGen_renderQueuedDiagnostics(
void *queued, char **outBuffer, ptrdiff_t *outBufferLength);
void *queued, ptrdiff_t contextSize, ptrdiff_t colorize,
char **outBuffer, ptrdiff_t *outBufferLength);
// FIXME: Hack because we cannot easily get to the already-parsed source
// file from here. Fix this egregious oversight!
@@ -1106,7 +1107,8 @@ void PrintingDiagnosticConsumer::flush(bool includeTrailingBreak) {
char *renderedString = nullptr;
ptrdiff_t renderedStringLen = 0;
swift_ASTGen_renderQueuedDiagnostics(
queuedDiagnostics, &renderedString, &renderedStringLen);
queuedDiagnostics, /*contextSize=*/2, ForceColors ? 1 : 0,
&renderedString, &renderedStringLen);
if (renderedString) {
Stream.write(renderedString, renderedStringLen);
}