Skip to content

Commit 86927ef

Browse files
Merge pull request #65288 from cachemeifyoucan/eng/PR-swift-cache-backend
[CAS] Teach swift compiler to compute cache key and store outputs into CAS
2 parents 067e4ec + 8d3d9b2 commit 86927ef

30 files changed

+1203
-192
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ ERROR(error_output_missing,none,
485485
REMARK(matching_output_produced,none,
486486
"produced matching output file '%0' for deterministic check: hash '%1'", (StringRef, StringRef))
487487

488+
// Caching related diagnostics
489+
ERROR(error_caching_no_cas_fs, none,
490+
"caching is enabled without -cas-fs option, input is not immutable", ())
491+
488492
// CAS related diagnostics
489493
ERROR(error_create_cas, none, "failed to create CAS '%0' (%1)", (StringRef, StringRef))
490494
ERROR(error_invalid_cas_id, none, "invalid CASID '%0' (%1)", (StringRef, StringRef))

include/swift/Basic/FileTypes.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,8 @@ TYPE("pch", PCH, "pch", "")
9898
TYPE("none", Nothing, "", "")
9999

100100
TYPE("abi-baseline-json", SwiftABIDescriptor, "abi.json", "")
101+
TYPE("fixit", SwiftFixIt, "", "")
102+
TYPE("module-semantic-info", ModuleSemanticInfo, "", "")
103+
TYPE("cached-diagnostics", CachedDiagnostics, "", "")
101104

102105
#undef TYPE
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
//===--- SupplementaryOutputPaths.def - Output Names and Types --*- C++ -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// This file defines all the Supplemtary Output Path variables and their
14+
// output types.
15+
//
16+
//===----------------------------------------------------------------------===//
17+
18+
/// The path to which we should emit a header file that exposes the Swift
19+
/// declarations to C, Objective-C and C++ clients for the module.
20+
///
21+
/// Currently only makes sense when the compiler has whole module knowledge.
22+
/// The modes for which it makes sense incuide both WMO and the "merge
23+
/// modules" job that happens after the normal compilation jobs. That's where
24+
/// the header is emitted in single-file mode, since it needs whole-module
25+
/// information.
26+
///
27+
/// \sa swift::printAsClangHeader
28+
OUTPUT(ClangHeaderOutputPath, TY_ClangHeader)
29+
30+
/// The path to which we should emit a serialized module.
31+
/// It is valid whenever there are any inputs.
32+
///
33+
/// This binary format is used to describe the interface of a module when
34+
/// imported by client source code. The swiftmodule format is described in
35+
/// docs/Serialization.md.
36+
///
37+
/// \sa swift::serialize
38+
OUTPUT(ModuleOutputPath, TY_SwiftModuleFile)
39+
40+
/// The path to which we should emit a module source information file.
41+
/// It is valid whenever there are any inputs.
42+
///
43+
/// This binary format stores source locations and other information about the
44+
/// declarations in a module.
45+
///
46+
/// \sa swift::serialize
47+
OUTPUT(ModuleSourceInfoOutputPath, TY_SwiftSourceInfoFile)
48+
49+
/// The path to which we should emit a module documentation file.
50+
/// It is valid whenever there are any inputs.
51+
///
52+
/// This binary format stores doc comments and other information about the
53+
/// declarations in a module.
54+
///
55+
/// \sa swift::serialize
56+
OUTPUT(ModuleDocOutputPath, TY_SwiftModuleDocFile)
57+
58+
/// The path to which we should output a Make-style dependencies file.
59+
/// It is valid whenever there are any inputs.
60+
///
61+
/// Swift's compilation model means that Make-style dependencies aren't
62+
/// well-suited to model fine-grained dependencies. See docs/Driver.md for
63+
/// more information.
64+
///
65+
/// \sa ReferenceDependenciesFilePath
66+
OUTPUT(DependenciesFilePath, TY_Dependencies)
67+
68+
/// The path to which we should output a Swift "reference dependencies" file.
69+
/// It is valid whenever there are any inputs.
70+
///
71+
/// "Reference dependencies" track dependencies on a more fine-grained level
72+
/// than just "this file depends on that file". With Swift's "implicit
73+
/// visibility" within a module, that becomes very important for any sort of
74+
/// incremental build. These files are consumed by the Swift driver to decide
75+
/// whether a source file needs to be recompiled during a build. See
76+
/// docs/DependencyAnalysis.md for more information.
77+
///
78+
/// \sa swift::emitReferenceDependencies
79+
/// \sa DependencyGraph
80+
OUTPUT(ReferenceDependenciesFilePath, TY_SwiftDeps)
81+
82+
/// Path to a file which should contain serialized diagnostics for this
83+
/// frontend invocation.
84+
///
85+
/// This uses the same serialized diagnostics format as Clang, for tools that
86+
/// want machine-parseable diagnostics. There's a bit more information on
87+
/// how clients might use this in docs/Driver.md.
88+
///
89+
/// \sa swift::serialized_diagnostics::createConsumer
90+
OUTPUT(SerializedDiagnosticsPath, TY_SerializedDiagnostics)
91+
92+
/// The path to which we should output fix-its as source edits.
93+
///
94+
/// This is a JSON-based format that is used by the migrator, but is not
95+
/// really vetted for anything else.
96+
///
97+
/// \sa swift::writeEditsInJson
98+
OUTPUT(FixItsOutputPath, TY_SwiftFixIt)
99+
100+
/// The path to which we should output a loaded module trace file.
101+
/// It is valid whenever there are any inputs.
102+
///
103+
/// The file is appended to, and consists of line-delimited JSON objects,
104+
/// where each line is of the form `{ "name": NAME, "target": TARGET,
105+
/// "swiftmodules": [PATH, PATH, ...] }`, representing the (real-path) PATHs
106+
/// to each .swiftmodule that was loaded while building module NAME for target
107+
/// TARGET. This format is subject to arbitrary change, however.
108+
OUTPUT(LoadedModuleTracePath, TY_ModuleTrace)
109+
110+
/// The path to which we should output a TBD file.
111+
///
112+
/// "TBD" stands for "text-based dylib". It's a YAML-based format that
113+
/// describes the public ABI of a library, which clients can link against
114+
/// without having an actual dynamic library binary.
115+
///
116+
/// Only makes sense when the compiler has whole-module knowledge.
117+
///
118+
/// \sa swift::writeTBDFile
119+
OUTPUT(TBDPath, TY_TBD)
120+
121+
/// The path to which we should emit a module interface, which can
122+
/// be used by a client source file to import this module.
123+
///
124+
/// This format is similar to the binary format used for #ModuleOutputPath,
125+
/// but is intended to be stable across compiler versions.
126+
///
127+
/// Currently only makes sense when the compiler has whole-module knowledge.
128+
///
129+
/// \sa swift::emitSwiftInterface
130+
OUTPUT(ModuleInterfaceOutputPath, TY_SwiftModuleInterfaceFile)
131+
132+
/// The path to which we should emit a private module interface.
133+
///
134+
/// The private module interface contains all SPI decls and attributes.
135+
///
136+
/// \sa ModuleInterfaceOutputPath
137+
OUTPUT(PrivateModuleInterfaceOutputPath,
138+
TY_PrivateSwiftModuleInterfaceFile)
139+
140+
/// The path to which we should emit module summary file.
141+
OUTPUT(ModuleSummaryOutputPath, TY_SwiftModuleSummaryFile)
142+
143+
/// The output path to generate ABI baseline.
144+
OUTPUT(ABIDescriptorOutputPath, TY_SwiftABIDescriptor)
145+
146+
/// The output path for extracted compile-time-known value information
147+
OUTPUT(ConstValuesOutputPath, TY_ConstValues)
148+
149+
/// The output path of Swift semantic info for this module.
150+
OUTPUT(ModuleSemanticInfoOutputPath, TY_ModuleSemanticInfo)
151+
152+
/// The output path for YAML optimization record file.
153+
OUTPUT(YAMLOptRecordPath, TY_YAMLOptRecord)
154+
155+
/// The output path for bitstream optimization record file.
156+
OUTPUT(BitstreamOptRecordPath, TY_BitstreamOptRecord)

0 commit comments

Comments
 (0)