Don't suggest using 'xcrun' when not on OS X.

Also, suggest "xcrun swiftc" instead of "xcrun swift" on OS X, since
"swift" already infers SDKs and we shouldn't get into this situation.
(We shouldn't get into it on non-OS-X either thanks to the previous
commit, but just in case.)

rdar://problem/22440615

Swift SVN r31535
This commit is contained in:
Jordan Rose
2015-08-27 18:47:26 +00:00
parent c1ab32e7f2
commit 7ec4c4fef3
4 changed files with 8 additions and 8 deletions

View File

@@ -331,8 +331,8 @@ ERROR(sema_no_import_repl,sema_nb,none,
NOTE(sema_no_import_no_sdk,sema_nb,none, NOTE(sema_no_import_no_sdk,sema_nb,none,
"did you forget to set an SDK using -sdk or SDKROOT?", ()) "did you forget to set an SDK using -sdk or SDKROOT?", ())
NOTE(sema_no_import_no_sdk_xcrun,sema_nb,none, NOTE(sema_no_import_no_sdk_xcrun,sema_nb,none,
"use \"xcrun -sdk macosx swift\" to select the default OS X SDK installed " "use \"xcrun -sdk macosx swiftc\" to select the default OS X SDK "
"with Xcode", ()) "installed with Xcode", ())
ERROR(sema_import_current_module,sema_nb,none, ERROR(sema_import_current_module,sema_nb,none,
"cannot import module being compiled", ()) "cannot import module being compiled", ())
ERROR(sema_opening_import,sema_nb,Fatal, ERROR(sema_opening_import,sema_nb,Fatal,

View File

@@ -169,7 +169,8 @@ void NameBinder::addImport(
diagKind = diag::sema_no_import_repl; diagKind = diag::sema_no_import_repl;
diagnose(ID->getLoc(), diagKind, modulePathStr); diagnose(ID->getLoc(), diagKind, modulePathStr);
if (Context.SearchPathOpts.SDKPath.empty()) { if (Context.SearchPathOpts.SDKPath.empty() &&
llvm::Triple(llvm::sys::getProcessTriple()).isMacOSX()) {
diagnose(SourceLoc(), diag::sema_no_import_no_sdk); diagnose(SourceLoc(), diag::sema_no_import_no_sdk);
diagnose(SourceLoc(), diag::sema_no_import_no_sdk_xcrun); diagnose(SourceLoc(), diag::sema_no_import_no_sdk_xcrun);
} }

View File

@@ -253,7 +253,8 @@ FileUnit *SerializedModuleLoader::loadAST(
missingNames); missingNames);
} }
if (Ctx.SearchPathOpts.SDKPath.empty()) { if (Ctx.SearchPathOpts.SDKPath.empty() &&
llvm::Triple(llvm::sys::getProcessTriple()).isMacOSX()) {
Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk); Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk);
Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk_xcrun); Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk_xcrun);
} }
@@ -263,7 +264,8 @@ FileUnit *SerializedModuleLoader::loadAST(
case serialization::Status::MissingShadowedModule: { case serialization::Status::MissingShadowedModule: {
Ctx.Diags.diagnose(*diagLoc, diag::serialization_missing_shadowed_module, Ctx.Diags.diagnose(*diagLoc, diag::serialization_missing_shadowed_module,
M.getName()); M.getName());
if (Ctx.SearchPathOpts.SDKPath.empty()) { if (Ctx.SearchPathOpts.SDKPath.empty() &&
llvm::Triple(llvm::sys::getProcessTriple()).isMacOSX()) {
Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk); Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk);
Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk_xcrun); Ctx.Diags.diagnose(SourceLoc(), diag::sema_no_import_no_sdk_xcrun);
} }

View File

@@ -2,14 +2,11 @@
// RUN: not %target-swift-frontend -parse %s -resource-dir / 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=NO-STDLIB %s // RUN: not %target-swift-frontend -parse %s -resource-dir / 2>&1 | FileCheck -check-prefix=CHECK -check-prefix=NO-STDLIB %s
// NO-MODULE: error: no such module 'NonExistent' // NO-MODULE: error: no such module 'NonExistent'
// NO-MODULE: note: did you forget to set an SDK using -sdk or SDKROOT?
// NO-MODULE-NEXT: use "{{.+}}" to select the default OS X SDK installed with Xcode
// NO-STDLIB: error: unable to load standard library for target '{{.+-.+}}' // NO-STDLIB: error: unable to load standard library for target '{{.+-.+}}'
// CHECK-NOT: error // CHECK-NOT: error
// CHECK-NOT: warning // CHECK-NOT: warning
// CHECK-NOT: note
import NonExistent import NonExistent
// No subsequent diagnostics after fatal errors. // No subsequent diagnostics after fatal errors.