mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
swift-module-digester: output ABI/API diagnostics to a path instead of stdout.
This is handy for scripts.
This commit is contained in:
@@ -2006,6 +2006,7 @@ static void findTypeMemberDiffs(NodePtr leftSDKRoot, NodePtr rightSDKRoot,
|
||||
}
|
||||
|
||||
static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
|
||||
StringRef OutputPath,
|
||||
CheckerOptions Opts) {
|
||||
if (!fs::exists(LeftPath)) {
|
||||
llvm::errs() << LeftPath << " does not exist\n";
|
||||
@@ -2015,7 +2016,14 @@ static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
|
||||
llvm::errs() << RightPath << " does not exist\n";
|
||||
return 1;
|
||||
}
|
||||
ModuleDifferDiagsConsumer PDC(true);
|
||||
llvm::raw_ostream *OS = &llvm::errs();
|
||||
std::unique_ptr<llvm::raw_ostream> FileOS;
|
||||
if (!OutputPath.empty()) {
|
||||
std::error_code EC;
|
||||
FileOS.reset(new llvm::raw_fd_ostream(OutputPath, EC, llvm::sys::fs::F_None));
|
||||
OS = FileOS.get();
|
||||
}
|
||||
ModuleDifferDiagsConsumer PDC(true, *OS);
|
||||
SDKContext Ctx(Opts);
|
||||
Ctx.getDiags().addConsumer(PDC);
|
||||
|
||||
@@ -2333,7 +2341,8 @@ int main(int argc, char *argv[]) {
|
||||
options::OutputFile, IgnoredUsrs, Opts);
|
||||
else
|
||||
return diagnoseModuleChange(options::SDKJsonPaths[0],
|
||||
options::SDKJsonPaths[1], Opts);
|
||||
options::SDKJsonPaths[1],
|
||||
options::OutputFile, Opts);
|
||||
case ActionType::DeserializeSDK:
|
||||
case ActionType::DeserializeDiffItems: {
|
||||
if (options::SDKJsonPaths.size() != 1) {
|
||||
|
||||
Reference in New Issue
Block a user