Skip to content

Commit efba2f6

Browse files
committed
---
yaml --- r: 345591 b: refs/heads/master c: 7514009 h: refs/heads/master i: 345589: b9487cc 345587: 582e45e 345583: f1b192f
1 parent f8891de commit efba2f6

File tree

8 files changed

+27
-15
lines changed

8 files changed

+27
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9a44b3cccc2d4a6fdca0e72467476f8ec8bda224
2+
refs/heads/master: 75140095eb8fd19944d88da2c2f9663d2232ef4c
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/test/api-digester/apinotes-diags.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// RUN: %api-digester %clang-importer-sdk-nosource -dump-sdk -module APINotesTest -o %t.dump1.json -module-cache-path %t.module-cache -swift-version 5 -I %S/Inputs/APINotesLeft
66
// RUN: %api-digester %clang-importer-sdk-nosource -dump-sdk -module APINotesTest -o %t.dump2.json -module-cache-path %t.module-cache -swift-version 4 -I %S/Inputs/APINotesRight
77
// RUN: %api-digester %clang-importer-sdk-nosource -dump-sdk -module APINotesTest -o %t.dump3.json -module-cache-path %t.module-cache -swift-version 5 -I %S/Inputs/APINotesRight
8-
// RUN: %api-digester -diagnose-sdk -print-module -input-paths %t.dump1.json -input-paths %t.dump3.json > %t.result
8+
// RUN: %api-digester -diagnose-sdk -print-module -input-paths %t.dump1.json -input-paths %t.dump3.json -o %t.result
99

1010
// RUN: %clang -E -P -x c %S/Outputs/apinotes-diags.txt -o - | sed '/^\s*$/d' > %t.expected
1111
// RUN: %clang -E -P -x c %t.result -o - | sed '/^\s*$/d' > %t.result.tmp
1212
// RUN: diff -u %t.expected %t.result.tmp
1313

14-
// RUN: %api-digester -diagnose-sdk -print-module -input-paths %t.dump2.json -input-paths %t.dump3.json > %t.result
14+
// RUN: %api-digester -diagnose-sdk -print-module -input-paths %t.dump2.json -input-paths %t.dump3.json -o %t.result
1515
// RUN: %clang -E -P -x c %S/Outputs/apinotes-diags-3-4.txt -o - | sed '/^\s*$/d' > %t.expected
1616
// RUN: %clang -E -P -x c %t.result -o - | sed '/^\s*$/d' > %t.result.tmp
1717
// RUN: diff -u %t.expected %t.result.tmp

trunk/test/api-digester/compare-dump.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
// RUN: %swift -emit-module -o %t.mod/cake2.swiftmodule %S/Inputs/cake2.swift -parse-as-library -enable-resilience -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource
66
// RUN: %api-digester -dump-sdk -module cake1 -o %t.dump1.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %t.mod -I %S/Inputs/APINotesLeft
77
// RUN: %api-digester -dump-sdk -module cake2 -o %t.dump2.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %t.mod -I %S/Inputs/APINotesRight
8-
// RUN: %api-digester -diagnose-sdk -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json > %t.result
8+
// RUN: %api-digester -diagnose-sdk -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json -o %t.result
99

1010
// RUN: %clang -E -P -x c %S/Outputs/Cake.txt -o - | sed '/^\s*$/d' > %t.expected
1111
// RUN: %clang -E -P -x c %t.result -o - | sed '/^\s*$/d' > %t.result.tmp
1212
// RUN: diff -u %t.expected %t.result.tmp
1313

1414
// RUN: %api-digester -dump-sdk -module cake1 -o %t.dump1.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %t.mod -I %S/Inputs/APINotesLeft -abi
1515
// RUN: %api-digester -dump-sdk -module cake2 -o %t.dump2.json -module-cache-path %t.module-cache %clang-importer-sdk-nosource -I %t.mod -I %S/Inputs/APINotesRight -abi
16-
// RUN: %api-digester -diagnose-sdk -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json -abi > %t.result
16+
// RUN: %api-digester -diagnose-sdk -print-module --input-paths %t.dump1.json -input-paths %t.dump2.json -abi -o %t.result
1717

1818
// RUN: %clang -E -P -x c %S/Outputs/Cake-abi.txt -o - | sed '/^\s*$/d' > %t.abi.expected
1919
// RUN: %clang -E -P -x c %t.result -o - | sed '/^\s*$/d' > %t.abi.result.tmp

trunk/test/api-digester/stability-stdlib-abi.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %empty-directory(%t.tmp)
33
// mkdir %t.tmp/module-cache && mkdir %t.tmp/dummy.sdk
44
// RUN: %api-digester -dump-sdk -module Swift -o %t.tmp/current-stdlib.json -module-cache-path %t.tmp/module-cache -sdk %t.tmp/dummy.sdk -abi
5-
// RUN: %api-digester -diagnose-sdk -input-paths %S/Inputs/stdlib-stable-abi.json -input-paths %t.tmp/current-stdlib.json -abi >> %t.tmp/changes.txt
5+
// RUN: %api-digester -diagnose-sdk -input-paths %S/Inputs/stdlib-stable-abi.json -input-paths %t.tmp/current-stdlib.json -abi -o %t.tmp/changes.txt
66
// RUN: %clang -E -P -x c %S/Outputs/stability-stdlib-abi.swift.expected -o - | sed '/^\s*$/d' > %t.tmp/stability-stdlib-abi.swift.expected
77
// RUN: %clang -E -P -x c %t.tmp/changes.txt -o - | sed '/^\s*$/d' > %t.tmp/changes.txt.tmp
88
// RUN: diff -u %t.tmp/stability-stdlib-abi.swift.expected %t.tmp/changes.txt.tmp

trunk/test/api-digester/stability-stdlib-source.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %empty-directory(%t.tmp)
33
// mkdir %t.tmp/module-cache && mkdir %t.tmp/dummy.sdk
44
// RUN: %api-digester -dump-sdk -module Swift -o %t.tmp/current-stdlib.json -module-cache-path %t.tmp/module-cache -sdk %t.tmp/dummy.sdk
5-
// RUN: %api-digester -diagnose-sdk -input-paths %S/Inputs/stdlib-stable.json -input-paths %t.tmp/current-stdlib.json >> %t.tmp/changes.txt
5+
// RUN: %api-digester -diagnose-sdk -input-paths %S/Inputs/stdlib-stable.json -input-paths %t.tmp/current-stdlib.json -o %t.tmp/changes.txt
66
// RUN: %clang -E -P -x c %S/Outputs/stability-stdlib-source.swift.expected -o - | sed '/^\s*$/d' > %t.tmp/stability-stdlib-source.swift.expected
77
// RUN: %clang -E -P -x c %t.tmp/changes.txt -o - | sed '/^\s*$/d' > %t.tmp/changes.txt.tmp
88
// RUN: diff -u %t.tmp/stability-stdlib-source.swift.expected %t.tmp/changes.txt.tmp

trunk/tools/swift-api-digester/ModuleDiagsConsumer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ static StringRef getCategoryName(uint32_t ID) {
7777
}
7878

7979
swift::ide::api::
80-
ModuleDifferDiagsConsumer::ModuleDifferDiagsConsumer(bool DiagnoseModuleDiff):
81-
PrintingDiagnosticConsumer(llvm::errs()),
80+
ModuleDifferDiagsConsumer::ModuleDifferDiagsConsumer(bool DiagnoseModuleDiff,
81+
llvm::raw_ostream &OS):
82+
PrintingDiagnosticConsumer(OS), OS(OS),
8283
DiagnoseModuleDiff(DiagnoseModuleDiff) {
8384
#define DIAG(KIND, ID, Options, Text, Signature) \
8485
auto ID = getCategoryName(LocalDiagID::ID); \
@@ -111,10 +112,10 @@ ModuleDifferDiagsConsumer::handleDiagnostic(SourceManager &SM, SourceLoc Loc,
111112

112113
swift::ide::api::ModuleDifferDiagsConsumer::~ModuleDifferDiagsConsumer() {
113114
for (auto &Pair: AllDiags) {
114-
llvm::outs() << "\n";
115-
llvm::outs() << Pair.first << "\n";
115+
OS << "\n";
116+
OS << Pair.first << "\n";
116117
for (auto &Item: Pair.second) {
117-
llvm::outs() << Item << "\n";
118+
OS << Item << "\n";
118119
}
119120
}
120121
}

trunk/tools/swift-api-digester/ModuleDiagsConsumer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ namespace api {
3232

3333
/// \brief Diagnostic consumer that displays diagnostics to standard output.
3434
class ModuleDifferDiagsConsumer: public PrintingDiagnosticConsumer {
35+
llvm::raw_ostream &OS;
3536
bool DiagnoseModuleDiff;
3637
llvm::MapVector<StringRef, std::set<std::string>> AllDiags;
3738
public:
38-
ModuleDifferDiagsConsumer(bool DiagnoseModuleDiff);
39+
ModuleDifferDiagsConsumer(bool DiagnoseModuleDiff,
40+
llvm::raw_ostream &OS = llvm::errs());
3941
~ModuleDifferDiagsConsumer();
4042
void handleDiagnostic(SourceManager &SM, SourceLoc Loc,
4143
DiagnosticKind Kind,

trunk/tools/swift-api-digester/swift-api-digester.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,7 @@ static void findTypeMemberDiffs(NodePtr leftSDKRoot, NodePtr rightSDKRoot,
20062006
}
20072007

20082008
static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
2009+
StringRef OutputPath,
20092010
CheckerOptions Opts) {
20102011
if (!fs::exists(LeftPath)) {
20112012
llvm::errs() << LeftPath << " does not exist\n";
@@ -2015,7 +2016,14 @@ static int diagnoseModuleChange(StringRef LeftPath, StringRef RightPath,
20152016
llvm::errs() << RightPath << " does not exist\n";
20162017
return 1;
20172018
}
2018-
ModuleDifferDiagsConsumer PDC(true);
2019+
llvm::raw_ostream *OS = &llvm::errs();
2020+
std::unique_ptr<llvm::raw_ostream> FileOS;
2021+
if (!OutputPath.empty()) {
2022+
std::error_code EC;
2023+
FileOS.reset(new llvm::raw_fd_ostream(OutputPath, EC, llvm::sys::fs::F_None));
2024+
OS = FileOS.get();
2025+
}
2026+
ModuleDifferDiagsConsumer PDC(true, *OS);
20192027
SDKContext Ctx(Opts);
20202028
Ctx.getDiags().addConsumer(PDC);
20212029

@@ -2330,7 +2338,8 @@ int main(int argc, char *argv[]) {
23302338
options::OutputFile, IgnoredUsrs, Opts);
23312339
else
23322340
return diagnoseModuleChange(options::SDKJsonPaths[0],
2333-
options::SDKJsonPaths[1], Opts);
2341+
options::SDKJsonPaths[1],
2342+
options::OutputFile, Opts);
23342343
case ActionType::DeserializeSDK:
23352344
case ActionType::DeserializeDiffItems: {
23362345
if (options::SDKJsonPaths.size() != 1) {

0 commit comments

Comments
 (0)