@@ -239,6 +239,11 @@ static llvm::cl::opt<std::string>
239
239
BaselineFilePath (" baseline-path" ,
240
240
llvm::cl::desc (" The path to the Json file that we should use as the baseline" ),
241
241
llvm::cl::cat(Category));
242
+
243
+ static llvm::cl::opt<bool >
244
+ UseEmptyBaseline (" empty-baseline" ,
245
+ llvm::cl::desc (" Use empty baseline for diagnostics" ),
246
+ llvm::cl::cat(Category));
242
247
} // namespace options
243
248
244
249
namespace {
@@ -2570,28 +2575,33 @@ static SDKNodeRoot *getBaselineFromJson(const char *Main, SDKContext &Ctx) {
2570
2575
llvm::SmallString<128 > BaselinePath (ExePath);
2571
2576
llvm::sys::path::remove_filename (BaselinePath); // Remove /swift-api-digester
2572
2577
llvm::sys::path::remove_filename (BaselinePath); // Remove /bin
2573
- llvm::sys::path::append (BaselinePath, " lib" , " swift" , " FrameworkABIBaseline" ,
2574
- Modules.begin ()->getKey ());
2575
- // Look for ABI or API baseline
2576
- if (Ctx.checkingABI ())
2577
- llvm::sys::path::append (BaselinePath, " ABI" );
2578
- else
2579
- llvm::sys::path::append (BaselinePath, " API" );
2580
- // Look for deployment target specific baseline files.
2581
- auto Triple = Invok.getLangOptions ().Target ;
2582
- if (Triple.isMacCatalystEnvironment ())
2583
- llvm::sys::path::append (BaselinePath, " iosmac.json" );
2584
- else if (Triple.isMacOSX ())
2585
- llvm::sys::path::append (BaselinePath, " macos.json" );
2586
- else if (Triple.isiOS ())
2587
- llvm::sys::path::append (BaselinePath, " iphoneos.json" );
2588
- else if (Triple.isTvOS ())
2589
- llvm::sys::path::append (BaselinePath, " appletvos.json" );
2590
- else if (Triple.isWatchOS ())
2591
- llvm::sys::path::append (BaselinePath, " watchos.json" );
2592
- else {
2593
- llvm::errs () << " Unsupported triple target\n " ;
2594
- exit (1 );
2578
+ llvm::sys::path::append (BaselinePath, " lib" , " swift" , " FrameworkABIBaseline" );
2579
+ if (options::UseEmptyBaseline) {
2580
+ // Use the empty baseline for comparison.
2581
+ llvm::sys::path::append (BaselinePath, " nil.json" );
2582
+ } else {
2583
+ llvm::sys::path::append (BaselinePath, Modules.begin ()->getKey ());
2584
+ // Look for ABI or API baseline
2585
+ if (Ctx.checkingABI ())
2586
+ llvm::sys::path::append (BaselinePath, " ABI" );
2587
+ else
2588
+ llvm::sys::path::append (BaselinePath, " API" );
2589
+ // Look for deployment target specific baseline files.
2590
+ auto Triple = Invok.getLangOptions ().Target ;
2591
+ if (Triple.isMacCatalystEnvironment ())
2592
+ llvm::sys::path::append (BaselinePath, " iosmac.json" );
2593
+ else if (Triple.isMacOSX ())
2594
+ llvm::sys::path::append (BaselinePath, " macos.json" );
2595
+ else if (Triple.isiOS ())
2596
+ llvm::sys::path::append (BaselinePath, " iphoneos.json" );
2597
+ else if (Triple.isTvOS ())
2598
+ llvm::sys::path::append (BaselinePath, " appletvos.json" );
2599
+ else if (Triple.isWatchOS ())
2600
+ llvm::sys::path::append (BaselinePath, " watchos.json" );
2601
+ else {
2602
+ llvm::errs () << " Unsupported triple target\n " ;
2603
+ exit (1 );
2604
+ }
2595
2605
}
2596
2606
StringRef Path = BaselinePath.str ();
2597
2607
if (!fs::exists (Path)) {
0 commit comments