@@ -2107,13 +2107,13 @@ static void findTypeMemberDiffs(NodePtr leftSDKRoot, NodePtr rightSDKRoot,
21072107}
21082108
21092109static std::unique_ptr<DiagnosticConsumer>
2110- createDiagConsumer (llvm::raw_ostream &OS, bool &FailOnError,
2110+ createDiagConsumer (llvm::raw_ostream &OS, bool &FailOnError, bool DisableFailOnError,
21112111 bool CompilerStyleDiags, StringRef SerializedDiagPath) {
21122112 if (!SerializedDiagPath.empty ()) {
2113- FailOnError = true ;
2113+ FailOnError = !DisableFailOnError ;
21142114 return serialized_diagnostics::createConsumer (SerializedDiagPath);
21152115 } else if (CompilerStyleDiags) {
2116- FailOnError = true ;
2116+ FailOnError = !DisableFailOnError ;
21172117 return std::make_unique<PrintingDiagnosticConsumer>();
21182118 } else {
21192119 FailOnError = false ;
@@ -2168,6 +2168,7 @@ static bool readBreakageAllowlist(SDKContext &Ctx, llvm::StringSet<> &lines,
21682168static int diagnoseModuleChange (SDKContext &Ctx, SDKNodeRoot *LeftModule,
21692169 SDKNodeRoot *RightModule, StringRef OutputPath,
21702170 llvm::StringSet<> ProtocolReqAllowlist,
2171+ bool DisableFailOnError,
21712172 bool CompilerStyleDiags,
21722173 StringRef SerializedDiagPath,
21732174 StringRef BreakageAllowlistPath,
@@ -2192,7 +2193,7 @@ static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
21922193 BreakageAllowlistPath);
21932194 }
21942195 auto pConsumer = std::make_unique<FilteringDiagnosticConsumer>(
2195- createDiagConsumer (*OS, FailOnError, CompilerStyleDiags,
2196+ createDiagConsumer (*OS, FailOnError, DisableFailOnError, CompilerStyleDiags,
21962197 SerializedDiagPath),
21972198 std::move (allowedBreakages));
21982199 SWIFT_DEFER { pConsumer->finishProcessing (); };
@@ -2214,6 +2215,7 @@ static int diagnoseModuleChange(SDKContext &Ctx, SDKNodeRoot *LeftModule,
22142215static int diagnoseModuleChange (StringRef LeftPath, StringRef RightPath,
22152216 StringRef OutputPath, CheckerOptions Opts,
22162217 llvm::StringSet<> ProtocolReqAllowlist,
2218+ bool DisableFailOnError,
22172219 bool CompilerStyleDiags,
22182220 StringRef SerializedDiagPath,
22192221 StringRef BreakageAllowlistPath,
@@ -2233,7 +2235,7 @@ static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
22332235 RightCollector.deSerialize (RightPath);
22342236 return diagnoseModuleChange (
22352237 Ctx, LeftCollector.getSDKRoot (), RightCollector.getSDKRoot (), OutputPath,
2236- std::move (ProtocolReqAllowlist), CompilerStyleDiags, SerializedDiagPath,
2238+ std::move (ProtocolReqAllowlist), DisableFailOnError, CompilerStyleDiags, SerializedDiagPath,
22372239 BreakageAllowlistPath, DebugMapping);
22382240}
22392241
@@ -2517,6 +2519,7 @@ class SwiftAPIDigesterInvocation {
25172519 std::vector<std::string> PreferInterfaceForModules;
25182520 std::string ResourceDir;
25192521 std::string ModuleCachePath;
2522+ bool DisableFailOnError;
25202523
25212524public:
25222525 SwiftAPIDigesterInvocation (const std::string &ExecPath)
@@ -2618,6 +2621,7 @@ class SwiftAPIDigesterInvocation {
26182621 ResourceDir = ParsedArgs.getLastArgValue (OPT_resource_dir).str ();
26192622 ModuleCachePath = ParsedArgs.getLastArgValue (OPT_module_cache_path).str ();
26202623 DebugMapping = ParsedArgs.hasArg (OPT_debug_mapping);
2624+ DisableFailOnError = ParsedArgs.hasArg (OPT_disable_fail_on_error);
26212625
26222626 CheckerOpts.AvoidLocation = ParsedArgs.hasArg (OPT_avoid_location);
26232627 CheckerOpts.AvoidToolArgs = ParsedArgs.hasArg (OPT_avoid_tool_args);
@@ -2820,21 +2824,21 @@ class SwiftAPIDigesterInvocation {
28202824 case ComparisonInputMode::BothJson: {
28212825 return diagnoseModuleChange (
28222826 SDKJsonPaths[0 ], SDKJsonPaths[1 ], OutputFile, CheckerOpts,
2823- std::move (protocolAllowlist), CompilerStyleDiags,
2827+ std::move (protocolAllowlist), DisableFailOnError, CompilerStyleDiags,
28242828 SerializedDiagPath, BreakageAllowlistPath, DebugMapping);
28252829 }
28262830 case ComparisonInputMode::BaselineJson: {
28272831 SDKContext Ctx (CheckerOpts);
28282832 return diagnoseModuleChange (
28292833 Ctx, getBaselineFromJson (Ctx), getSDKRoot (Ctx, false ), OutputFile,
2830- std::move (protocolAllowlist), CompilerStyleDiags,
2834+ std::move (protocolAllowlist), DisableFailOnError, CompilerStyleDiags,
28312835 SerializedDiagPath, BreakageAllowlistPath, DebugMapping);
28322836 }
28332837 case ComparisonInputMode::BothLoad: {
28342838 SDKContext Ctx (CheckerOpts);
28352839 return diagnoseModuleChange (
28362840 Ctx, getSDKRoot (Ctx, true ), getSDKRoot (Ctx, false ), OutputFile,
2837- std::move (protocolAllowlist), CompilerStyleDiags,
2841+ std::move (protocolAllowlist), DisableFailOnError, CompilerStyleDiags,
28382842 SerializedDiagPath, BreakageAllowlistPath, DebugMapping);
28392843 }
28402844 }
0 commit comments