mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -629,6 +629,11 @@ llvm::Error DiagnosticSerializer::deserializeDiagnosticInfo(
|
||||
|
||||
llvm::Error
|
||||
DiagnosticSerializer::serializeEmittedDiagnostics(llvm::raw_ostream &os) {
|
||||
// If no diagnostics is produced, do not write anything so output is smaller
|
||||
// without referencing any files.
|
||||
if (DiagInfos.empty())
|
||||
return llvm::Error::success();
|
||||
|
||||
// Convert all file backed source file into CASIDs.
|
||||
for (auto &File : Files) {
|
||||
if (!File.Content.empty() || !File.ContentCASID.empty())
|
||||
@@ -822,12 +827,14 @@ CachingDiagnosticsProcessor::CachingDiagnosticsProcessor(
|
||||
|
||||
// compress the YAML file.
|
||||
llvm::SmallVector<uint8_t, 512> Compression;
|
||||
if (!Output.empty()) {
|
||||
if (llvm::compression::zstd::isAvailable())
|
||||
llvm::compression::zstd::compress(arrayRefFromStringRef(Output),
|
||||
Compression);
|
||||
else if (llvm::compression::zlib::isAvailable())
|
||||
llvm::compression::zlib::compress(arrayRefFromStringRef(Output),
|
||||
Compression);
|
||||
}
|
||||
|
||||
// Write the uncompressed size in the end.
|
||||
if (!Compression.empty()) {
|
||||
@@ -872,6 +879,10 @@ llvm::Error CachingDiagnosticsProcessor::serializeEmittedDiagnostics(
|
||||
|
||||
llvm::Error
|
||||
CachingDiagnosticsProcessor::replayCachedDiagnostics(llvm::StringRef Buffer) {
|
||||
// If empty buffer, no diagnostics to replay.
|
||||
if (Buffer.empty())
|
||||
return llvm::Error::success();
|
||||
|
||||
SmallVector<uint8_t, 512> Uncompressed;
|
||||
if (llvm::compression::zstd::isAvailable() ||
|
||||
llvm::compression::zlib::isAvailable()) {
|
||||
|
||||
@@ -1985,7 +1985,7 @@ int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
// hundreds or thousands of lines. Skip dumping this output in that case.
|
||||
if (!Invocation.getFrontendOptions().InputsAndOutputs.isWholeModule()) {
|
||||
for_each(configurationFileBuffers.begin(), configurationFileBuffers.end(),
|
||||
&configurationFileStackTraces[0],
|
||||
configurationFileStackTraces.get(),
|
||||
[](const std::unique_ptr<llvm::MemoryBuffer> &buffer,
|
||||
std::optional<PrettyStackTraceFileContents> &trace) {
|
||||
trace.emplace(*buffer);
|
||||
|
||||
Reference in New Issue
Block a user