From c5e7d22baf4eae11fab4e4034f265058fdfa1269 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Fri, 30 Nov 2018 17:02:38 -0800 Subject: [PATCH] [ParseableInterface] Include "import Swift" in swiftinterface files Otherwise we've got a problem with modules that use -parse-stdlib but aren't the stdlib themselves. Ideally we'd /only/ print this in that case, but we don't have that information at this point in the pipeline and I'm not sure it would be a good idea to include it in the set of options we pass through. --- lib/Frontend/ParseableInterfaceSupport.cpp | 3 +-- test/ParseableInterface/imports-submodule-order.swift | 1 + test/ParseableInterface/imports.swift | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Frontend/ParseableInterfaceSupport.cpp b/lib/Frontend/ParseableInterfaceSupport.cpp index 33d81d4121fd6..2321c1a434d99 100644 --- a/lib/Frontend/ParseableInterfaceSupport.cpp +++ b/lib/Frontend/ParseableInterfaceSupport.cpp @@ -528,8 +528,7 @@ static void printImports(raw_ostream &out, ModuleDecl *M) { publicImportSet.insert(publicImports.begin(), publicImports.end()); for (auto import : allImports) { - if (import.second->isStdlibModule() || - import.second->isOnoneSupportModule() || + if (import.second->isOnoneSupportModule() || import.second->isBuiltinModule()) { continue; } diff --git a/test/ParseableInterface/imports-submodule-order.swift b/test/ParseableInterface/imports-submodule-order.swift index 5ec05c36c5c19..d6694bbc5ea87 100644 --- a/test/ParseableInterface/imports-submodule-order.swift +++ b/test/ParseableInterface/imports-submodule-order.swift @@ -17,6 +17,7 @@ // CHECK-NOT: import // CHECK: import X.Submodule{{$}} // CHECK-NEXT: import Y.Submodule{{$}} +// CHECK-NEXT: {{^}}import Swift{{$}} // CHECK-NEXT: import X{{$}} // CHECK-NEXT: import Y{{$}} // CHECK-NOT: import diff --git a/test/ParseableInterface/imports.swift b/test/ParseableInterface/imports.swift index 6482e7f55a224..337e5979a1d3c 100644 --- a/test/ParseableInterface/imports.swift +++ b/test/ParseableInterface/imports.swift @@ -15,5 +15,6 @@ import D // CHECK-NEXT: {{^}}import B.B3{{$}} // CHECK-NEXT: {{^}}import C/*.c*/{{$}} // CHECK-NEXT: {{^}}import D{{$}} +// CHECK-NEXT: {{^}}import Swift{{$}} // CHECK-NEXT: {{^}}@_exported import empty{{$}} // CHECK-NOT: import