Use target triple for “universal” modules

When loading a module supporting multiple targets, the module loader now looks for a file named with a normalized version of the target triple first, and only falls back to the architecture name if the normalized triple is not found.
This commit is contained in:
Brent Royal-Gordon
2019-02-22 16:14:17 -08:00
parent 0df6ff4797
commit c1cc51d1f3
9 changed files with 282 additions and 15 deletions

View File

@@ -74,6 +74,17 @@ namespace swift {
///
/// This is a stop-gap until full Triple support (ala Clang) exists within swiftc.
StringRef getMajorArchitectureName(const llvm::Triple &triple);
/// Computes the normalized target triple used as the most preferred name for
/// module loading.
///
/// For platforms with module stability, this canonicalizes architecture,
/// vendor, and OS names, strips OS versions, and makes inferred environments
/// explicit. For other platforms, it returns the unmodified triple.
///
/// The input triple should already be "normalized" in the sense that
/// llvm::Triple::normalize() would not affect it.
llvm::Triple getTargetSpecificModuleTriple(const llvm::Triple &triple);
} // end namespace swift
#endif // SWIFT_BASIC_PLATFORM_H