mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[DepScan] Add missing field in JSON output
SwiftSourceModule can contain "commandLine" field and add that into the JSON output format.
This commit is contained in:
@@ -1016,20 +1016,6 @@ static void writeJSON(llvm::raw_ostream &out,
|
|||||||
5,
|
5,
|
||||||
/*trailingComma=*/true);
|
/*trailingComma=*/true);
|
||||||
out.indent(5 * 2);
|
out.indent(5 * 2);
|
||||||
out << "\"commandLine\": [\n";
|
|
||||||
for (int i = 0, count = swiftTextualDeps->command_line->count;
|
|
||||||
i < count; ++i) {
|
|
||||||
const auto &arg =
|
|
||||||
get_C_string(swiftTextualDeps->command_line->strings[i]);
|
|
||||||
out.indent(6 * 2);
|
|
||||||
out << "\"" << quote(arg) << "\"";
|
|
||||||
if (i != count - 1)
|
|
||||||
out << ",";
|
|
||||||
out << "\n";
|
|
||||||
}
|
|
||||||
out.indent(5 * 2);
|
|
||||||
out << "],\n";
|
|
||||||
out.indent(5 * 2);
|
|
||||||
out << "\"compiledModuleCandidates\": [\n";
|
out << "\"compiledModuleCandidates\": [\n";
|
||||||
for (int i = 0,
|
for (int i = 0,
|
||||||
count = swiftTextualDeps->compiled_module_candidates->count;
|
count = swiftTextualDeps->compiled_module_candidates->count;
|
||||||
@@ -1045,6 +1031,20 @@ static void writeJSON(llvm::raw_ostream &out,
|
|||||||
out.indent(5 * 2);
|
out.indent(5 * 2);
|
||||||
out << "],\n";
|
out << "],\n";
|
||||||
}
|
}
|
||||||
|
out.indent(5 * 2);
|
||||||
|
out << "\"commandLine\": [\n";
|
||||||
|
for (int i = 0, count = swiftTextualDeps->command_line->count; i < count;
|
||||||
|
++i) {
|
||||||
|
const auto &arg =
|
||||||
|
get_C_string(swiftTextualDeps->command_line->strings[i]);
|
||||||
|
out.indent(6 * 2);
|
||||||
|
out << "\"" << quote(arg) << "\"";
|
||||||
|
if (i != count - 1)
|
||||||
|
out << ",";
|
||||||
|
out << "\n";
|
||||||
|
}
|
||||||
|
out.indent(5 * 2);
|
||||||
|
out << "],\n";
|
||||||
bool hasBridgingHeaderPath =
|
bool hasBridgingHeaderPath =
|
||||||
swiftTextualDeps->bridging_header_path.data &&
|
swiftTextualDeps->bridging_header_path.data &&
|
||||||
get_C_string(swiftTextualDeps->bridging_header_path)[0] != '\0';
|
get_C_string(swiftTextualDeps->bridging_header_path)[0] != '\0';
|
||||||
|
|||||||
@@ -66,7 +66,8 @@ import SubE
|
|||||||
// CHECK-DAG: "swift": "_Concurrency"
|
// CHECK-DAG: "swift": "_Concurrency"
|
||||||
// CHECK-DAG: "swift": "_cross_import_E"
|
// CHECK-DAG: "swift": "_cross_import_E"
|
||||||
// CHECK: ],
|
// CHECK: ],
|
||||||
|
// CHECK: "commandLine":
|
||||||
|
// CHECK: "casFSRootID":
|
||||||
// CHECK: "extraPcmArgs": [
|
// CHECK: "extraPcmArgs": [
|
||||||
// CHECK-NEXT: "-Xcc",
|
// CHECK-NEXT: "-Xcc",
|
||||||
// CHECK-NEXT: "-target",
|
// CHECK-NEXT: "-target",
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ import TestModule
|
|||||||
// CHECK-NEXT: "swift": {
|
// CHECK-NEXT: "swift": {
|
||||||
// CHECK-NEXT: "moduleInterfacePath":
|
// CHECK-NEXT: "moduleInterfacePath":
|
||||||
// CHECK-NEXT: "contextHash":
|
// CHECK-NEXT: "contextHash":
|
||||||
|
// CHECK-NEXT: "compiledModuleCandidates": [
|
||||||
|
// CHECK-NEXT: TestModule.swiftmodule
|
||||||
|
// CHECK-NEXT: ],
|
||||||
// CHECK-NEXT: "commandLine": [
|
// CHECK-NEXT: "commandLine": [
|
||||||
// CHECK-NEXT: "-frontend",
|
// CHECK-NEXT: "-frontend",
|
||||||
// CHECK-NEXT: "-compile-module-from-interface",
|
// CHECK-NEXT: "-compile-module-from-interface",
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ func foo() {
|
|||||||
// CHECK-NEXT: "swift": {
|
// CHECK-NEXT: "swift": {
|
||||||
// CHECK-NEXT: "moduleInterfacePath":
|
// CHECK-NEXT: "moduleInterfacePath":
|
||||||
// CHECK-NEXT: "contextHash":
|
// CHECK-NEXT: "contextHash":
|
||||||
|
// CHECK-NEXT: "compiledModuleCandidates": [
|
||||||
|
// CHECK-NEXT: ],
|
||||||
// CHECK-NEXT: "commandLine": [
|
// CHECK-NEXT: "commandLine": [
|
||||||
// CHECK-NEXT: "-frontend",
|
// CHECK-NEXT: "-frontend",
|
||||||
// CHECK-NEXT: "-compile-module-from-interface",
|
// CHECK-NEXT: "-compile-module-from-interface",
|
||||||
|
|||||||
Reference in New Issue
Block a user