@@ -196,7 +196,8 @@ using InputInfoMap = Driver::InputInfoMap;
196
196
197
197
static bool populateOutOfDateMap (InputInfoMap &map, StringRef argsHashStr,
198
198
const InputFileList &inputs,
199
- StringRef buildRecordPath) {
199
+ StringRef buildRecordPath,
200
+ bool ShowIncrementalBuildDecisions) {
200
201
// Treat a missing file as "no previous build".
201
202
auto buffer = llvm::MemoryBuffer::getFile (buildRecordPath);
202
203
if (!buffer)
@@ -260,6 +261,7 @@ static bool populateOutOfDateMap(InputInfoMap &map, StringRef argsHashStr,
260
261
261
262
// FIXME: LLVM's YAML support does incremental parsing in such a way that
262
263
// for-range loops break.
264
+ SmallString<64 > CompilationRecordSwiftVersion;
263
265
for (auto i = topLevelMap->begin (), e = topLevelMap->end (); i != e; ++i) {
264
266
auto *key = cast<yaml::ScalarNode>(i->getKey ());
265
267
StringRef keyStr = key->getValue (scratch);
@@ -274,7 +276,8 @@ static bool populateOutOfDateMap(InputInfoMap &map, StringRef argsHashStr,
274
276
// swift::version::Version::getCurrentLanguageVersion() here because any
275
277
// -swift-version argument is handled in the argsHashStr check that
276
278
// follows.
277
- versionValid = (value->getValue (scratch)
279
+ CompilationRecordSwiftVersion = value->getValue (scratch);
280
+ versionValid = (CompilationRecordSwiftVersion
278
281
== version::getSwiftFullVersion (
279
282
version::Version::getCurrentLanguageVersion ()));
280
283
@@ -325,8 +328,22 @@ static bool populateOutOfDateMap(InputInfoMap &map, StringRef argsHashStr,
325
328
}
326
329
}
327
330
328
- if (!versionValid || !optionsMatch)
331
+ if (!versionValid) {
332
+ if (ShowIncrementalBuildDecisions) {
333
+ auto v = version::getSwiftFullVersion (
334
+ version::Version::getCurrentLanguageVersion ());
335
+ llvm::outs () << " Incremental compilation has been disabled, due to a "
336
+ << " compiler version mismatch.\n "
337
+ << " \t Compiling with: " << v << " \n "
338
+ << " \t Previously compiled with: "
339
+ << CompilationRecordSwiftVersion << " \n " ;
340
+ }
329
341
return true ;
342
+ }
343
+
344
+ if (!optionsMatch) {
345
+ return true ;
346
+ }
330
347
331
348
size_t numInputsFromPrevious = 0 ;
332
349
for (auto &inputPair : inputs) {
@@ -460,7 +477,8 @@ std::unique_ptr<Compilation> Driver::buildCompilation(
460
477
461
478
} else {
462
479
if (populateOutOfDateMap (outOfDateMap, ArgsHash, Inputs,
463
- buildRecordPath)) {
480
+ buildRecordPath,
481
+ ShowIncrementalBuildDecisions)) {
464
482
// FIXME: Distinguish errors from "file removed", which is benign.
465
483
} else {
466
484
rebuildEverything = false ;
0 commit comments