mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Previously, the frontend detected that its output was being piped into the driver and buffered, and decided that that wasn't a color-friendly output stream. Now, the driver passes -color-diagnostics to the frontend to force color output if the driver itself is in a color-output context. <rdar://problem/16697713> Swift SVN r18506
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
//===- PrintingDiagnosticConsumer.h - Print Text Diagnostics ----*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines the PrintingDiagnosticConsumer class, which displays
|
|
// diagnostics as text to a terminal.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_PRINTINGDIAGNOSTICCONSUMER_H
|
|
#define SWIFT_PRINTINGDIAGNOSTICCONSUMER_H
|
|
|
|
#include "swift/Basic/LLVM.h"
|
|
#include "swift/Basic/DiagnosticConsumer.h"
|
|
|
|
namespace swift {
|
|
|
|
/// \brief Diagnostic consumer that displays diagnostics to standard error.
|
|
class PrintingDiagnosticConsumer : public DiagnosticConsumer {
|
|
bool ForceColors = false;
|
|
public:
|
|
virtual void handleDiagnostic(SourceManager &SM, SourceLoc Loc,
|
|
DiagnosticKind Kind, StringRef Text,
|
|
const DiagnosticInfo &Info) override;
|
|
|
|
void forceColors() {
|
|
ForceColors = true;
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|