Files
swift-mirror/include/swift/Frontend/CachedDiagnostics.h
Steven Wu d3891a86ba [CAS] Add caching diagnostic processor
Add a CachedDiagnosticsProcessor that is a DiagConsumer can capture all
the diagnostics during a compilation, serialized them into CAS with a
format that can be replayed without re-compiling.
2023-04-27 13:36:49 -07:00

54 lines
1.6 KiB
C++

//===--- CachedDiagnostics.h - Cached Diagnostics ---------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines the CachedDiagnosticConsumer class, which
// caches the diagnostics which can be replayed with other DiagnosticConumers.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_CACHEDDIAGNOSTICS_H
#define SWIFT_CACHEDDIAGNOSTICS_H
#include "llvm/Support/Error.h"
namespace swift {
class CompilerInstance;
class DiagnosticEngine;
class SourceManager;
class FrontendInputsAndOutputs;
class CachingDiagnosticsProcessor {
public:
CachingDiagnosticsProcessor(CompilerInstance &Instance);
~CachingDiagnosticsProcessor();
/// Start capturing all the diagnostics from DiagnosticsEngine.
void startDiagnosticCapture();
/// End capturing all the diagnostics from DiagnosticsEngine.
void endDiagnosticCapture();
/// Emit serialized diagnostics into output stream.
llvm::Error serializeEmittedDiagnostics(llvm::raw_ostream &os);
/// Used to replay the previously cached diagnostics, after a cache hit.
llvm::Error replayCachedDiagnostics(llvm::StringRef Buffer);
private:
class Implementation;
Implementation& Impl;
};
}
#endif