@@ -2108,13 +2108,13 @@ static void findTypeMemberDiffs(NodePtr leftSDKRoot, NodePtr rightSDKRoot,
21082108}
21092109
21102110static std::unique_ptr<DiagnosticConsumer>
2111- createDiagConsumer (llvm::raw_ostream &OS, bool &FailOnError,
2111+ createDiagConsumer (llvm::raw_ostream &OS, bool &FailOnError, bool DisableFailOnError,
21122112 bool CompilerStyleDiags, StringRef SerializedDiagPath) {
21132113 if (!SerializedDiagPath.empty ()) {
2114- FailOnError = true ;
2114+ FailOnError = !DisableFailOnError ;
21152115 return serialized_diagnostics::createConsumer (SerializedDiagPath);
21162116 } else if (CompilerStyleDiags) {
2117- FailOnError = true ;
2117+ FailOnError = !DisableFailOnError ;
21182118 return std::make_unique<PrintingDiagnosticConsumer>();
21192119 } else {
21202120 FailOnError = false ;
@@ -2169,6 +2169,7 @@ static bool readBreakageAllowlist(SDKContext &Ctx, llvm::StringSet<> &lines,
21692169static int diagnoseModuleChange (SDKContext &Ctx, SDKNodeRoot *LeftModule,
21702170 SDKNodeRoot *RightModule, StringRef OutputPath,
21712171 llvm::StringSet<> ProtocolReqAllowlist,
2172+ bool DisableFailOnError,
21722173 bool CompilerStyleDiags,
21732174 StringRef SerializedDiagPath,
21742175 StringRef BreakageAllowlistPath,
@@ -2193,7 +2194,7 @@ static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
21932194 BreakageAllowlistPath);
21942195 }
21952196 auto pConsumer = std::make_unique<FilteringDiagnosticConsumer>(
2196- createDiagConsumer (*OS, FailOnError, CompilerStyleDiags,
2197+ createDiagConsumer (*OS, FailOnError, DisableFailOnError, CompilerStyleDiags,
21972198 SerializedDiagPath),
21982199 std::move (allowedBreakages));
21992200 SWIFT_DEFER { pConsumer->finishProcessing (); };
@@ -2215,6 +2216,7 @@ static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
22152216static int diagnoseModuleChange (StringRef LeftPath, StringRef RightPath,
22162217 StringRef OutputPath, CheckerOptions Opts,
22172218 llvm::StringSet<> ProtocolReqAllowlist,
2219+ bool DisableFailOnError,
22182220 bool CompilerStyleDiags,
22192221 StringRef SerializedDiagPath,
22202222 StringRef BreakageAllowlistPath,
@@ -2234,7 +2236,7 @@ static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
22342236 RightCollector.deSerialize (RightPath);
22352237 return diagnoseModuleChange (
22362238 Ctx, LeftCollector.getSDKRoot (), RightCollector.getSDKRoot (), OutputPath,
2237- std::move (ProtocolReqAllowlist), CompilerStyleDiags, SerializedDiagPath,
2239+ std::move (ProtocolReqAllowlist), DisableFailOnError, CompilerStyleDiags, SerializedDiagPath,
22382240 BreakageAllowlistPath, DebugMapping);
22392241}
22402242
@@ -2514,6 +2516,7 @@ class SwiftAPIDigesterInvocation {
25142516 std::vector<std::string> PreferInterfaceForModules;
25152517 std::string ResourceDir;
25162518 std::string ModuleCachePath;
2519+ bool DisableFailOnError;
25172520
25182521public:
25192522 SwiftAPIDigesterInvocation (const std::string &ExecPath)
@@ -2615,6 +2618,7 @@ class SwiftAPIDigesterInvocation {
26152618 ResourceDir = ParsedArgs.getLastArgValue (OPT_resource_dir).str ();
26162619 ModuleCachePath = ParsedArgs.getLastArgValue (OPT_module_cache_path).str ();
26172620 DebugMapping = ParsedArgs.hasArg (OPT_debug_mapping);
2621+ DisableFailOnError = ParsedArgs.hasArg (OPT_disable_fail_on_error);
26182622
26192623 CheckerOpts.AvoidLocation = ParsedArgs.hasArg (OPT_avoid_location);
26202624 CheckerOpts.AvoidToolArgs = ParsedArgs.hasArg (OPT_avoid_tool_args);
@@ -2817,21 +2821,21 @@ class SwiftAPIDigesterInvocation {
28172821 case ComparisonInputMode::BothJson: {
28182822 return diagnoseModuleChange (
28192823 SDKJsonPaths[0 ], SDKJsonPaths[1 ], OutputFile, CheckerOpts,
2820- std::move (protocolAllowlist), CompilerStyleDiags,
2824+ std::move (protocolAllowlist), DisableFailOnError, CompilerStyleDiags,
28212825 SerializedDiagPath, BreakageAllowlistPath, DebugMapping);
28222826 }
28232827 case ComparisonInputMode::BaselineJson: {
28242828 SDKContext Ctx (CheckerOpts);
28252829 return diagnoseModuleChange (
28262830 Ctx, getBaselineFromJson (Ctx), getSDKRoot (Ctx, false ), OutputFile,
2827- std::move (protocolAllowlist), CompilerStyleDiags,
2831+ std::move (protocolAllowlist), DisableFailOnError, CompilerStyleDiags,
28282832 SerializedDiagPath, BreakageAllowlistPath, DebugMapping);
28292833 }
28302834 case ComparisonInputMode::BothLoad: {
28312835 SDKContext Ctx (CheckerOpts);
28322836 return diagnoseModuleChange (
28332837 Ctx, getSDKRoot (Ctx, true ), getSDKRoot (Ctx, false ), OutputFile,
2834- std::move (protocolAllowlist), CompilerStyleDiags,
2838+ std::move (protocolAllowlist), DisableFailOnError, CompilerStyleDiags,
28352839 SerializedDiagPath, BreakageAllowlistPath, DebugMapping);
28362840 }
28372841 }
0 commit comments