diff --git a/CMakeLists.txt b/CMakeLists.txt index c367885a7c827..26595b238764b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,7 +219,7 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "" CACHE STRING set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "" CACHE STRING "Path to the directory that contains Swift tools that are executable on the build machine") -option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES +option(SWIFT_ENABLE_MODULE_INTERFACES "Generate .swiftinterface files alongside .swiftmodule files" TRUE) diff --git a/cmake/modules/StandaloneOverlay.cmake b/cmake/modules/StandaloneOverlay.cmake index 830833be0c92d..14829c59a5085 100644 --- a/cmake/modules/StandaloneOverlay.cmake +++ b/cmake/modules/StandaloneOverlay.cmake @@ -58,7 +58,7 @@ set(SWIFT_NATIVE_CLANG_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING set(SWIFT_NATIVE_SWIFT_TOOLS_PATH "${TOOLCHAIN_DIR}/usr/bin" CACHE STRING "Path to Swift tools that are executable on the build machine.") -option(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES +option(SWIFT_ENABLE_MODULE_INTERFACES "Generate .swiftinterface files alongside .swiftmodule files." TRUE) diff --git a/cmake/modules/SwiftSource.cmake b/cmake/modules/SwiftSource.cmake index 09f525c19a874..eae444134dc25 100644 --- a/cmake/modules/SwiftSource.cmake +++ b/cmake/modules/SwiftSource.cmake @@ -323,10 +323,10 @@ function(_compile_swift_files set(sibopt_file "${module_base}.O.sib") set(sibgen_file "${module_base}.sibgen") - if(SWIFT_ENABLE_PARSEABLE_MODULE_INTERFACES) + if(SWIFT_ENABLE_MODULE_INTERFACES) set(interface_file "${module_base}.swiftinterface") list(APPEND swift_module_flags - "-emit-parseable-module-interface-path" "${interface_file}") + "-emit-module-interface-path" "${interface_file}") endif() # If we have extra regexp flags, check if we match any of the regexps. If so diff --git a/include/swift/AST/PrintOptions.h b/include/swift/AST/PrintOptions.h index c4b02bf09748b..6519e4f8eef14 100644 --- a/include/swift/AST/PrintOptions.h +++ b/include/swift/AST/PrintOptions.h @@ -490,14 +490,17 @@ struct PrintOptions { return result; } - /// Retrieve the set of options suitable for parseable module interfaces. + /// Retrieve the set of options suitable for module interfaces. /// /// This is a format that will be parsed again later, so the output must be /// consistent and well-formed. /// - /// \see swift::emitParseableInterface - static PrintOptions printParseableInterfaceFile(bool preferTypeRepr); + /// \see swift::emitSwiftInterface + static PrintOptions printSwiftInterfaceFile(bool preferTypeRepr); + /// Retrieve the set of options suitable for "Generated Interfaces", which + /// are a prettified representation of the public API of a module, to be + /// displayed to users in an editor. static PrintOptions printModuleInterface(); static PrintOptions printTypeInterface(Type T); diff --git a/include/swift/Basic/FileTypes.def b/include/swift/Basic/FileTypes.def index 2162d61d5c6da..0a20529f12f73 100644 --- a/include/swift/Basic/FileTypes.def +++ b/include/swift/Basic/FileTypes.def @@ -49,8 +49,7 @@ TYPE("dependencies", Dependencies, "d", "") TYPE("autolink", AutolinkFile, "autolink", "") TYPE("swiftmodule", SwiftModuleFile, "swiftmodule", "") TYPE("swiftdoc", SwiftModuleDocFile, "swiftdoc", "") -TYPE("swiftinterface", SwiftParseableInterfaceFile, \ - "swiftinterface", "") +TYPE("swiftinterface", SwiftModuleInterfaceFile, "swiftinterface", "") TYPE("assembly", Assembly, "s", "") TYPE("raw-sil", RawSIL, "sil", "") TYPE("raw-sib", RawSIB, "sib", "") diff --git a/include/swift/Basic/SupplementaryOutputPaths.h b/include/swift/Basic/SupplementaryOutputPaths.h index 527679d88608d..3036063309233 100644 --- a/include/swift/Basic/SupplementaryOutputPaths.h +++ b/include/swift/Basic/SupplementaryOutputPaths.h @@ -113,7 +113,7 @@ struct SupplementaryOutputPaths { /// \sa swift::writeTBDFile std::string TBDPath; - /// The path to which we should emit a parseable module interface, which can + /// The path to which we should emit a module interface, which can /// be used by a client source file to import this module. /// /// This format is similar to the binary format used for #ModuleOutputPath, @@ -121,8 +121,8 @@ struct SupplementaryOutputPaths { /// /// Currently only makes sense when the compiler has whole-module knowledge. /// - /// \sa swift::emitParseableInterface - std::string ParseableInterfaceOutputPath; + /// \sa swift::emitSwiftInterface + std::string ModuleInterfaceOutputPath; SupplementaryOutputPaths() = default; SupplementaryOutputPaths(const SupplementaryOutputPaths &) = default; @@ -132,7 +132,7 @@ struct SupplementaryOutputPaths { ModuleDocOutputPath.empty() && DependenciesFilePath.empty() && ReferenceDependenciesFilePath.empty() && SerializedDiagnosticsPath.empty() && LoadedModuleTracePath.empty() && - TBDPath.empty() && ParseableInterfaceOutputPath.empty(); + TBDPath.empty() && ModuleInterfaceOutputPath.empty(); } }; } // namespace swift diff --git a/include/swift/Driver/Driver.h b/include/swift/Driver/Driver.h index 779dc1ba7dc85..2b02e87f070c5 100644 --- a/include/swift/Driver/Driver.h +++ b/include/swift/Driver/Driver.h @@ -354,10 +354,10 @@ class Driver { StringRef workingDirectory, CommandOutput *Output) const; - void chooseParseableInterfacePath(Compilation &C, const JobAction *JA, - StringRef workingDirectory, - llvm::SmallString<128> &buffer, - CommandOutput *output) const; + void chooseModuleInterfacePath(Compilation &C, const JobAction *JA, + StringRef workingDirectory, + llvm::SmallString<128> &buffer, + CommandOutput *output) const; void chooseRemappingOutputPath(Compilation &C, const TypeToPathMap *OutputMap, CommandOutput *Output) const; diff --git a/include/swift/Frontend/Frontend.h b/include/swift/Frontend/Frontend.h index 395de845f6e42..f02499381f35b 100644 --- a/include/swift/Frontend/Frontend.h +++ b/include/swift/Frontend/Frontend.h @@ -31,7 +31,7 @@ #include "swift/ClangImporter/ClangImporter.h" #include "swift/ClangImporter/ClangImporterOptions.h" #include "swift/Frontend/FrontendOptions.h" -#include "swift/Frontend/ParseableInterfaceSupport.h" +#include "swift/Frontend/ModuleInterfaceSupport.h" #include "swift/Migrator/MigratorOptions.h" #include "swift/Parse/CodeCompletionCallbacks.h" #include "swift/Parse/Parser.h" @@ -78,7 +78,7 @@ class CompilerInvocation { SILOptions SILOpts; IRGenOptions IRGenOpts; TBDGenOptions TBDGenOpts; - ParseableInterfaceOptions ParseableInterfaceOpts; + ModuleInterfaceOptions ModuleInterfaceOpts; /// The \c SyntaxParsingCache to use when parsing the main file of this /// invocation SyntaxParsingCache *MainFileSyntaxParsingCache = nullptr; @@ -208,8 +208,8 @@ class CompilerInvocation { TBDGenOptions &getTBDGenOptions() { return TBDGenOpts; } const TBDGenOptions &getTBDGenOptions() const { return TBDGenOpts; } - ParseableInterfaceOptions &getParseableInterfaceOptions() { return ParseableInterfaceOpts; } - const ParseableInterfaceOptions &getParseableInterfaceOptions() const { return ParseableInterfaceOpts; } + ModuleInterfaceOptions &getModuleInterfaceOptions() { return ModuleInterfaceOpts; } + const ModuleInterfaceOptions &getModuleInterfaceOptions() const { return ModuleInterfaceOpts; } ClangImporterOptions &getClangImporterOptions() { return ClangImporterOpts; } const ClangImporterOptions &getClangImporterOptions() const { @@ -353,10 +353,10 @@ class CompilerInvocation { /// if not in that mode. std::string getTBDPathForWholeModule() const; - /// ParseableInterfaceOutputPath only makes sense in whole module compilation - /// mode, so return the ParseableInterfaceOutputPath when in that mode and + /// ModuleInterfaceOutputPath only makes sense in whole module compilation + /// mode, so return the ModuleInterfaceOutputPath when in that mode and /// fail an assert if not in that mode. - std::string getParseableInterfaceOutputPathForWholeModule() const; + std::string getModuleInterfaceOutputPathForWholeModule() const; SerializationOptions computeSerializationOptions(const SupplementaryOutputPaths &outs, diff --git a/include/swift/Frontend/FrontendInputsAndOutputs.h b/include/swift/Frontend/FrontendInputsAndOutputs.h index 98c91dcffb9f5..56ba02ea6956c 100644 --- a/include/swift/Frontend/FrontendInputsAndOutputs.h +++ b/include/swift/Frontend/FrontendInputsAndOutputs.h @@ -173,7 +173,7 @@ class FrontendInputsAndOutputs { private: friend class ArgsToFrontendOptionsConverter; - friend class ParseableInterfaceBuilder; + friend class ModuleInterfaceBuilder; void setMainAndSupplementaryOutputs( ArrayRef outputFiles, ArrayRef supplementaryOutputs); @@ -235,7 +235,7 @@ class FrontendInputsAndOutputs { bool hasLoadedModuleTracePath() const; bool hasModuleOutputPath() const; bool hasModuleDocOutputPath() const; - bool hasParseableInterfaceOutputPath() const; + bool hasModuleInterfaceOutputPath() const; bool hasTBDPath() const; bool hasDependencyTrackerPath() const; diff --git a/include/swift/Frontend/FrontendOptions.h b/include/swift/Frontend/FrontendOptions.h index d7c89b2be6b16..ad4f4ccd7bdd3 100644 --- a/include/swift/Frontend/FrontendOptions.h +++ b/include/swift/Frontend/FrontendOptions.h @@ -72,7 +72,7 @@ class FrontendOptions { /// The path to which we should store indexing data, if any. std::string IndexStorePath; - /// The path to look in when loading a parseable interface file, to see if a + /// The path to look in when loading a module interface file, to see if a /// binary module has already been built for use by the compiler. std::string PrebuiltModuleCachePath; diff --git a/include/swift/Frontend/ParseableInterfaceModuleLoader.h b/include/swift/Frontend/ModuleInterfaceLoader.h similarity index 81% rename from include/swift/Frontend/ParseableInterfaceModuleLoader.h rename to include/swift/Frontend/ModuleInterfaceLoader.h index 13fac832ff24f..0b027b59b9dfe 100644 --- a/include/swift/Frontend/ParseableInterfaceModuleLoader.h +++ b/include/swift/Frontend/ModuleInterfaceLoader.h @@ -1,4 +1,4 @@ -//===--- ParseableInterfaceModuleLoader.h - Loads .swiftinterface files ---===// +//===-------- ModuleInterfaceLoader.h - Loads .swiftinterface files -------===// // // This source file is part of the Swift.org open source project // @@ -10,10 +10,10 @@ // //===----------------------------------------------------------------------===// /// -/// \file This implements the logic for loading and building parseable module +/// \file This implements the logic for loading and building module /// interfaces. /// -/// === Loading Parseable Modules === +/// === Loading Module Interfaces === /// /// If there is a .swiftinterface file corresponding to a given module name /// present in the frontend's search paths, then this module loader will look in @@ -79,18 +79,19 @@ /// installed 2 forwarding modules. For the other 2 frameworks, we'll have /// compiled the interfaces and put them in the module cache. /// -/// ┌─────┐ -/// ┌─────────────────────────────┤ SDK ├─────────────────────────┐ -/// │ ┌────────────────┐ └─────┘ ┌────────────────┐ │ -/// │ ┌───────┤ Framework Dirs ├────────┐ ┌┤ Prebuilt Cache ├┐ │ -/// │ │ └────────────────┘ │ │└────────────────┘│ │ -/// │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ │ ┌───┐ ┌───┐ │ │ -/// │ │ │ I │ │ I │ │ I │ │ I │◀─┼───┼───│ P │ │ P │◀═╗│ │ -/// │ │ └───┘ └───┘ └───┘ └───┘ │ │ └───┘ └───┘ ║│ │ -/// │ │ ▲ ▲ ▲ │ │ ▲ │ ║│ │ -/// │ └────┼───────┼───────┼────────────┘ └─────╫──────┼────╫┘ │ -/// │ │ │ └──────────────────────╫──────┘ ║ │ -/// └───────┼───────┼──────────────────────────────╫───────────╫──┘ +/// ┌─────┐ +/// ┌────────────────┤ SDK ├───────────────┐ +/// │ └─────┘ │ +/// │ ┌────────────────┐ │ ┌────────────────┐ +/// │ ┌───────┤ Framework Dirs ├────────┐ │ ┌┤ Prebuilt Cache ├┐ +/// │ │ └────────────────┘ │ │ │└────────────────┘│ +/// │ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ │ │ ┌───┐ ┌───┐ │ +/// │ │ │ I │ │ I │ │ I │ │ I │◀─┼─┼─┼───│ P │ │ P │◀═╗│ +/// │ │ └───┘ └───┘ └───┘ └───┘ │ │ │ └───┘ └───┘ ║│ +/// │ │ ▲ ▲ ▲ │ │ │ ▲ │ ║│ +/// │ └────┼───────┼───────┼────────────┘ │ └─────╫──────┼────╫┘ +/// │ │ │ └──────────────┼───────╫──────┘ ║ +/// └───────┼───────┼──────────────────────┘ ║ ║ /// │ │ ┌───────────────┐ ║ ║ /// │ ┌────┼───┤ Module Cache ├────────┐ ║ ║ /// │ │ │ └───────────────┘ │ ║ ║ @@ -103,11 +104,11 @@ /// //===----------------------------------------------------------------------===// -#ifndef SWIFT_FRONTEND_PARSEABLEINTERFACEMODULELOADER_H -#define SWIFT_FRONTEND_PARSEABLEINTERFACEMODULELOADER_H +#ifndef SWIFT_FRONTEND_MODULEINTERFACELOADER_H +#define SWIFT_FRONTEND_MODULEINTERFACELOADER_H #include "swift/Basic/LLVM.h" -#include "swift/Frontend/ParseableInterfaceSupport.h" +#include "swift/Frontend/ModuleInterfaceSupport.h" #include "swift/Serialization/SerializedModuleLoader.h" namespace clang { @@ -115,7 +116,7 @@ class CompilerInstance; } namespace unittest { -class ParseableInterfaceModuleLoaderTest; +class ModuleInterfaceLoaderTest; } namespace swift { @@ -127,9 +128,9 @@ class SearchPathOptions; /// \c CompilerInstance to convert .swiftinterface files to .swiftmodule /// files on the fly, caching the resulting .swiftmodules in the module cache /// directory, and loading the serialized .swiftmodules from there. -class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase { - friend class unittest::ParseableInterfaceModuleLoaderTest; - explicit ParseableInterfaceModuleLoader( +class ModuleInterfaceLoader : public SerializedModuleLoaderBase { + friend class unittest::ModuleInterfaceLoaderTest; + explicit ModuleInterfaceLoader( ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir, DependencyTracker *tracker, ModuleLoadingMode loadMode, ArrayRef PreferInterfaceForModules, @@ -154,13 +155,13 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase { bool isCached(StringRef DepPath) override; public: - static std::unique_ptr + static std::unique_ptr create(ASTContext &ctx, StringRef cacheDir, StringRef prebuiltCacheDir, DependencyTracker *tracker, ModuleLoadingMode loadMode, ArrayRef PreferInterfaceForModules = {}, bool RemarkOnRebuildFromInterface = false) { - return std::unique_ptr( - new ParseableInterfaceModuleLoader(ctx, cacheDir, prebuiltCacheDir, + return std::unique_ptr( + new ModuleInterfaceLoader(ctx, cacheDir, prebuiltCacheDir, tracker, loadMode, PreferInterfaceForModules, RemarkOnRebuildFromInterface)); @@ -186,7 +187,7 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase { /// Extract the specified-or-defaulted -module-cache-path that winds up in /// the clang importer, for reuse as the .swiftmodule cache path when -/// building a ParseableInterfaceModuleLoader. +/// building a ModuleInterfaceLoader. std::string getModuleCachePathFromClang(const clang::CompilerInstance &Instance); diff --git a/include/swift/Frontend/ParseableInterfaceSupport.h b/include/swift/Frontend/ModuleInterfaceSupport.h similarity index 79% rename from include/swift/Frontend/ParseableInterfaceSupport.h rename to include/swift/Frontend/ModuleInterfaceSupport.h index ee82671cccdd8..7a3e54ee8bc64 100644 --- a/include/swift/Frontend/ParseableInterfaceSupport.h +++ b/include/swift/Frontend/ModuleInterfaceSupport.h @@ -1,4 +1,4 @@ -//===--- ParseableInterfaceSupport.h - swiftinterface files -----*- C++ -*-===// +//===------ ModuleInterfaceSupport.h - swiftinterface files -----*- C++ -*-===// // // This source file is part of the Swift.org open source project // @@ -10,8 +10,8 @@ // //===----------------------------------------------------------------------===// -#ifndef SWIFT_FRONTEND_PARSEABLEINTERFACESUPPORT_H -#define SWIFT_FRONTEND_PARSEABLEINTERFACESUPPORT_H +#ifndef SWIFT_FRONTEND_MODULEINTERFACESUPPORT_H +#define SWIFT_FRONTEND_MODULEINTERFACESUPPORT_H #include "swift/Basic/LLVM.h" #include "swift/Basic/Version.h" @@ -26,7 +26,7 @@ namespace swift { class ModuleDecl; /// Options for controlling the generation of the .swiftinterface output. -struct ParseableInterfaceOptions { +struct ModuleInterfaceOptions { /// Should we prefer printing TypeReprs when writing out types in a module /// interface, or should we fully-qualify them? bool PreserveTypesAsWritten = false; @@ -34,7 +34,7 @@ struct ParseableInterfaceOptions { /// Copy of all the command-line flags passed at .swiftinterface /// generation time, re-applied to CompilerInvocation when reading /// back .swiftinterface and reconstructing .swiftmodule. - std::string ParseableInterfaceFlags; + std::string Flags; }; extern version::Version InterfaceFormatVersion; @@ -42,7 +42,7 @@ extern version::Version InterfaceFormatVersion; llvm::Regex getSwiftInterfaceFormatVersionRegex(); llvm::Regex getSwiftInterfaceModuleFlagsRegex(); -/// Emit a stable, parseable interface for \p M, which can be used by a client +/// Emit a stable module interface for \p M, which can be used by a client /// source file to import this module, subject to options given by \p Opts. /// /// Unlike a serialized module, the textual format generated by @@ -55,9 +55,9 @@ llvm::Regex getSwiftInterfaceModuleFlagsRegex(); /// \return true if an error occurred /// /// \sa swift::serialize -bool emitParseableInterface(raw_ostream &out, - ParseableInterfaceOptions const &Opts, - ModuleDecl *M); +bool emitSwiftInterface(raw_ostream &out, + ModuleInterfaceOptions const &Opts, + ModuleDecl *M); } // end namespace swift diff --git a/include/swift/Parse/Lexer.h b/include/swift/Parse/Lexer.h index ffb8674c06e1b..8441a12dc17d4 100644 --- a/include/swift/Parse/Lexer.h +++ b/include/swift/Parse/Lexer.h @@ -105,7 +105,7 @@ class Lexer { Token NextToken; /// The kind of source we're lexing. This either enables special behavior for - /// parseable interfaces, or enables things like the 'sil' keyword if lexing + /// module interfaces, or enables things like the 'sil' keyword if lexing /// a .sil file. const LexerMode LexMode; diff --git a/include/swift/Serialization/SerializationOptions.h b/include/swift/Serialization/SerializationOptions.h index 73fc02b79fb43..7cce7af751f74 100644 --- a/include/swift/Serialization/SerializationOptions.h +++ b/include/swift/Serialization/SerializationOptions.h @@ -33,7 +33,7 @@ namespace swift { StringRef GroupInfoPath; StringRef ImportedHeader; StringRef ModuleLinkName; - StringRef ParseableInterface; + StringRef ModuleInterface; ArrayRef ExtraClangOptions; /// Describes a single-file dependency for this module, along with the diff --git a/include/swift/Serialization/SerializedModuleLoader.h b/include/swift/Serialization/SerializedModuleLoader.h index 634483c323dc4..908a3383ef46f 100644 --- a/include/swift/Serialization/SerializedModuleLoader.h +++ b/include/swift/Serialization/SerializedModuleLoader.h @@ -21,17 +21,17 @@ namespace swift { class ModuleFile; class LazyResolver; -/// Spceifies how to load modules when both a parseable interface and serialized +/// Spceifies how to load modules when both a module interface and serialized /// AST are present, or whether to disallow one format or the other altogether. enum class ModuleLoadingMode { - PreferParseable, + PreferInterface, PreferSerialized, - OnlyParseable, + OnlyInterface, OnlySerialized }; /// Common functionality shared between \c SerializedModuleLoader and -/// \c ParseableInterfaceModuleLoader. +/// \c ModuleInterfaceLoader. class SerializedModuleLoaderBase : public ModuleLoader { /// A { module, generation # } pair. using LoadedModulePair = std::pair, unsigned>; diff --git a/lib/AST/ASTPrinter.cpp b/lib/AST/ASTPrinter.cpp index 98607a27db367..93655487e66c5 100644 --- a/lib/AST/ASTPrinter.cpp +++ b/lib/AST/ASTPrinter.cpp @@ -95,7 +95,7 @@ static bool contributesToParentTypeStorage(const AbstractStorageDecl *ASD) { return !ND->isResilient() && ASD->hasStorage() && !ASD->isStatic(); } -PrintOptions PrintOptions::printParseableInterfaceFile(bool preferTypeRepr) { +PrintOptions PrintOptions::printSwiftInterfaceFile(bool preferTypeRepr) { PrintOptions result; result.PrintLongAttrsOnSeparateLines = true; result.TypeDefinitions = true; @@ -129,7 +129,7 @@ PrintOptions PrintOptions::printParseableInterfaceFile(bool preferTypeRepr) { printer << " " << AFD->getInlinableBodyText(scratch); }; - class ShouldPrintForParseableInterface : public ShouldPrintChecker { + class ShouldPrintForModuleInterface : public ShouldPrintChecker { bool shouldPrint(const Decl *D, const PrintOptions &options) override { // Skip anything that is marked `@_implementationOnly` itself. if (D->getAttrs().hasAttribute()) @@ -189,7 +189,7 @@ PrintOptions PrintOptions::printParseableInterfaceFile(bool preferTypeRepr) { } }; result.CurrentPrintabilityChecker = - std::make_shared(); + std::make_shared(); // FIXME: We don't really need 'public' on everything; we could just change // the default to 'public' and mark the 'internal' things. diff --git a/lib/Basic/FileTypes.cpp b/lib/Basic/FileTypes.cpp index 97d9c5e2f2c22..bf4ef9ee6b19b 100644 --- a/lib/Basic/FileTypes.cpp +++ b/lib/Basic/FileTypes.cpp @@ -79,7 +79,7 @@ bool file_types::isTextual(ID Id) { case file_types::TY_TBD: case file_types::TY_ModuleTrace: case file_types::TY_OptRecord: - case file_types::TY_SwiftParseableInterfaceFile: + case file_types::TY_SwiftModuleInterfaceFile: return true; case file_types::TY_Image: case file_types::TY_Object: @@ -136,7 +136,7 @@ bool file_types::isAfterLLVM(ID Id) { case file_types::TY_IndexData: case file_types::TY_ModuleTrace: case file_types::TY_OptRecord: - case file_types::TY_SwiftParseableInterfaceFile: + case file_types::TY_SwiftModuleInterfaceFile: return false; case file_types::TY_INVALID: llvm_unreachable("Invalid type ID."); @@ -168,7 +168,7 @@ bool file_types::isPartOfSwiftCompilation(ID Id) { case file_types::TY_dSYM: case file_types::TY_SwiftModuleFile: case file_types::TY_SwiftModuleDocFile: - case file_types::TY_SwiftParseableInterfaceFile: + case file_types::TY_SwiftModuleInterfaceFile: case file_types::TY_SerializedDiagnostics: case file_types::TY_ClangModuleFile: case file_types::TY_SwiftDeps: diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 9dd28b9075367..a5684562b96b3 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1824,7 +1824,7 @@ void Driver::buildActions(SmallVectorImpl &TopLevelActions, case file_types::TY_TBD: case file_types::TY_ModuleTrace: case file_types::TY_OptRecord: - case file_types::TY_SwiftParseableInterfaceFile: + case file_types::TY_SwiftModuleInterfaceFile: // We could in theory handle assembly or LLVM input, but let's not. // FIXME: What about LTO? Diags.diagnose(SourceLoc(), diag::error_unexpected_input_file, @@ -2547,7 +2547,7 @@ Job *Driver::buildJobsForAction(Compilation &C, const JobAction *JA, if (C.getArgs().hasArg(options::OPT_emit_module_interface, options::OPT_emit_module_interface_path)) - chooseParseableInterfacePath(C, JA, workingDirectory, Buf, Output.get()); + chooseModuleInterfacePath(C, JA, workingDirectory, Buf, Output.get()); if (C.getArgs().hasArg(options::OPT_update_code) && isa(JA)) chooseRemappingOutputPath(C, OutputMap, Output.get()); @@ -2844,7 +2844,7 @@ void Driver::chooseRemappingOutputPath(Compilation &C, } } -void Driver::chooseParseableInterfacePath(Compilation &C, const JobAction *JA, +void Driver::chooseModuleInterfacePath(Compilation &C, const JobAction *JA, StringRef workingDirectory, llvm::SmallString<128> &buffer, CommandOutput *output) const { @@ -2866,9 +2866,9 @@ void Driver::chooseParseableInterfacePath(Compilation &C, const JobAction *JA, StringRef outputPath = *getOutputFilenameFromPathArgOrAsTopLevel( C.getOutputInfo(), C.getArgs(), options::OPT_emit_module_interface_path, - file_types::TY_SwiftParseableInterfaceFile, + file_types::TY_SwiftModuleInterfaceFile, /*TreatAsTopLevelOutput*/true, workingDirectory, buffer); - output->setAdditionalOutputForType(file_types::TY_SwiftParseableInterfaceFile, + output->setAdditionalOutputForType(file_types::TY_SwiftModuleInterfaceFile, outputPath); } diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index e938f825628a9..b199a3ee46b33 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -530,7 +530,7 @@ const char *ToolChain::JobContext::computeFrontendModeForCompile() const { case file_types::TY_ModuleTrace: case file_types::TY_TBD: case file_types::TY_OptRecord: - case file_types::TY_SwiftParseableInterfaceFile: + case file_types::TY_SwiftModuleInterfaceFile: llvm_unreachable("Output type can never be primary output."); case file_types::TY_INVALID: llvm_unreachable("Invalid type ID"); @@ -640,8 +640,8 @@ void ToolChain::JobContext::addFrontendSupplementaryOutputArguments( "-emit-module-doc-path"); addOutputsOfType(arguments, Output, Args, - file_types::ID::TY_SwiftParseableInterfaceFile, - "-emit-parseable-module-interface-path"); + file_types::ID::TY_SwiftModuleInterfaceFile, + "-emit-module-interface-path"); addOutputsOfType(arguments, Output, Args, file_types::TY_SerializedDiagnostics, @@ -769,7 +769,7 @@ ToolChain::constructInvocation(const BackendJobAction &job, case file_types::TY_Remapping: case file_types::TY_ModuleTrace: case file_types::TY_OptRecord: - case file_types::TY_SwiftParseableInterfaceFile: + case file_types::TY_SwiftModuleInterfaceFile: llvm_unreachable("Output type can never be primary output."); case file_types::TY_INVALID: llvm_unreachable("Invalid type ID"); @@ -908,8 +908,8 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job, addOutputsOfType(Arguments, context.Output, context.Args, file_types::TY_SwiftModuleDocFile, "-emit-module-doc-path"); addOutputsOfType(Arguments, context.Output, context.Args, - file_types::ID::TY_SwiftParseableInterfaceFile, - "-emit-parseable-module-interface-path"); + file_types::ID::TY_SwiftModuleInterfaceFile, + "-emit-module-interface-path"); addOutputsOfType(Arguments, context.Output, context.Args, file_types::TY_SerializedDiagnostics, "-serialize-diagnostics-path"); diff --git a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp index d2d7c8f3586f6..931bb5ef28d19 100644 --- a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp +++ b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp @@ -536,7 +536,7 @@ bool ArgsToFrontendOptionsConverter::checkUnusedSupplementaryOutputPaths() return true; } if (!FrontendOptions::canActionEmitInterface(Opts.RequestedAction) && - Opts.InputsAndOutputs.hasParseableInterfaceOutputPath()) { + Opts.InputsAndOutputs.hasModuleInterfaceOutputPath()) { Diags.diagnose(SourceLoc(), diag::error_mode_cannot_emit_interface); return true; } diff --git a/lib/Frontend/ArgsToFrontendOutputsConverter.cpp b/lib/Frontend/ArgsToFrontendOutputsConverter.cpp index 9e135c1517946..c18818a4daf5c 100644 --- a/lib/Frontend/ArgsToFrontendOutputsConverter.cpp +++ b/lib/Frontend/ArgsToFrontendOutputsConverter.cpp @@ -294,13 +294,13 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments() auto loadedModuleTrace = getSupplementaryFilenamesFromArguments( options::OPT_emit_loaded_module_trace_path); auto TBD = getSupplementaryFilenamesFromArguments(options::OPT_emit_tbd_path); - auto parseableInterfaceOutput = getSupplementaryFilenamesFromArguments( + auto moduleInterfaceOutput = getSupplementaryFilenamesFromArguments( options::OPT_emit_module_interface_path); if (!objCHeaderOutput || !moduleOutput || !moduleDocOutput || !dependenciesFile || !referenceDependenciesFile || !serializedDiagnostics || !fixItsOutput || !loadedModuleTrace || !TBD || - !parseableInterfaceOutput) { + !moduleInterfaceOutput) { return None; } std::vector result; @@ -318,7 +318,7 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments() sop.FixItsOutputPath = (*fixItsOutput)[i]; sop.LoadedModuleTracePath = (*loadedModuleTrace)[i]; sop.TBDPath = (*TBD)[i]; - sop.ParseableInterfaceOutputPath = (*parseableInterfaceOutput)[i]; + sop.ModuleInterfaceOutputPath = (*moduleInterfaceOutput)[i]; result.push_back(sop); } @@ -395,8 +395,8 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput( defaultSupplementaryOutputPathExcludingExtension); // There is no non-path form of -emit-interface-path - auto parseableInterfaceOutputPath = - pathsFromArguments.ParseableInterfaceOutputPath; + auto ModuleInterfaceOutputPath = + pathsFromArguments.ModuleInterfaceOutputPath; ID emitModuleOption; std::string moduleExtension; @@ -419,7 +419,7 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput( sop.FixItsOutputPath = fixItsOutputPath; sop.LoadedModuleTracePath = loadedModuleTracePath; sop.TBDPath = tbdPath; - sop.ParseableInterfaceOutputPath = parseableInterfaceOutputPath; + sop.ModuleInterfaceOutputPath = ModuleInterfaceOutputPath; return sop; } @@ -494,8 +494,8 @@ createFromTypeToPathMap(const TypeToPathMap *map) { {file_types::TY_SerializedDiagnostics, paths.SerializedDiagnosticsPath}, {file_types::TY_ModuleTrace, paths.LoadedModuleTracePath}, {file_types::TY_TBD, paths.TBDPath}, - {file_types::TY_SwiftParseableInterfaceFile, - paths.ParseableInterfaceOutputPath} + {file_types::TY_SwiftModuleInterfaceFile, + paths.ModuleInterfaceOutputPath} }; for (const std::pair &typeAndString : typesAndStrings) { diff --git a/lib/Frontend/CMakeLists.txt b/lib/Frontend/CMakeLists.txt index afdcf1781bd8f..56b9700bc9809 100644 --- a/lib/Frontend/CMakeLists.txt +++ b/lib/Frontend/CMakeLists.txt @@ -7,8 +7,9 @@ add_swift_host_library(swiftFrontend STATIC Frontend.cpp FrontendInputsAndOutputs.cpp FrontendOptions.cpp - ParseableInterfaceModuleLoader.cpp - ParseableInterfaceSupport.cpp + ModuleInterfaceBuilder.cpp + ModuleInterfaceLoader.cpp + ModuleInterfaceSupport.cpp PrintingDiagnosticConsumer.cpp SerializedDiagnosticConsumer.cpp) add_dependencies(swiftFrontend diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 5323c4b399a8c..7e71e03779067 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -208,8 +208,8 @@ static void PrintArg(raw_ostream &OS, const char *Arg, StringRef TempDir) { OS << '"'; } -static void ParseParseableInterfaceArgs(ParseableInterfaceOptions &Opts, - ArgList &Args) { +static void ParseModuleInterfaceArgs(ModuleInterfaceOptions &Opts, + ArgList &Args) { using namespace options; Opts.PreserveTypesAsWritten |= @@ -218,17 +218,17 @@ static void ParseParseableInterfaceArgs(ParseableInterfaceOptions &Opts, /// Save a copy of any flags marked as ModuleInterfaceOption, if running /// in a mode that is going to emit a .swiftinterface file. -static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts, - FrontendOptions &FOpts, - ArgList &Args, DiagnosticEngine &Diags) { - if (!FOpts.InputsAndOutputs.hasParseableInterfaceOutputPath()) +static void SaveModuleInterfaceArgs(ModuleInterfaceOptions &Opts, + FrontendOptions &FOpts, + ArgList &Args, DiagnosticEngine &Diags) { + if (!FOpts.InputsAndOutputs.hasModuleInterfaceOutputPath()) return; ArgStringList RenderedArgs; for (auto A : Args) { if (A->getOption().hasFlag(options::ModuleInterfaceOption)) A->render(Args, RenderedArgs); } - llvm::raw_string_ostream OS(Opts.ParseableInterfaceFlags); + llvm::raw_string_ostream OS(Opts.Flags); interleave(RenderedArgs, [&](const char *Argument) { PrintArg(OS, Argument, StringRef()); }, [&] { OS << " "; }); @@ -1356,9 +1356,8 @@ bool CompilerInvocation::parseArgs( return true; } - ParseParseableInterfaceArgs(ParseableInterfaceOpts, ParsedArgs); - SaveParseableInterfaceArgs(ParseableInterfaceOpts, FrontendOpts, - ParsedArgs, Diags); + ParseModuleInterfaceArgs(ModuleInterfaceOpts, ParsedArgs); + SaveModuleInterfaceArgs(ModuleInterfaceOpts, FrontendOpts, ParsedArgs, Diags); if (ParseLangArgs(LangOpts, ParsedArgs, Diags, FrontendOpts)) { return true; diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index 0571a76fce48b..f656c416df05e 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -23,7 +23,7 @@ #include "swift/Basic/FileTypes.h" #include "swift/Basic/SourceManager.h" #include "swift/Basic/Statistic.h" -#include "swift/Frontend/ParseableInterfaceModuleLoader.h" +#include "swift/Frontend/ModuleInterfaceLoader.h" #include "swift/Parse/Lexer.h" #include "swift/SIL/SILModule.h" #include "swift/SILOptimizer/PassManager/Passes.h" @@ -114,12 +114,12 @@ std::string CompilerInvocation::getTBDPathForWholeModule() const { } std::string -CompilerInvocation::getParseableInterfaceOutputPathForWholeModule() const { +CompilerInvocation::getModuleInterfaceOutputPathForWholeModule() const { assert(getFrontendOptions().InputsAndOutputs.isWholeModule() && - "ParseableInterfaceOutputPath only makes sense when the whole module " + "ModuleInterfaceOutputPath only makes sense when the whole module " "can be seen"); return getPrimarySpecificPathsForAtMostOnePrimary() - .SupplementaryOutputs.ParseableInterfaceOutputPath; + .SupplementaryOutputs.ModuleInterfaceOutputPath; } SerializationOptions CompilerInvocation::computeSerializationOptions( @@ -334,12 +334,12 @@ bool CompilerInstance::setUpModuleLoaders() { llvm::sys::Process::GetEnv("SWIFT_FORCE_MODULE_LOADING")) { if (*forceModuleLoadingMode == "prefer-interface" || *forceModuleLoadingMode == "prefer-parseable") - MLM = ModuleLoadingMode::PreferParseable; + MLM = ModuleLoadingMode::PreferInterface; else if (*forceModuleLoadingMode == "prefer-serialized") MLM = ModuleLoadingMode::PreferSerialized; else if (*forceModuleLoadingMode == "only-interface" || *forceModuleLoadingMode == "only-parseable") - MLM = ModuleLoadingMode::OnlyParseable; + MLM = ModuleLoadingMode::OnlyInterface; else if (*forceModuleLoadingMode == "only-serialized") MLM = ModuleLoadingMode::OnlySerialized; else { @@ -377,7 +377,7 @@ bool CompilerInstance::setUpModuleLoaders() { std::string ModuleCachePath = getModuleCachePathFromClang(Clang); auto &FEOpts = Invocation.getFrontendOptions(); StringRef PrebuiltModuleCachePath = FEOpts.PrebuiltModuleCachePath; - auto PIML = ParseableInterfaceModuleLoader::create( + auto PIML = ModuleInterfaceLoader::create( *Context, ModuleCachePath, PrebuiltModuleCachePath, getDependencyTracker(), MLM, FEOpts.PreferInterfaceForModules, FEOpts.RemarkOnRebuildFromModuleInterface); diff --git a/lib/Frontend/FrontendInputsAndOutputs.cpp b/lib/Frontend/FrontendInputsAndOutputs.cpp index 8cd94533a6563..ed018a0e4fa5e 100644 --- a/lib/Frontend/FrontendInputsAndOutputs.cpp +++ b/lib/Frontend/FrontendInputsAndOutputs.cpp @@ -174,7 +174,7 @@ bool FrontendInputsAndOutputs::shouldTreatAsModuleInterface() const { StringRef InputExt = llvm::sys::path::extension(getFilenameOfFirstInput()); file_types::ID InputType = file_types::lookupTypeForExtension(InputExt); - return InputType == file_types::TY_SwiftParseableInterfaceFile; + return InputType == file_types::TY_SwiftModuleInterfaceFile; } bool FrontendInputsAndOutputs::shouldTreatAsSIL() const { @@ -435,10 +435,10 @@ bool FrontendInputsAndOutputs::hasModuleDocOutputPath() const { return outs.ModuleDocOutputPath; }); } -bool FrontendInputsAndOutputs::hasParseableInterfaceOutputPath() const { +bool FrontendInputsAndOutputs::hasModuleInterfaceOutputPath() const { return hasSupplementaryOutputPath( [](const SupplementaryOutputPaths &outs) -> const std::string & { - return outs.ParseableInterfaceOutputPath; + return outs.ModuleInterfaceOutputPath; }); } bool FrontendInputsAndOutputs::hasTBDPath() const { diff --git a/lib/Frontend/FrontendOptions.cpp b/lib/Frontend/FrontendOptions.cpp index b56352dca903e..605fd1c34ae3b 100644 --- a/lib/Frontend/FrontendOptions.cpp +++ b/lib/Frontend/FrontendOptions.cpp @@ -126,7 +126,7 @@ void FrontendOptions::forAllOutputPaths( input.getPrimarySpecificPaths().SupplementaryOutputs; const std::string *outputs[] = {&outs.ModuleOutputPath, &outs.ModuleDocOutputPath, - &outs.ParseableInterfaceOutputPath, + &outs.ModuleInterfaceOutputPath, &outs.ObjCHeaderOutputPath}; for (const std::string *next : outputs) { if (!next->empty()) diff --git a/lib/Frontend/ModuleInterfaceBuilder.cpp b/lib/Frontend/ModuleInterfaceBuilder.cpp new file mode 100644 index 0000000000000..978fb5278f228 --- /dev/null +++ b/lib/Frontend/ModuleInterfaceBuilder.cpp @@ -0,0 +1,382 @@ +//===----- ModuleInterfaceBuilder.cpp - Compiles .swiftinterface files ----===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2019 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "textual-module-interface" + +#include "ModuleInterfaceBuilder.h" +#include "swift/AST/ASTContext.h" +#include "swift/AST/DiagnosticsFrontend.h" +#include "swift/AST/DiagnosticsSema.h" +#include "swift/AST/FileSystem.h" +#include "swift/AST/Module.h" +#include "llvm/ADT/StringSet.h" +#include "swift/Basic/Defer.h" +#include "swift/Frontend/Frontend.h" +#include "swift/Frontend/ModuleInterfaceSupport.h" +#include "swift/SILOptimizer/PassManager/Passes.h" +#include "swift/Serialization/SerializationOptions.h" +#include "clang/Frontend/CompilerInstance.h" +#include "clang/Lex/PreprocessorOptions.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/ADT/StringSet.h" +#include "llvm/Support/xxhash.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/CrashRecoveryContext.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Errc.h" +#include "llvm/Support/Regex.h" +#include "llvm/Support/StringSaver.h" + +using namespace swift; +using FileDependency = SerializationOptions::FileDependency; +namespace path = llvm::sys::path; + +/// If the file dependency in \p FullDepPath is inside the \p Base directory, +/// this returns its path relative to \p Base. Otherwise it returns None. +static Optional getRelativeDepPath(StringRef DepPath, + StringRef Base) { + // If Base is the root directory, or DepPath does not start with Base, bail. + if (Base.size() <= 1 || !DepPath.startswith(Base)) { + return None; + } + + assert(DepPath.size() > Base.size() && + "should never depend on a directory"); + + // Is the DepName something like ${Base}/foo.h"? + if (path::is_separator(DepPath[Base.size()])) + return DepPath.substr(Base.size() + 1); + + // Is the DepName something like "${Base}foo.h", where Base + // itself contains a trailing slash? + if (path::is_separator(Base.back())) + return DepPath.substr(Base.size()); + + // We have something next to Base, like "Base.h", that's somehow + // become a dependency. + return None; +} + +void ModuleInterfaceBuilder::configureSubInvocationInputsAndOutputs( + StringRef OutPath) { + auto &SubFEOpts = subInvocation.getFrontendOptions(); + SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly; + SubFEOpts.InputsAndOutputs.addPrimaryInputFile(interfacePath); + SupplementaryOutputPaths SOPs; + SOPs.ModuleOutputPath = OutPath.str(); + + // Pick a primary output path that will cause problems to use. + StringRef MainOut = "/"; + SubFEOpts.InputsAndOutputs + .setMainAndSupplementaryOutputs({MainOut}, {SOPs}); +} + +void ModuleInterfaceBuilder::configureSubInvocation( + const SearchPathOptions &SearchPathOpts, + const LangOptions &LangOpts, + ClangModuleLoader *ClangLoader) { + // Start with a SubInvocation that copies various state from our + // invoking ASTContext. + subInvocation.setImportSearchPaths(SearchPathOpts.ImportSearchPaths); + subInvocation.setFrameworkSearchPaths(SearchPathOpts.FrameworkSearchPaths); + subInvocation.setSDKPath(SearchPathOpts.SDKPath); + subInvocation.setInputKind(InputFileKind::SwiftModuleInterface); + subInvocation.setRuntimeResourcePath(SearchPathOpts.RuntimeResourcePath); + subInvocation.setTargetTriple(LangOpts.Target); + + subInvocation.setModuleName(moduleName); + subInvocation.setClangModuleCachePath(moduleCachePath); + subInvocation.getFrontendOptions().PrebuiltModuleCachePath = + prebuiltCachePath; + subInvocation.getFrontendOptions().TrackSystemDeps = trackSystemDependencies; + + // Respect the detailed-record preprocessor setting of the parent context. + // This, and the "raw" clang module format it implicitly enables, are + // required by sourcekitd. + if (ClangLoader) { + auto &Opts = ClangLoader->getClangInstance().getPreprocessorOpts(); + if (Opts.DetailedRecord) { + subInvocation.getClangImporterOptions().DetailedPreprocessingRecord = true; + } + } + + // Inhibit warnings from the SubInvocation since we are assuming the user + // is not in a position to fix them. + subInvocation.getDiagnosticOptions().SuppressWarnings = true; + + // Inherit this setting down so that it can affect error diagnostics (mostly + // by making them non-fatal). + subInvocation.getLangOptions().DebuggerSupport = LangOpts.DebuggerSupport; + + // Disable this; deinitializers always get printed with `@objc` even in + // modules that don't import Foundation. + subInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false; + + // Tell the subinvocation to serialize dependency hashes if asked to do so. + auto &frontendOpts = subInvocation.getFrontendOptions(); + frontendOpts.SerializeModuleInterfaceDependencyHashes = + serializeDependencyHashes; + + // Tell the subinvocation to remark on rebuilds from an interface if asked + // to do so. + frontendOpts.RemarkOnRebuildFromModuleInterface = + remarkOnRebuildFromInterface; +} + +bool ModuleInterfaceBuilder::extractSwiftInterfaceVersionAndArgs( + swift::version::Version &Vers, llvm::StringSaver &SubArgSaver, + SmallVectorImpl &SubArgs) { + auto FileOrError = swift::vfs::getFileOrSTDIN(fs, interfacePath); + if (!FileOrError) { + diags.diagnose(diagnosticLoc, diag::error_open_input_file, + interfacePath, FileOrError.getError().message()); + return true; + } + auto SB = FileOrError.get()->getBuffer(); + auto VersRe = getSwiftInterfaceFormatVersionRegex(); + auto FlagRe = getSwiftInterfaceModuleFlagsRegex(); + SmallVector VersMatches, FlagMatches; + if (!VersRe.match(SB, &VersMatches)) { + diags.diagnose(diagnosticLoc, + diag::error_extracting_version_from_module_interface); + return true; + } + if (!FlagRe.match(SB, &FlagMatches)) { + diags.diagnose(diagnosticLoc, + diag::error_extracting_flags_from_module_interface); + return true; + } + assert(VersMatches.size() == 2); + assert(FlagMatches.size() == 2); + Vers = swift::version::Version(VersMatches[1], SourceLoc(), &diags); + llvm::cl::TokenizeGNUCommandLine(FlagMatches[1], SubArgSaver, SubArgs); + return false; +} + +bool ModuleInterfaceBuilder::collectDepsForSerialization( + CompilerInstance &SubInstance, SmallVectorImpl &Deps, + bool IsHashBased) { + auto &Opts = SubInstance.getASTContext().SearchPathOpts; + SmallString<128> SDKPath(Opts.SDKPath); + path::native(SDKPath); + SmallString<128> ResourcePath(Opts.RuntimeResourcePath); + path::native(ResourcePath); + + auto DTDeps = SubInstance.getDependencyTracker()->getDependencies(); + SmallVector InitialDepNames(DTDeps.begin(), DTDeps.end()); + InitialDepNames.push_back(interfacePath); + InitialDepNames.insert(InitialDepNames.end(), + extraDependencies.begin(), extraDependencies.end()); + llvm::StringSet<> AllDepNames; + SmallString<128> Scratch; + + for (const auto &InitialDepName : InitialDepNames) { + path::native(InitialDepName, Scratch); + StringRef DepName = Scratch.str(); + + assert(moduleCachePath.empty() || !DepName.startswith(moduleCachePath)); + + // Serialize the paths of dependencies in the SDK relative to it. + Optional SDKRelativePath = getRelativeDepPath(DepName, SDKPath); + StringRef DepNameToStore = SDKRelativePath.getValueOr(DepName); + bool IsSDKRelative = SDKRelativePath.hasValue(); + + // Forwarding modules add the underlying prebuilt module to their + // dependency list -- don't serialize that. + if (!prebuiltCachePath.empty() && DepName.startswith(prebuiltCachePath)) + continue; + + if (AllDepNames.insert(DepName).second && dependencyTracker) { + dependencyTracker->addDependency(DepName, /*isSystem*/IsSDKRelative); + } + + // Don't serialize compiler-relative deps so the cache is relocatable. + if (DepName.startswith(ResourcePath)) + continue; + + auto Status = fs.status(DepName); + if (!Status) + return true; + + /// Lazily load the dependency buffer if we need it. If we're not + /// dealing with a hash-based dependencies, and if the dependency is + /// not a .swiftmodule, we can avoid opening the buffer. + std::unique_ptr DepBuf = nullptr; + auto getDepBuf = [&]() -> llvm::MemoryBuffer * { + if (DepBuf) return DepBuf.get(); + if (auto Buf = fs.getBufferForFile(DepName, /*FileSize=*/-1, + /*RequiresNullTerminator=*/false)) { + DepBuf = std::move(Buf.get()); + return DepBuf.get(); + } + return nullptr; + }; + + if (IsHashBased) { + auto buf = getDepBuf(); + if (!buf) return true; + uint64_t hash = xxHash64(buf->getBuffer()); + Deps.push_back( + FileDependency::hashBased(DepNameToStore, IsSDKRelative, + Status->getSize(), hash)); + } else { + uint64_t mtime = + Status->getLastModificationTime().time_since_epoch().count(); + Deps.push_back( + FileDependency::modTimeBased(DepNameToStore, IsSDKRelative, + Status->getSize(), mtime)); + } + } + return false; +} + +bool ModuleInterfaceBuilder::buildSwiftModule( + StringRef OutPath, bool ShouldSerializeDeps, + std::unique_ptr *ModuleBuffer) { + bool SubError = false; + bool RunSuccess = llvm::CrashRecoveryContext().RunSafelyOnThread([&] { + // Note that we don't assume cachePath is the same as the Clang + // module cache path at this point. + if (!moduleCachePath.empty()) + (void)llvm::sys::fs::create_directories(moduleCachePath); + + configureSubInvocationInputsAndOutputs(OutPath); + + FrontendOptions &FEOpts = subInvocation.getFrontendOptions(); + const auto &InputInfo = FEOpts.InputsAndOutputs.firstInput(); + StringRef InPath = InputInfo.file(); + const auto &OutputInfo = + InputInfo.getPrimarySpecificPaths().SupplementaryOutputs; + StringRef OutPath = OutputInfo.ModuleOutputPath; + + llvm::BumpPtrAllocator SubArgsAlloc; + llvm::StringSaver SubArgSaver(SubArgsAlloc); + SmallVector SubArgs; + swift::version::Version Vers; + if (extractSwiftInterfaceVersionAndArgs(Vers, SubArgSaver, SubArgs)) { + SubError = true; + return; + } + + // For now: we support anything with the same "major version" and assume + // minor versions might be interesting for debugging, or special-casing a + // compatible field variant. + if (Vers.asMajorVersion() != InterfaceFormatVersion.asMajorVersion()) { + diags.diagnose(diagnosticLoc, + diag::unsupported_version_of_module_interface, + interfacePath, Vers); + SubError = true; + return; + } + + SmallString<32> ExpectedModuleName = subInvocation.getModuleName(); + if (subInvocation.parseArgs(SubArgs, diags)) { + SubError = true; + return; + } + + if (subInvocation.getModuleName() != ExpectedModuleName) { + auto DiagKind = diag::serialization_name_mismatch; + if (subInvocation.getLangOptions().DebuggerSupport) + DiagKind = diag::serialization_name_mismatch_repl; + diags.diagnose(diagnosticLoc, DiagKind, subInvocation.getModuleName(), + ExpectedModuleName); + SubError = true; + return; + } + + // Build the .swiftmodule; this is a _very_ abridged version of the logic + // in performCompile in libFrontendTool, specialized, to just the one + // module-serialization task we're trying to do here. + LLVM_DEBUG(llvm::dbgs() << "Setting up instance to compile " + << InPath << " to " << OutPath << "\n"); + CompilerInstance SubInstance; + SubInstance.getSourceMgr().setFileSystem(&fs); + + ForwardingDiagnosticConsumer FDC(diags); + SubInstance.addDiagnosticConsumer(&FDC); + + SubInstance.createDependencyTracker(FEOpts.TrackSystemDeps); + + SWIFT_DEFER { + // Make sure to emit a generic top-level error if a module fails to + // load. This is not only good for users; it also makes sure that we've + // emitted an error in the parent diagnostic engine, which is what + // determines whether the process exits with a proper failure status. + if (SubInstance.getASTContext().hadError()) { + diags.diagnose(diagnosticLoc, diag::serialization_load_failed, + moduleName); + } + }; + + if (SubInstance.setup(subInvocation)) { + SubError = true; + return; + } + + LLVM_DEBUG(llvm::dbgs() << "Performing sema\n"); + SubInstance.performSema(); + if (SubInstance.getASTContext().hadError()) { + LLVM_DEBUG(llvm::dbgs() << "encountered errors\n"); + SubError = true; + return; + } + + SILOptions &SILOpts = subInvocation.getSILOptions(); + auto Mod = SubInstance.getMainModule(); + auto &TC = SubInstance.getSILTypes(); + auto SILMod = performSILGeneration(Mod, TC, SILOpts); + if (!SILMod) { + LLVM_DEBUG(llvm::dbgs() << "SILGen did not produce a module\n"); + SubError = true; + return; + } + + // Setup the callbacks for serialization, which can occur during the + // optimization pipeline. + SerializationOptions SerializationOpts; + std::string OutPathStr = OutPath; + SerializationOpts.OutputPath = OutPathStr.c_str(); + SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName; + + // Record any non-SDK module interface files for the debug info. + StringRef SDKPath = SubInstance.getASTContext().SearchPathOpts.SDKPath; + if (!getRelativeDepPath(InPath, SDKPath)) + SerializationOpts.ModuleInterface = InPath; + + SmallVector Deps; + bool serializeHashes = FEOpts.SerializeModuleInterfaceDependencyHashes; + if (collectDepsForSerialization(SubInstance, Deps, serializeHashes)) { + SubError = true; + return; + } + if (ShouldSerializeDeps) + SerializationOpts.Dependencies = Deps; + SILMod->setSerializeSILAction([&]() { + // We don't want to serialize module docs in the cache -- they + // will be serialized beside the interface file. + serializeToBuffers(Mod, SerializationOpts, ModuleBuffer, + /*ModuleDocBuffer*/nullptr, SILMod.get()); + }); + + LLVM_DEBUG(llvm::dbgs() << "Running SIL processing passes\n"); + if (SubInstance.performSILProcessing(SILMod.get())) { + LLVM_DEBUG(llvm::dbgs() << "encountered errors\n"); + SubError = true; + return; + } + + SubError = SubInstance.getDiags().hadAnyError(); + }); + return !RunSuccess || SubError; +} diff --git a/lib/Frontend/ModuleInterfaceBuilder.h b/lib/Frontend/ModuleInterfaceBuilder.h new file mode 100644 index 0000000000000..f8f096a39538a --- /dev/null +++ b/lib/Frontend/ModuleInterfaceBuilder.h @@ -0,0 +1,110 @@ +//===----- ModuleInterfaceBuilder.h - Compiles .swiftinterface files ------===// +// +// This source file is part of the Swift.org open source project +// +// Copyright (c) 2019 Apple Inc. and the Swift project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See https://swift.org/LICENSE.txt for license information +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors +// +//===----------------------------------------------------------------------===// + +#ifndef SWIFT_FRONTEND_MODULEINTERFACEBUILDER_H +#define SWIFT_FRONTEND_MODULEINTERFACEBUILDER_H + +#include "swift/Basic/LLVM.h" +#include "swift/Basic/SourceLoc.h" +#include "swift/Frontend/Frontend.h" +#include "swift/Serialization/SerializationOptions.h" + +namespace llvm { +namespace vfs { +class FileSystem; +} +} + +namespace swift { + +class DiagnosticEngine; +class LangOptions; +class SearchPathOptions; +class DependencyTracker; + +class ModuleInterfaceBuilder { + llvm::vfs::FileSystem &fs; + DiagnosticEngine &diags; + const StringRef interfacePath; + const StringRef moduleName; + const StringRef moduleCachePath; + const StringRef prebuiltCachePath; + const bool serializeDependencyHashes; + const bool trackSystemDependencies; + const bool remarkOnRebuildFromInterface; + const SourceLoc diagnosticLoc; + DependencyTracker *const dependencyTracker; + CompilerInvocation subInvocation; + SmallVector extraDependencies; + + void configureSubInvocationInputsAndOutputs(StringRef OutPath); + + void configureSubInvocation(const SearchPathOptions &SearchPathOpts, + const LangOptions &LangOpts, + ClangModuleLoader *ClangLoader); + + /// Populate the provided \p Deps with \c FileDependency entries for all + /// dependencies \p SubInstance's DependencyTracker recorded while compiling + /// the module, excepting .swiftmodules in \p moduleCachePath or + /// \p prebuiltCachePath. Those have _their_ dependencies added instead, both + /// to avoid having to do recursive scanning when rechecking this dependency + /// in future and to make the module caches relocatable. + bool collectDepsForSerialization( + CompilerInstance &SubInstance, + SmallVectorImpl &Deps, + bool IsHashBased); + + bool extractSwiftInterfaceVersionAndArgs( + version::Version &Vers, llvm::StringSaver &SubArgSaver, + SmallVectorImpl &SubArgs); + +public: + ModuleInterfaceBuilder(SourceManager &sourceMgr, DiagnosticEngine &diags, + const SearchPathOptions &searchPathOpts, + const LangOptions &langOpts, + ClangModuleLoader *clangImporter, + StringRef interfacePath, + StringRef moduleName, + StringRef moduleCachePath, + StringRef prebuiltCachePath, + bool serializeDependencyHashes = false, + bool trackSystemDependencies = false, + bool remarkOnRebuildFromInterface = false, + SourceLoc diagnosticLoc = SourceLoc(), + DependencyTracker *tracker = nullptr) + : fs(*sourceMgr.getFileSystem()), diags(diags), + interfacePath(interfacePath), moduleName(moduleName), + moduleCachePath(moduleCachePath), prebuiltCachePath(prebuiltCachePath), + serializeDependencyHashes(serializeDependencyHashes), + trackSystemDependencies(trackSystemDependencies), + remarkOnRebuildFromInterface(remarkOnRebuildFromInterface), + diagnosticLoc(diagnosticLoc), dependencyTracker(tracker) { + configureSubInvocation(searchPathOpts, langOpts, clangImporter); + } + + const CompilerInvocation &getSubInvocation() const { + return subInvocation; + } + + /// Ensures the requested file name is added as a dependency of the resulting + /// module. + void addExtraDependency(StringRef path) { + extraDependencies.push_back(path); + } + + bool buildSwiftModule(StringRef OutPath, bool ShouldSerializeDeps, + std::unique_ptr *ModuleBuffer); +}; + +} // end namespace swift + +#endif // defined(SWIFT_FRONTEND_MODULEINTERFACEBUILDER_H) diff --git a/lib/Frontend/ParseableInterfaceModuleLoader.cpp b/lib/Frontend/ModuleInterfaceLoader.cpp similarity index 68% rename from lib/Frontend/ParseableInterfaceModuleLoader.cpp rename to lib/Frontend/ModuleInterfaceLoader.cpp index be93b99a4cb4a..d61714a88bcb7 100644 --- a/lib/Frontend/ParseableInterfaceModuleLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -1,4 +1,4 @@ -//===-- ParseableInterfaceModuleLoader.cpp - Loads .swiftinterface files --===// +//===------ ModuleInterfaceLoader.cpp - Loads .swiftinterface files -------===// // // This source file is part of the Swift.org open source project // @@ -11,21 +11,14 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "textual-module-interface" -#include "swift/Frontend/ParseableInterfaceModuleLoader.h" +#include "swift/Frontend/ModuleInterfaceLoader.h" #include "swift/AST/ASTContext.h" #include "swift/AST/DiagnosticsFrontend.h" -#include "swift/AST/DiagnosticsSema.h" #include "swift/AST/FileSystem.h" #include "swift/AST/Module.h" -#include "swift/AST/ProtocolConformance.h" -#include "swift/Basic/Defer.h" -#include "swift/Basic/Lazy.h" #include "swift/Basic/Platform.h" -#include "swift/Basic/STLExtras.h" #include "swift/Frontend/Frontend.h" -#include "swift/Frontend/ParseableInterfaceSupport.h" -#include "swift/Frontend/PrintingDiagnosticConsumer.h" -#include "swift/SILOptimizer/PassManager/Passes.h" +#include "swift/Frontend/ModuleInterfaceSupport.h" #include "swift/Serialization/SerializationOptions.h" #include "swift/Serialization/Validation.h" #include "clang/Basic/Module.h" @@ -34,23 +27,21 @@ #include "clang/Lex/HeaderSearch.h" #include "clang/Frontend/CompilerInstance.h" #include "llvm/ADT/Hashing.h" -#include "llvm/ADT/StringSet.h" +#include "llvm/ADT/APInt.h" #include "llvm/Support/xxhash.h" #include "llvm/Support/Debug.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/CrashRecoveryContext.h" #include "llvm/Support/Path.h" #include "llvm/Support/Errc.h" -#include "llvm/Support/Regex.h" -#include "llvm/Support/StringSaver.h" #include "llvm/Support/YAMLTraits.h" +#include "ModuleInterfaceBuilder.h" using namespace swift; using FileDependency = SerializationOptions::FileDependency; /// Extract the specified-or-defaulted -module-cache-path that winds up in /// the clang importer, for reuse as the .swiftmodule cache path when -/// building a ParseableInterfaceModuleLoader. +/// building a ModuleInterfaceLoader. std::string swift::getModuleCachePathFromClang(const clang::CompilerInstance &Clang) { if (!Clang.hasPreprocessor()) @@ -224,422 +215,6 @@ static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf) { return VI.status == serialization::Status::Valid; } -static std::unique_ptr getBufferOfDependency( - llvm::vfs::FileSystem &fs, StringRef depPath) { - auto depBuf = fs.getBufferForFile(depPath, /*FileSize=*/-1, - /*RequiresNullTerminator=*/false); - if (!depBuf) { - return nullptr; - } - return std::move(depBuf.get()); -} - -static Optional getStatusOfDependency( - llvm::vfs::FileSystem &fs, StringRef depPath) { - auto status = fs.status(depPath); - if (!status) { - return None; - } - return status.get(); -} - -/// If the file dependency in \p FullDepPath is inside the \p Base directory, -/// this returns its path relative to \p Base. Otherwise it returns None. -static Optional getRelativeDepPath(StringRef DepPath, - StringRef Base) { - // If Base is the root directory, or DepPath does not start with Base, bail. - if (Base.size() <= 1 || !DepPath.startswith(Base)) { - return None; - } - - assert(DepPath.size() > Base.size() && - "should never depend on a directory"); - - // Is the DepName something like ${Base}/foo.h"? - if (path::is_separator(DepPath[Base.size()])) - return DepPath.substr(Base.size() + 1); - - // Is the DepName something like "${Base}foo.h", where Base - // itself contains a trailing slash? - if (path::is_separator(Base.back())) - return DepPath.substr(Base.size()); - - // We have something next to Base, like "Base.h", that's somehow - // become a dependency. - return None; -} - -#pragma mark - Module Building - -/// Builds a parseable module interface into a .swiftmodule at the provided -/// output path. -/// \note Needs to be in the swift namespace so CompilerInvocation can see it. -class swift::ParseableInterfaceBuilder { - llvm::vfs::FileSystem &fs; - DiagnosticEngine &diags; - const StringRef interfacePath; - const StringRef moduleName; - const StringRef moduleCachePath; - const StringRef prebuiltCachePath; - const bool serializeDependencyHashes; - const bool trackSystemDependencies; - const bool remarkOnRebuildFromInterface; - const SourceLoc diagnosticLoc; - DependencyTracker *const dependencyTracker; - CompilerInvocation subInvocation; - SmallVector extraDependencies; - - void configureSubInvocationInputsAndOutputs(StringRef OutPath) { - auto &SubFEOpts = subInvocation.getFrontendOptions(); - SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly; - SubFEOpts.InputsAndOutputs.addPrimaryInputFile(interfacePath); - SupplementaryOutputPaths SOPs; - SOPs.ModuleOutputPath = OutPath.str(); - - // Pick a primary output path that will cause problems to use. - StringRef MainOut = "/"; - SubFEOpts.InputsAndOutputs - .setMainAndSupplementaryOutputs({MainOut}, {SOPs}); - } - - void configureSubInvocation(const SearchPathOptions &SearchPathOpts, - const LangOptions &LangOpts, - ClangModuleLoader *ClangLoader) { - // Start with a SubInvocation that copies various state from our - // invoking ASTContext. - subInvocation.setImportSearchPaths(SearchPathOpts.ImportSearchPaths); - subInvocation.setFrameworkSearchPaths(SearchPathOpts.FrameworkSearchPaths); - subInvocation.setSDKPath(SearchPathOpts.SDKPath); - subInvocation.setInputKind(InputFileKind::SwiftModuleInterface); - subInvocation.setRuntimeResourcePath(SearchPathOpts.RuntimeResourcePath); - subInvocation.setTargetTriple(LangOpts.Target); - - subInvocation.setModuleName(moduleName); - subInvocation.setClangModuleCachePath(moduleCachePath); - subInvocation.getFrontendOptions().PrebuiltModuleCachePath = - prebuiltCachePath; - subInvocation.getFrontendOptions().TrackSystemDeps = trackSystemDependencies; - - // Respect the detailed-record preprocessor setting of the parent context. - // This, and the "raw" clang module format it implicitly enables, are - // required by sourcekitd. - if (ClangLoader) { - auto &Opts = ClangLoader->getClangInstance().getPreprocessorOpts(); - if (Opts.DetailedRecord) { - subInvocation.getClangImporterOptions().DetailedPreprocessingRecord = true; - } - } - - // Inhibit warnings from the SubInvocation since we are assuming the user - // is not in a position to fix them. - subInvocation.getDiagnosticOptions().SuppressWarnings = true; - - // Inherit this setting down so that it can affect error diagnostics (mostly - // by making them non-fatal). - subInvocation.getLangOptions().DebuggerSupport = LangOpts.DebuggerSupport; - - // Disable this; deinitializers always get printed with `@objc` even in - // modules that don't import Foundation. - subInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false; - - // Tell the subinvocation to serialize dependency hashes if asked to do so. - auto &frontendOpts = subInvocation.getFrontendOptions(); - frontendOpts.SerializeModuleInterfaceDependencyHashes = - serializeDependencyHashes; - - // Tell the subinvocation to remark on rebuilds from an interface if asked - // to do so. - frontendOpts.RemarkOnRebuildFromModuleInterface = - remarkOnRebuildFromInterface; - } - - bool extractSwiftInterfaceVersionAndArgs( - swift::version::Version &Vers, llvm::StringSaver &SubArgSaver, - SmallVectorImpl &SubArgs) { - auto FileOrError = swift::vfs::getFileOrSTDIN(fs, interfacePath); - if (!FileOrError) { - diags.diagnose(diagnosticLoc, diag::error_open_input_file, - interfacePath, FileOrError.getError().message()); - return true; - } - auto SB = FileOrError.get()->getBuffer(); - auto VersRe = getSwiftInterfaceFormatVersionRegex(); - auto FlagRe = getSwiftInterfaceModuleFlagsRegex(); - SmallVector VersMatches, FlagMatches; - if (!VersRe.match(SB, &VersMatches)) { - diags.diagnose(diagnosticLoc, - diag::error_extracting_version_from_module_interface); - return true; - } - if (!FlagRe.match(SB, &FlagMatches)) { - diags.diagnose(diagnosticLoc, - diag::error_extracting_flags_from_module_interface); - return true; - } - assert(VersMatches.size() == 2); - assert(FlagMatches.size() == 2); - Vers = swift::version::Version(VersMatches[1], SourceLoc(), &diags); - llvm::cl::TokenizeGNUCommandLine(FlagMatches[1], SubArgSaver, SubArgs); - return false; - } - - /// Populate the provided \p Deps with \c FileDependency entries for all - /// dependencies \p SubInstance's DependencyTracker recorded while compiling - /// the module, excepting .swiftmodules in \p moduleCachePath or - /// \p prebuiltCachePath. Those have _their_ dependencies added instead, both - /// to avoid having to do recursive scanning when rechecking this dependency - /// in future and to make the module caches relocatable. - bool collectDepsForSerialization(CompilerInstance &SubInstance, - SmallVectorImpl &Deps, - bool IsHashBased) { - auto &Opts = SubInstance.getASTContext().SearchPathOpts; - SmallString<128> SDKPath(Opts.SDKPath); - path::native(SDKPath); - SmallString<128> ResourcePath(Opts.RuntimeResourcePath); - path::native(ResourcePath); - - auto DTDeps = SubInstance.getDependencyTracker()->getDependencies(); - SmallVector InitialDepNames(DTDeps.begin(), DTDeps.end()); - InitialDepNames.push_back(interfacePath); - InitialDepNames.insert(InitialDepNames.end(), - extraDependencies.begin(), extraDependencies.end()); - llvm::StringSet<> AllDepNames; - SmallString<128> Scratch; - - for (const auto &InitialDepName : InitialDepNames) { - path::native(InitialDepName, Scratch); - StringRef DepName = Scratch.str(); - - assert(moduleCachePath.empty() || !DepName.startswith(moduleCachePath)); - - // Serialize the paths of dependencies in the SDK relative to it. - Optional SDKRelativePath = getRelativeDepPath(DepName, SDKPath); - StringRef DepNameToStore = SDKRelativePath.getValueOr(DepName); - bool IsSDKRelative = SDKRelativePath.hasValue(); - - // Forwarding modules add the underlying prebuilt module to their - // dependency list -- don't serialize that. - if (!prebuiltCachePath.empty() && DepName.startswith(prebuiltCachePath)) - continue; - - if (AllDepNames.insert(DepName).second && dependencyTracker) { - dependencyTracker->addDependency(DepName, /*isSystem*/IsSDKRelative); - } - - // Don't serialize compiler-relative deps so the cache is relocatable. - if (DepName.startswith(ResourcePath)) - continue; - - auto Status = getStatusOfDependency(fs, DepName); - if (!Status) - return true; - - /// Lazily load the dependency buffer if we need it. If we're not - /// dealing with a hash-based dependencies, and if the dependency is - /// not a .swiftmodule, we can avoid opening the buffer. - std::unique_ptr DepBuf = nullptr; - auto getDepBuf = [&]() -> llvm::MemoryBuffer * { - if (DepBuf) return DepBuf.get(); - if (auto Buf = getBufferOfDependency(fs, DepName)) { - DepBuf = std::move(Buf); - return DepBuf.get(); - } - return nullptr; - }; - - if (IsHashBased) { - auto buf = getDepBuf(); - if (!buf) return true; - uint64_t hash = xxHash64(buf->getBuffer()); - Deps.push_back( - FileDependency::hashBased(DepNameToStore, IsSDKRelative, - Status->getSize(), hash)); - } else { - uint64_t mtime = - Status->getLastModificationTime().time_since_epoch().count(); - Deps.push_back( - FileDependency::modTimeBased(DepNameToStore, IsSDKRelative, - Status->getSize(), mtime)); - } - } - return false; - } - -public: - ParseableInterfaceBuilder(SourceManager &sourceMgr, DiagnosticEngine &diags, - const SearchPathOptions &searchPathOpts, - const LangOptions &langOpts, - ClangModuleLoader *clangImporter, - StringRef interfacePath, - StringRef moduleName, - StringRef moduleCachePath, - StringRef prebuiltCachePath, - bool serializeDependencyHashes = false, - bool trackSystemDependencies = false, - bool remarkOnRebuildFromInterface = false, - SourceLoc diagnosticLoc = SourceLoc(), - DependencyTracker *tracker = nullptr) - : fs(*sourceMgr.getFileSystem()), diags(diags), - interfacePath(interfacePath), moduleName(moduleName), - moduleCachePath(moduleCachePath), prebuiltCachePath(prebuiltCachePath), - serializeDependencyHashes(serializeDependencyHashes), - trackSystemDependencies(trackSystemDependencies), - remarkOnRebuildFromInterface(remarkOnRebuildFromInterface), - diagnosticLoc(diagnosticLoc), dependencyTracker(tracker) { - configureSubInvocation(searchPathOpts, langOpts, clangImporter); - } - - const CompilerInvocation &getSubInvocation() const { - return subInvocation; - } - - /// Ensures the requested file name is added as a dependency of the resulting - /// module. - void addExtraDependency(StringRef path) { - extraDependencies.push_back(path); - } - - bool buildSwiftModule(StringRef OutPath, bool ShouldSerializeDeps, - std::unique_ptr *ModuleBuffer) { - bool SubError = false; - bool RunSuccess = llvm::CrashRecoveryContext().RunSafelyOnThread([&] { - // Note that we don't assume cachePath is the same as the Clang - // module cache path at this point. - if (!moduleCachePath.empty()) - (void)llvm::sys::fs::create_directories(moduleCachePath); - - configureSubInvocationInputsAndOutputs(OutPath); - - FrontendOptions &FEOpts = subInvocation.getFrontendOptions(); - const auto &InputInfo = FEOpts.InputsAndOutputs.firstInput(); - StringRef InPath = InputInfo.file(); - const auto &OutputInfo = - InputInfo.getPrimarySpecificPaths().SupplementaryOutputs; - StringRef OutPath = OutputInfo.ModuleOutputPath; - - llvm::BumpPtrAllocator SubArgsAlloc; - llvm::StringSaver SubArgSaver(SubArgsAlloc); - SmallVector SubArgs; - swift::version::Version Vers; - if (extractSwiftInterfaceVersionAndArgs(Vers, SubArgSaver, SubArgs)) { - SubError = true; - return; - } - - // For now: we support anything with the same "major version" and assume - // minor versions might be interesting for debugging, or special-casing a - // compatible field variant. - if (Vers.asMajorVersion() != InterfaceFormatVersion.asMajorVersion()) { - diags.diagnose(diagnosticLoc, - diag::unsupported_version_of_module_interface, - interfacePath, Vers); - SubError = true; - return; - } - - SmallString<32> ExpectedModuleName = subInvocation.getModuleName(); - if (subInvocation.parseArgs(SubArgs, diags)) { - SubError = true; - return; - } - - if (subInvocation.getModuleName() != ExpectedModuleName) { - auto DiagKind = diag::serialization_name_mismatch; - if (subInvocation.getLangOptions().DebuggerSupport) - DiagKind = diag::serialization_name_mismatch_repl; - diags.diagnose(diagnosticLoc, DiagKind, subInvocation.getModuleName(), - ExpectedModuleName); - SubError = true; - return; - } - - // Build the .swiftmodule; this is a _very_ abridged version of the logic - // in performCompile in libFrontendTool, specialized, to just the one - // module-serialization task we're trying to do here. - LLVM_DEBUG(llvm::dbgs() << "Setting up instance to compile " - << InPath << " to " << OutPath << "\n"); - CompilerInstance SubInstance; - SubInstance.getSourceMgr().setFileSystem(&fs); - - ForwardingDiagnosticConsumer FDC(diags); - SubInstance.addDiagnosticConsumer(&FDC); - - SubInstance.createDependencyTracker(FEOpts.TrackSystemDeps); - - SWIFT_DEFER { - // Make sure to emit a generic top-level error if a module fails to - // load. This is not only good for users; it also makes sure that we've - // emitted an error in the parent diagnostic engine, which is what - // determines whether the process exits with a proper failure status. - if (SubInstance.getASTContext().hadError()) { - diags.diagnose(diagnosticLoc, diag::serialization_load_failed, - moduleName); - } - }; - - if (SubInstance.setup(subInvocation)) { - SubError = true; - return; - } - - LLVM_DEBUG(llvm::dbgs() << "Performing sema\n"); - SubInstance.performSema(); - if (SubInstance.getASTContext().hadError()) { - LLVM_DEBUG(llvm::dbgs() << "encountered errors\n"); - SubError = true; - return; - } - - SILOptions &SILOpts = subInvocation.getSILOptions(); - auto Mod = SubInstance.getMainModule(); - auto &TC = SubInstance.getSILTypes(); - auto SILMod = performSILGeneration(Mod, TC, SILOpts); - if (!SILMod) { - LLVM_DEBUG(llvm::dbgs() << "SILGen did not produce a module\n"); - SubError = true; - return; - } - - // Setup the callbacks for serialization, which can occur during the - // optimization pipeline. - SerializationOptions SerializationOpts; - std::string OutPathStr = OutPath; - SerializationOpts.OutputPath = OutPathStr.c_str(); - SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName; - - // Record any non-SDK parseable interface files for the debug info. - StringRef SDKPath = SubInstance.getASTContext().SearchPathOpts.SDKPath; - if (!getRelativeDepPath(InPath, SDKPath)) - SerializationOpts.ParseableInterface = InPath; - - SmallVector Deps; - if (collectDepsForSerialization(SubInstance, Deps, - FEOpts.SerializeModuleInterfaceDependencyHashes)) { - SubError = true; - return; - } - if (ShouldSerializeDeps) - SerializationOpts.Dependencies = Deps; - SILMod->setSerializeSILAction([&]() { - // We don't want to serialize module docs in the cache -- they - // will be serialized beside the interface file. - serializeToBuffers(Mod, SerializationOpts, ModuleBuffer, - /*ModuleDocBuffer*/nullptr, SILMod.get()); - }); - - LLVM_DEBUG(llvm::dbgs() << "Running SIL processing passes\n"); - if (SubInstance.performSILProcessing(SILMod.get())) { - LLVM_DEBUG(llvm::dbgs() << "encountered errors\n"); - SubError = true; - return; - } - - SubError = SubInstance.getDiags().hadAnyError(); - }); - return !RunSuccess || SubError; - } -}; - #pragma mark - Module Loading namespace { @@ -760,13 +335,13 @@ struct ModuleRebuildInfo { } }; -/// Handles the details of loading parseable interfaces as modules, and will +/// Handles the details of loading module interfaces as modules, and will /// do the necessary lookup to determine if we should be loading from the /// normal cache, the prebuilt cache, a module adjacent to the interface, or -/// a module that we'll build from a parseable interface. -class ParseableInterfaceModuleLoaderImpl { +/// a module that we'll build from a module interface. +class ModuleInterfaceLoaderImpl { using AccessPathElem = std::pair; - friend class swift::ParseableInterfaceModuleLoader; + friend class swift::ModuleInterfaceLoader; ASTContext &ctx; llvm::vfs::FileSystem &fs; DiagnosticEngine &diags; @@ -781,7 +356,7 @@ class ParseableInterfaceModuleLoaderImpl { const ModuleLoadingMode loadMode; const bool remarkOnRebuildFromInterface; - ParseableInterfaceModuleLoaderImpl( + ModuleInterfaceLoaderImpl( ASTContext &ctx, StringRef modulePath, StringRef interfacePath, StringRef moduleName, StringRef cacheDir, StringRef prebuiltCacheDir, SourceLoc diagLoc, bool remarkOnRebuildFromInterface, @@ -870,7 +445,7 @@ class ParseableInterfaceModuleLoaderImpl { DependencyStatus checkDependency(StringRef modulePath, const FileDependency &dep, StringRef fullPath) { - auto status = getStatusOfDependency(fs, fullPath); + auto status = fs.status(fullPath); if (!status) return DependencyStatus::Missing; @@ -890,11 +465,12 @@ class ParseableInterfaceModuleLoaderImpl { // Slow path: if the dependency is verified by content hash, check it vs. // the hash of the file. - auto buf = getBufferOfDependency(fs, fullPath); + auto buf = fs.getBufferForFile(fullPath, /*FileSize=*/-1, + /*RequiresNullTerminator=*/false); if (!buf) return DependencyStatus::Missing; - return xxHash64(buf->getBuffer()) == dep.getContentHash() ? + return xxHash64(buf.get()->getBuffer()) == dep.getContentHash() ? DependencyStatus::UpToDate : DependencyStatus::OutOfDate; } @@ -1095,11 +671,11 @@ class ParseableInterfaceModuleLoaderImpl { bool shouldLoadAdjacentModule = true; switch (loadMode) { - case ModuleLoadingMode::OnlyParseable: + case ModuleLoadingMode::OnlyInterface: // Always skip both the caches and adjacent modules, and always build the - // parseable interface. + // module interface. return notFoundError; - case ModuleLoadingMode::PreferParseable: + case ModuleLoadingMode::PreferInterface: // If we're in the load mode that prefers .swiftinterfaces, specifically // skip the module adjacent to the interface, but use the caches if // they're present. @@ -1303,7 +879,7 @@ class ParseableInterfaceModuleLoaderImpl { /// buffer of the module's contents. Also reports the module's dependencies /// to the parent \c dependencyTracker if it came from the cache, or was built /// from the given interface. See the main comment in - /// \c ParseableInterfaceModuleLoader.h for an explanation of the module + /// \c ModuleInterfaceLoader.h for an explanation of the module /// loading strategy. llvm::ErrorOr> findOrBuildLoadableModule() { @@ -1317,7 +893,7 @@ class ParseableInterfaceModuleLoaderImpl { // Set up a builder if we need to build the module. It'll also set up // the subinvocation we'll need to use to compute the cache paths. - ParseableInterfaceBuilder builder( + ModuleInterfaceBuilder builder( ctx.SourceMgr, ctx.Diags, ctx.SearchPathOpts, ctx.LangOpts, ctx.getClangModuleLoader(), interfacePath, moduleName, cacheDir, prebuiltCacheDir, /*serializeDependencyHashes*/false, @@ -1395,7 +971,7 @@ class ParseableInterfaceModuleLoaderImpl { } // end anonymous namespace -bool ParseableInterfaceModuleLoader::isCached(StringRef DepPath) { +bool ModuleInterfaceLoader::isCached(StringRef DepPath) { if (!CacheDir.empty() && DepPath.startswith(CacheDir)) return true; return !PrebuiltCacheDir.empty() && DepPath.startswith(PrebuiltCacheDir); @@ -1404,13 +980,13 @@ bool ParseableInterfaceModuleLoader::isCached(StringRef DepPath) { /// Load a .swiftmodule associated with a .swiftinterface either from a /// cache or by converting it in a subordinate \c CompilerInstance, caching /// the results. -std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory( +std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory( AccessPathElem ModuleID, StringRef DirPath, StringRef ModuleFilename, StringRef ModuleDocFilename, std::unique_ptr *ModuleBuffer, std::unique_ptr *ModuleDocBuffer) { - // If running in OnlySerialized mode, ParseableInterfaceModuleLoader + // If running in OnlySerialized mode, ModuleInterfaceLoader // should not have been constructed at all. assert(LoadMode != ModuleLoadingMode::OnlySerialized); @@ -1421,7 +997,7 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory( ModPath = DirPath; path::append(ModPath, ModuleFilename); - auto Ext = file_types::getExtension(file_types::TY_SwiftParseableInterfaceFile); + auto Ext = file_types::getExtension(file_types::TY_SwiftModuleInterfaceFile); InPath = ModPath; path::replace_extension(InPath, Ext); if (!fs.exists(InPath)) { @@ -1436,13 +1012,13 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory( // Create an instance of the Impl to do the heavy lifting. auto ModuleName = ModuleID.first.str(); - ParseableInterfaceModuleLoaderImpl Impl( + ModuleInterfaceLoaderImpl Impl( Ctx, ModPath, InPath, ModuleName, CacheDir, PrebuiltCacheDir, ModuleID.second, RemarkOnRebuildFromInterface, dependencyTracker, llvm::is_contained(PreferInterfaceForModules, ModuleName) ? - ModuleLoadingMode::PreferParseable : LoadMode); + ModuleLoadingMode::PreferInterface : LoadMode); // Ask the impl to find us a module that we can load or give us an error // telling us that we couldn't load it. @@ -1467,14 +1043,14 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory( } -bool ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface( +bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface( SourceManager &SourceMgr, DiagnosticEngine &Diags, const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts, StringRef CacheDir, StringRef PrebuiltCacheDir, StringRef ModuleName, StringRef InPath, StringRef OutPath, bool SerializeDependencyHashes, bool TrackSystemDependencies, bool RemarkOnRebuildFromInterface) { - ParseableInterfaceBuilder builder(SourceMgr, Diags, SearchPathOpts, LangOpts, + ModuleInterfaceBuilder builder(SourceMgr, Diags, SearchPathOpts, LangOpts, /*clangImporter*/nullptr, InPath, ModuleName, CacheDir, PrebuiltCacheDir, SerializeDependencyHashes, @@ -1486,9 +1062,9 @@ bool ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface( /*ModuleBuffer*/nullptr); } -void ParseableInterfaceModuleLoader::collectVisibleTopLevelModuleNames( +void ModuleInterfaceLoader::collectVisibleTopLevelModuleNames( SmallVectorImpl &names) const { collectVisibleTopLevelModuleNamesImpl( names, - file_types::getExtension(file_types::TY_SwiftParseableInterfaceFile)); + file_types::getExtension(file_types::TY_SwiftModuleInterfaceFile)); } diff --git a/lib/Frontend/ParseableInterfaceSupport.cpp b/lib/Frontend/ModuleInterfaceSupport.cpp similarity index 96% rename from lib/Frontend/ParseableInterfaceSupport.cpp rename to lib/Frontend/ModuleInterfaceSupport.cpp index 43a001766cb2d..7fa40c3a94b5f 100644 --- a/lib/Frontend/ParseableInterfaceSupport.cpp +++ b/lib/Frontend/ModuleInterfaceSupport.cpp @@ -1,4 +1,4 @@ -//===--- ParseableInterfaceSupport.cpp - swiftinterface files ------------===// +//===------- ModuleInterfaceSupport.cpp - swiftinterface files ------------===// // // This source file is part of the Swift.org open source project // @@ -21,7 +21,7 @@ #include "swift/AST/ProtocolConformance.h" #include "swift/Basic/STLExtras.h" #include "swift/Frontend/Frontend.h" -#include "swift/Frontend/ParseableInterfaceSupport.h" +#include "swift/Frontend/ModuleInterfaceSupport.h" #include "swift/Frontend/PrintingDiagnosticConsumer.h" #include "swift/SILOptimizer/PassManager/Passes.h" #include "swift/Serialization/SerializationOptions.h" @@ -38,7 +38,7 @@ using namespace swift; version::Version swift::InterfaceFormatVersion({1, 0}); /// Diagnose any scoped imports in \p imports, i.e. those with a non-empty -/// access path. These are not yet supported by parseable interfaces, since the +/// access path. These are not yet supported by module interfaces, since the /// information about the declaration kind is not preserved through the binary /// serialization that happens as an intermediate step in non-whole-module /// builds. @@ -58,7 +58,7 @@ static void diagnoseScopedImports(DiagnosticEngine &diags, /// string as well as any relevant command-line flags in \p Opts used to /// construct \p M. static void printToolVersionAndFlagsComment(raw_ostream &out, - ParseableInterfaceOptions const &Opts, + ModuleInterfaceOptions const &Opts, ModuleDecl *M) { auto &Ctx = M->getASTContext(); auto ToolsVersion = swift::version::getSwiftFullVersion( @@ -68,7 +68,7 @@ static void printToolVersionAndFlagsComment(raw_ostream &out, out << "// " SWIFT_COMPILER_VERSION_KEY ": " << ToolsVersion << "\n"; out << "// " SWIFT_MODULE_FLAGS_KEY ": " - << Opts.ParseableInterfaceFlags << "\n"; + << Opts.Flags << "\n"; } llvm::Regex swift::getSwiftInterfaceFormatVersionRegex() { @@ -153,7 +153,7 @@ namespace { /// Collects protocols that are conformed to by a particular nominal. Since /// ASTPrinter will only print the public ones, the non-public ones get left by /// the wayside. This is a problem when a non-public protocol inherits from a -/// public protocol; the generated parseable interface still needs to make that +/// public protocol; the generated module interface still needs to make that /// dependency public. /// /// The solution implemented here is to generate synthetic extensions that @@ -431,15 +431,15 @@ const StringLiteral InheritedProtocolCollector::DummyProtocolName = "_ConstraintThatIsNotPartOfTheAPIOfThisLibrary"; } // end anonymous namespace -bool swift::emitParseableInterface(raw_ostream &out, - ParseableInterfaceOptions const &Opts, - ModuleDecl *M) { +bool swift::emitSwiftInterface(raw_ostream &out, + ModuleInterfaceOptions const &Opts, + ModuleDecl *M) { assert(M); printToolVersionAndFlagsComment(out, Opts, M); printImports(out, M); - const PrintOptions printOptions = PrintOptions::printParseableInterfaceFile( + const PrintOptions printOptions = PrintOptions::printSwiftInterfaceFile( Opts.PreserveTypesAsWritten); InheritedProtocolCollector::PerTypeMap inheritedProtocolMap; diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 7bbf48591b493..8c846c863526c 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -51,8 +51,8 @@ #include "swift/Frontend/Frontend.h" #include "swift/Frontend/PrintingDiagnosticConsumer.h" #include "swift/Frontend/SerializedDiagnosticConsumer.h" -#include "swift/Frontend/ParseableInterfaceModuleLoader.h" -#include "swift/Frontend/ParseableInterfaceSupport.h" +#include "swift/Frontend/ModuleInterfaceLoader.h" +#include "swift/Frontend/ModuleInterfaceSupport.h" #include "swift/Immediate/Immediate.h" #include "swift/Index/IndexRecord.h" #include "swift/Option/Options.h" @@ -299,7 +299,7 @@ static bool emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule, auto moduleFileType = file_types::lookupTypeForExtension(llvm::sys::path::extension(depPath)); if (moduleFileType == file_types::TY_SwiftModuleFile - || moduleFileType == file_types::TY_SwiftParseableInterfaceFile) { + || moduleFileType == file_types::TY_SwiftModuleInterfaceFile) { auto dep = pathToModuleDecl.find(depPath); assert(dep != pathToModuleDecl.end() && "Dependency must've been loaded."); @@ -437,18 +437,18 @@ static bool printAsObjCIfNeeded(StringRef outputPath, ModuleDecl *M, }); } -/// Prints the stable parseable interface for \p M to \p outputPath. +/// Prints the stable module interface for \p M to \p outputPath. /// /// ...unless \p outputPath is empty, in which case it does nothing. /// /// \returns true if there were any errors /// -/// \see swift::emitParseableInterface +/// \see swift::emitSwiftInterface static bool -printParseableInterfaceIfNeeded(StringRef outputPath, - ParseableInterfaceOptions const &Opts, - LangOptions const &LangOpts, - ModuleDecl *M) { +printModuleInterfaceIfNeeded(StringRef outputPath, + ModuleInterfaceOptions const &Opts, + LangOptions const &LangOpts, + ModuleDecl *M) { if (outputPath.empty()) return false; @@ -465,7 +465,7 @@ printParseableInterfaceIfNeeded(StringRef outputPath, } return withOutputFile(diags, outputPath, [M, Opts](raw_ostream &out) -> bool { - return swift::emitParseableInterface(out, Opts, M); + return swift::emitSwiftInterface(out, Opts, M); }); } @@ -669,13 +669,13 @@ static bool precompileBridgingHeader(CompilerInvocation &Invocation, .InputsAndOutputs.getSingleOutputFilename()); } -static bool buildModuleFromParseableInterface(CompilerInvocation &Invocation, - CompilerInstance &Instance) { +static bool buildModuleFromInterface(CompilerInvocation &Invocation, + CompilerInstance &Instance) { const FrontendOptions &FEOpts = Invocation.getFrontendOptions(); assert(FEOpts.InputsAndOutputs.hasSingleInput()); StringRef InputPath = FEOpts.InputsAndOutputs.getFilenameOfFirstInput(); StringRef PrebuiltCachePath = FEOpts.PrebuiltModuleCachePath; - return ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface( + return ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface( Instance.getSourceMgr(), Instance.getDiags(), Invocation.getSearchPathOptions(), Invocation.getLangOptions(), Invocation.getClangModuleCachePath(), @@ -1002,10 +1002,10 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs( Instance.getMainModule(), opts.ImplicitObjCHeaderPath, moduleIsPublic); } - if (opts.InputsAndOutputs.hasParseableInterfaceOutputPath()) { - hadAnyError |= printParseableInterfaceIfNeeded( - Invocation.getParseableInterfaceOutputPathForWholeModule(), - Invocation.getParseableInterfaceOptions(), + if (opts.InputsAndOutputs.hasModuleInterfaceOutputPath()) { + hadAnyError |= printModuleInterfaceIfNeeded( + Invocation.getModuleInterfaceOutputPathForWholeModule(), + Invocation.getModuleInterfaceOptions(), Invocation.getLangOptions(), Instance.getMainModule()); } @@ -1041,7 +1041,7 @@ static bool performCompile(CompilerInstance &Instance, return precompileBridgingHeader(Invocation, Instance); if (Action == FrontendOptions::ActionType::CompileModuleFromInterface) - return buildModuleFromParseableInterface(Invocation, Instance); + return buildModuleFromInterface(Invocation, Instance); if (Invocation.getInputKind() == InputFileKind::LLVM) return compileLLVMIR(Invocation, Instance, Stats); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 68120a018c3fc..a4d2514c0b2ab 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -4640,7 +4640,7 @@ ParserStatus Parser::parseGetSet(ParseDeclOptions Flags, assert(Tok.is(tok::l_brace)); // Properties in protocols use a very limited syntax. - // SIL mode and parseable interfaces use the same syntax. + // SIL mode and module interfaces use the same syntax. // Otherwise, we have a normal var or subscript declaration and we need // parse the full complement of specifiers, along with their bodies. bool parsingLimitedSyntax = Flags.contains(PD_InProtocol) || @@ -4794,7 +4794,7 @@ ParserStatus Parser::parseGetSet(ParseDeclOptions Flags, // It's okay not to have a body if there's an external asm name. if (!Tok.is(tok::l_brace)) { - // Accessors don't need bodies in parseable interfaces + // Accessors don't need bodies in module interfaces if (SF.Kind == SourceFileKind::Interface) continue; // _silgen_name'd accessors don't need bodies. @@ -6593,7 +6593,7 @@ parseDeclDeinit(ParseDeclOptions Flags, DeclAttributes &Attributes) { switch (SF.Kind) { case SourceFileKind::Interface: case SourceFileKind::SIL: - // It's okay to have no body for SIL code or parseable interfaces. + // It's okay to have no body for SIL code or module interfaces. break; case SourceFileKind::Library: case SourceFileKind::Main: diff --git a/lib/SILGen/SILGen.cpp b/lib/SILGen/SILGen.cpp index b0fd513ad1fa5..8b14bf29901e2 100644 --- a/lib/SILGen/SILGen.cpp +++ b/lib/SILGen/SILGen.cpp @@ -856,7 +856,7 @@ void SILGenModule::emitConstructor(ConstructorDecl *decl) { }); // Constructors may not have bodies if they've been imported, or if they've - // been parsed from a parseable interface. + // been parsed from a module interface. if (decl->hasBody()) { SILDeclRef initConstant(decl, SILDeclRef::Kind::Initializer); emitOrDelayFunction( diff --git a/lib/Sema/CodeSynthesis.cpp b/lib/Sema/CodeSynthesis.cpp index 4efd92fb47e42..416fc79cee176 100644 --- a/lib/Sema/CodeSynthesis.cpp +++ b/lib/Sema/CodeSynthesis.cpp @@ -1125,7 +1125,7 @@ void TypeChecker::addImplicitConstructors(NominalTypeDecl *decl) { if (decl->isInvalid()) return; - // Don't add implicit constructors in parseable interfaces. + // Don't add implicit constructors in module interfaces. if (auto *SF = decl->getParentSourceFile()) { if (SF->Kind == SourceFileKind::Interface) { decl->setAddedImplicitInitializers(); diff --git a/lib/Sema/TypeCheckDecl.cpp b/lib/Sema/TypeCheckDecl.cpp index cb764503b8b3e..f7462d003a85f 100644 --- a/lib/Sema/TypeCheckDecl.cpp +++ b/lib/Sema/TypeCheckDecl.cpp @@ -2331,7 +2331,7 @@ class DeclChecker : public DeclVisitor { // Static/class declarations require an initializer unless in a // protocol. if (var->isStatic() && !isa(DC)) { - // ...but don't enforce this for SIL or parseable interface files. + // ...but don't enforce this for SIL or module interface files. switch (DC->getParentSourceFile()->Kind) { case SourceFileKind::Interface: case SourceFileKind::SIL: @@ -2968,7 +2968,7 @@ class DeclChecker : public DeclVisitor { return false; } - // Declarations in SIL and parseable interface files don't require + // Declarations in SIL and module interface files don't require // definitions. if (auto sourceFile = decl->getDeclContext()->getParentSourceFile()) { switch (sourceFile->Kind) { @@ -4800,7 +4800,7 @@ static void diagnoseClassWithoutInitializers(TypeChecker &tc, void TypeChecker::maybeDiagnoseClassWithoutInitializers(ClassDecl *classDecl) { if (auto *SF = classDecl->getParentSourceFile()) { - // Allow classes without initializers in SIL and parseable interface files. + // Allow classes without initializers in SIL and module interface files. switch (SF->Kind) { case SourceFileKind::SIL: case SourceFileKind::Interface: diff --git a/lib/Sema/TypeCheckProtocol.cpp b/lib/Sema/TypeCheckProtocol.cpp index 346cac8f70d42..cfc38398569bd 100644 --- a/lib/Sema/TypeCheckProtocol.cpp +++ b/lib/Sema/TypeCheckProtocol.cpp @@ -1055,7 +1055,7 @@ bool WitnessChecker::findBestWitness( } if (numViable == 0) { - // Assume any missing value witnesses for a conformance in a parseable + // Assume any missing value witnesses for a conformance in a module // interface can be treated as opaque. // FIXME: ...but we should do something better about types. if (conformance && !conformance->isInvalid()) { diff --git a/lib/Serialization/ModuleFile.cpp b/lib/Serialization/ModuleFile.cpp index c4e72f634d70c..8bfb232040238 100644 --- a/lib/Serialization/ModuleFile.cpp +++ b/lib/Serialization/ModuleFile.cpp @@ -1339,7 +1339,7 @@ ModuleFile::ModuleFile( SearchPaths.push_back({blobData, isFramework, isSystem}); break; } - case input_block::PARSEABLE_INTERFACE_PATH: { + case input_block::MODULE_INTERFACE_PATH: { ModuleInterfacePath = blobData; break; } diff --git a/lib/Serialization/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index 4d0c0a895405a..52576c8b19659 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -731,7 +731,7 @@ namespace input_block { SEARCH_PATH, FILE_DEPENDENCY, DEPENDENCY_DIRECTORY, - PARSEABLE_INTERFACE_PATH + MODULE_INTERFACE_PATH }; using ImportedModuleLayout = BCRecordLayout< @@ -785,8 +785,8 @@ namespace input_block { BCBlob >; - using ParseableInterfaceLayout = BCRecordLayout< - PARSEABLE_INTERFACE_PATH, + using ModuleInterfaceLayout = BCRecordLayout< + MODULE_INTERFACE_PATH, BCBlob // file path >; diff --git a/lib/Serialization/Serialization.cpp b/lib/Serialization/Serialization.cpp index deaf296f3211c..8069509646f36 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -719,7 +719,7 @@ void Serializer::writeBlockInfoBlock() { BLOCK_RECORD(input_block, SEARCH_PATH); BLOCK_RECORD(input_block, FILE_DEPENDENCY); BLOCK_RECORD(input_block, DEPENDENCY_DIRECTORY); - BLOCK_RECORD(input_block, PARSEABLE_INTERFACE_PATH); + BLOCK_RECORD(input_block, MODULE_INTERFACE_PATH); BLOCK(DECLS_AND_TYPES_BLOCK); #define RECORD(X) BLOCK_RECORD(decls_block, X); @@ -941,7 +941,7 @@ void Serializer::writeInputBlock(const SerializationOptions &options) { input_block::SearchPathLayout SearchPath(Out); input_block::FileDependencyLayout FileDependency(Out); input_block::DependencyDirectoryLayout DependencyDirectory(Out); - input_block::ParseableInterfaceLayout ParseableInterface(Out); + input_block::ModuleInterfaceLayout ModuleInterface(Out); if (options.SerializeOptionsForDebugging) { const SearchPathOptions &searchPathOpts = M->getASTContext().SearchPathOpts; @@ -974,8 +974,8 @@ void Serializer::writeInputBlock(const SerializationOptions &options) { llvm::sys::path::filename(dep.getPath())); } - if (!options.ParseableInterface.empty()) - ParseableInterface.emit(ScratchRecord, options.ParseableInterface); + if (!options.ModuleInterface.empty()) + ModuleInterface.emit(ScratchRecord, options.ModuleInterface); ModuleDecl::ImportFilter allImportFilter; allImportFilter |= ModuleDecl::ImportFilterKind::Public; @@ -2568,7 +2568,7 @@ class Serializer::DeclSerializer : public DeclVisitor { using namespace decls_block; // Only serialize the text for an inlinable function body if we're emitting // a partial module. It's not needed in the final module file, but it's - // needed in partial modules so you can emit a parseable interface after + // needed in partial modules so you can emit a module interface after // merging them. if (!S.SF) return; diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 34cf9818ec1ff..5259388d02cec 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -309,7 +309,7 @@ std::error_code SerializedModuleLoader::findModuleFilesInDirectory( StringRef ModuleDocFilename, std::unique_ptr *ModuleBuffer, std::unique_ptr *ModuleDocBuffer) { - if (LoadMode == ModuleLoadingMode::OnlyParseable) + if (LoadMode == ModuleLoadingMode::OnlyInterface) return std::make_error_code(std::errc::not_supported); llvm::SmallString<256> ModulePath{DirPath}; diff --git a/test/ClangImporter/pch-loading-error.swift b/test/ClangImporter/pch-loading-error.swift index 21d6935dd5d9d..c2e0368d1a130 100644 --- a/test/ClangImporter/pch-loading-error.swift +++ b/test/ClangImporter/pch-loading-error.swift @@ -4,10 +4,10 @@ // RUN: %empty-directory(%t) // RUN: cp %S/Inputs/pch-loading-error.h %t/pch-loading-error.h // RUN: %target-swift-frontend -parse-as-library -module-name=pch_loading_error -emit-sil %s -enable-objc-interop -import-objc-header %t/pch-loading-error.h -pch-output-dir %t/pch -// RUN: %{python} %S/../ParseableInterface/ModuleCache/Inputs/make-old.py %t/pch/* +// RUN: %{python} %S/../ModuleInterface/ModuleCache/Inputs/make-old.py %t/pch/* // RUN: echo "// force newer header than pch" >> %t/pch-loading-error.h // RUN: %target-swift-frontend -parse-as-library -module-name=pch_loading_error -emit-sil %s -enable-objc-interop -import-objc-header %t/pch-loading-error.h -pch-output-dir %t/pch 2>&1 | %FileCheck %s -// RUN: %{python} %S/../ParseableInterface/ModuleCache/Inputs/check-is-new.py %t/pch/* +// RUN: %{python} %S/../ModuleInterface/ModuleCache/Inputs/check-is-new.py %t/pch/* // CHECK-NOT: fatal error diff --git a/test/DebugInfo/ParseableInterfaceImports.swift b/test/DebugInfo/ParseableInterfaceImports.swift index f23946b9f684b..215316fbf62c5 100644 --- a/test/DebugInfo/ParseableInterfaceImports.swift +++ b/test/DebugInfo/ParseableInterfaceImports.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-frontend-typecheck %S/basic.swift \ -// RUN: -emit-parseable-module-interface-path %t/basic.swiftinterface +// RUN: -emit-module-interface-path %t/basic.swiftinterface // RUN: %target-swift-frontend -emit-ir -module-name Foo %s -I %t -g -o - \ // RUN: | %FileCheck %s // RUN: %target-swift-frontend -emit-ir -module-name Foo %s -I %t -g -o - \ @@ -11,7 +11,7 @@ import basic // CHECK: !DIModule(scope: null, name: "basic", includePath: " // CHECK-SAME: basic.swiftinterface" -// We don;t record any parseable interfaces from the SDK. +// We don't record any module interfaces from the SDK. // They're in the SDK after all. // SDK: !DIModule(scope: null, name: "basic", includePath: " // SDK-SAME: basic{{.*}}.swiftmodule" diff --git a/test/Driver/emit-interface.swift b/test/Driver/emit-interface.swift index ab31df364d513..2bd73fd148fca 100644 --- a/test/Driver/emit-interface.swift +++ b/test/Driver/emit-interface.swift @@ -1,27 +1,27 @@ -// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-parseable-module-interface -o %t/foo 2>&1 | %FileCheck %s +// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-module-interface -o %t/foo 2>&1 | %FileCheck %s // CHECK: swift{{c?(\.EXE)?"?}} -frontend // CHECK-SAME: emit-interface.swift // CHECK: swift{{c?(\.EXE)?"?}} -frontend -merge-modules -// CHECK-SAME: -emit-parseable-module-interface-path {{.+[/\\]}}foo.swiftinterface +// CHECK-SAME: -emit-module-interface-path {{.+[/\\]}}foo.swiftinterface // CHECK: {{(bin/)?}}ld -// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-parseable-module-interface -o %t/foo -force-single-frontend-invocation 2>&1 | %FileCheck -check-prefix=CHECK-WHOLE-MODULE %s +// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-module-interface -o %t/foo -force-single-frontend-invocation 2>&1 | %FileCheck -check-prefix=CHECK-WHOLE-MODULE %s // CHECK-WHOLE-MODULE: swift{{c?(\.EXE)?"?}} -frontend // CHECK-WHOLE-MODULE-SAME: emit-interface.swift -// CHECK-WHOLE-MODULE-SAME: -emit-parseable-module-interface-path {{.+[/\\]}}foo.swiftinterface +// CHECK-WHOLE-MODULE-SAME: -emit-module-interface-path {{.+[/\\]}}foo.swiftinterface // CHECK-WHOLE-MODULE-NOT: -merge-modules // CHECK-WHOLE-MODULE: {{(bin/)?}}ld -// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-parseable-module-interface-path %t/unrelated.swiftinterface -o %t/foo -force-single-frontend-invocation 2>&1 | %FileCheck -check-prefix=CHECK-EXPLICIT-PATH %s +// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-module-interface-path %t/unrelated.swiftinterface -o %t/foo -force-single-frontend-invocation 2>&1 | %FileCheck -check-prefix=CHECK-EXPLICIT-PATH %s // CHECK-EXPLICIT-PATH: swift{{c?(\.EXE)?"?}} -frontend // CHECK-EXPLICIT-PATH-SAME: emit-interface.swift -// CHECK-EXPLICIT-PATH-SAME: -emit-parseable-module-interface-path {{.+[/\\]}}unrelated.swiftinterface +// CHECK-EXPLICIT-PATH-SAME: -emit-module-interface-path {{.+[/\\]}}unrelated.swiftinterface // Ensure that we emit arguments when we force filelists as well -// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-parseable-module-interface -o %t/foo -module-name foo -force-single-frontend-invocation -driver-filelist-threshold=0 2>&1 | %FileCheck -check-prefix=CHECK-FILELIST %s +// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %s -emit-module-interface -o %t/foo -module-name foo -force-single-frontend-invocation -driver-filelist-threshold=0 2>&1 | %FileCheck -check-prefix=CHECK-FILELIST %s // CHECK-FILELIST: swift{{c?(\.EXE)?"?}} -frontend // CHECK-FILELIST-SAME: -supplementary-output-file-map diff --git a/test/Driver/options.swift b/test/Driver/options.swift index c884e3ab9edeb..1831cf12820ca 100644 --- a/test/Driver/options.swift +++ b/test/Driver/options.swift @@ -25,8 +25,8 @@ // RUN: not %swiftc_driver -import-objc-header fake.h -import-underlying-module -c %s 2>&1 | %FileCheck -check-prefix=FRAMEWORK_BRIDGING_HEADER %s // FRAMEWORK_BRIDGING_HEADER: error: using bridging headers with framework targets is unsupported -// RUN: not %swiftc_driver -import-objc-header fake.h -emit-parseable-module-interface %s 2>&1 | %FileCheck -check-prefix=BRIDGING_HEADER_SWIFTINTERFACE %s -// RUN: not %swiftc_driver -import-objc-header fake.h -emit-parseable-module-interface-path fake.swiftinterface %s 2>&1 | %FileCheck -check-prefix=BRIDGING_HEADER_SWIFTINTERFACE %s +// RUN: not %swiftc_driver -import-objc-header fake.h -emit-module-interface %s 2>&1 | %FileCheck -check-prefix=BRIDGING_HEADER_SWIFTINTERFACE %s +// RUN: not %swiftc_driver -import-objc-header fake.h -emit-module-interface-path fake.swiftinterface %s 2>&1 | %FileCheck -check-prefix=BRIDGING_HEADER_SWIFTINTERFACE %s // BRIDGING_HEADER_SWIFTINTERFACE: error: using bridging headers with module interfaces is unsupported // RUN: %swift_driver -### | %FileCheck -check-prefix=DEFAULT_REPL %s diff --git a/test/Frontend/dependencies.swift b/test/Frontend/dependencies.swift index 66bf69479f4c8..fe3723f69888b 100644 --- a/test/Frontend/dependencies.swift +++ b/test/Frontend/dependencies.swift @@ -23,7 +23,7 @@ // NO-PRIMARY-FILE: warning: ignoring -emit-reference-dependencies (requires -primary-file) -// RUN: %target-swift-frontend -emit-dependencies-path - -emit-module "%S/../Inputs/empty file.swift" -o "%t/empty file.swiftmodule" -emit-module-doc-path "%t/empty file.swiftdoc" -emit-objc-header-path "%t/empty file.h" -emit-parseable-module-interface-path "%t/empty file.swiftinterface" | %FileCheck -check-prefix=CHECK-MULTIPLE-OUTPUTS %s +// RUN: %target-swift-frontend -emit-dependencies-path - -emit-module "%S/../Inputs/empty file.swift" -o "%t/empty file.swiftmodule" -emit-module-doc-path "%t/empty file.swiftdoc" -emit-objc-header-path "%t/empty file.h" -emit-module-interface-path "%t/empty file.swiftinterface" | %FileCheck -check-prefix=CHECK-MULTIPLE-OUTPUTS %s // CHECK-MULTIPLE-OUTPUTS-LABEL: empty\ file.swiftmodule : // CHECK-MULTIPLE-OUTPUTS: Inputs/empty\ file.swift diff --git a/test/Frontend/supplementary-output-support.swift b/test/Frontend/supplementary-output-support.swift index 6a67b5800350a..9d7aeb068fe62 100644 --- a/test/Frontend/supplementary-output-support.swift +++ b/test/Frontend/supplementary-output-support.swift @@ -24,7 +24,7 @@ // RUN: not %target-swift-frontend -resolve-imports -emit-objc-header %s 2>&1 | %FileCheck -check-prefix=RESOLVE_IMPORTS_NO_OBJC_HEADER %s // RESOLVE_IMPORTS_NO_OBJC_HEADER: error: this mode does not support emitting Objective-C headers{{$}} -// RUN: not %target-swift-frontend -parse -emit-parseable-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_INTERFACE %s +// RUN: not %target-swift-frontend -parse -emit-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=PARSE_NO_INTERFACE %s // PARSE_NO_INTERFACE: error: this mode does not support emitting module interface files{{$}} -// RUN: not %target-swift-frontend -emit-silgen -emit-parseable-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=SILGEN_NO_INTERFACE %s +// RUN: not %target-swift-frontend -emit-silgen -emit-module-interface-path %t %s 2>&1 | %FileCheck -check-prefix=SILGEN_NO_INTERFACE %s // SILGEN_NO_INTERFACE: error: this mode does not support emitting module interface files{{$}} diff --git a/test/Index/index_swift_only_systemmodule.swift b/test/Index/index_swift_only_systemmodule.swift index 30636c75736ba..bddec98843706 100644 --- a/test/Index/index_swift_only_systemmodule.swift +++ b/test/Index/index_swift_only_systemmodule.swift @@ -50,7 +50,7 @@ print(someFunc()) // RUN: %target-swift-frontend \ // RUN: -emit-module \ // RUN: -module-name SomeModule \ -// RUN: -emit-parseable-module-interface-path %t/SDK/Frameworks/SomeModule.framework/Modules/SomeModule.swiftmodule/%module-target-triple.swiftinterface \ +// RUN: -emit-module-interface-path %t/SDK/Frameworks/SomeModule.framework/Modules/SomeModule.swiftmodule/%module-target-triple.swiftinterface \ // RUN: -o /dev/null \ // RUN: -swift-version 5 \ // RUN: -enable-library-evolution \ @@ -114,7 +114,7 @@ print(someFunc()) // --- Prebuild SDK module. // RUN: mkdir -p %t/prebuiltcache/SomeModule.swiftmodule // RUN: %target-swift-frontend \ -// RUN: -build-module-from-parseable-interface \ +// RUN: -compile-module-from-interface \ // RUN: -module-name SomeModule \ // RUN: -o %t/prebuiltcache/SomeModule.swiftmodule/%module-target-triple.swiftmodule \ // RUN: %t/SDK/Frameworks/SomeModule.framework/Modules/SomeModule.swiftmodule/%module-target-triple.swiftinterface diff --git a/test/ParseableInterface/Conformances.swiftinterface b/test/ModuleInterface/Conformances.swiftinterface similarity index 100% rename from test/ParseableInterface/Conformances.swiftinterface rename to test/ModuleInterface/Conformances.swiftinterface diff --git a/test/ParseableInterface/DefaultArgs.swiftinterface b/test/ModuleInterface/DefaultArgs.swiftinterface similarity index 100% rename from test/ParseableInterface/DefaultArgs.swiftinterface rename to test/ModuleInterface/DefaultArgs.swiftinterface diff --git a/test/ParseableInterface/Inputs/ConformancesUser.swift b/test/ModuleInterface/Inputs/ConformancesUser.swift similarity index 100% rename from test/ParseableInterface/Inputs/ConformancesUser.swift rename to test/ModuleInterface/Inputs/ConformancesUser.swift diff --git a/test/ParseableInterface/Inputs/TestModule.swift b/test/ModuleInterface/Inputs/TestModule.swift similarity index 100% rename from test/ParseableInterface/Inputs/TestModule.swift rename to test/ModuleInterface/Inputs/TestModule.swift diff --git a/test/ParseableInterface/Inputs/enums-layout-helper.swift b/test/ModuleInterface/Inputs/enums-layout-helper.swift similarity index 100% rename from test/ParseableInterface/Inputs/enums-layout-helper.swift rename to test/ModuleInterface/Inputs/enums-layout-helper.swift diff --git a/test/ParseableInterface/Inputs/exported-module-name-after/CoreKit.h b/test/ModuleInterface/Inputs/exported-module-name-after/CoreKit.h similarity index 100% rename from test/ParseableInterface/Inputs/exported-module-name-after/CoreKit.h rename to test/ModuleInterface/Inputs/exported-module-name-after/CoreKit.h diff --git a/test/ParseableInterface/Inputs/exported-module-name-after/ExportAsCoreKit.h b/test/ModuleInterface/Inputs/exported-module-name-after/ExportAsCoreKit.h similarity index 100% rename from test/ParseableInterface/Inputs/exported-module-name-after/ExportAsCoreKit.h rename to test/ModuleInterface/Inputs/exported-module-name-after/ExportAsCoreKit.h diff --git a/test/ParseableInterface/Inputs/exported-module-name-after/module.modulemap b/test/ModuleInterface/Inputs/exported-module-name-after/module.modulemap similarity index 100% rename from test/ParseableInterface/Inputs/exported-module-name-after/module.modulemap rename to test/ModuleInterface/Inputs/exported-module-name-after/module.modulemap diff --git a/test/ParseableInterface/Inputs/exported-module-name-before/CoreKit.h b/test/ModuleInterface/Inputs/exported-module-name-before/CoreKit.h similarity index 100% rename from test/ParseableInterface/Inputs/exported-module-name-before/CoreKit.h rename to test/ModuleInterface/Inputs/exported-module-name-before/CoreKit.h diff --git a/test/ParseableInterface/Inputs/exported-module-name-before/ExportAsCoreKit.h b/test/ModuleInterface/Inputs/exported-module-name-before/ExportAsCoreKit.h similarity index 100% rename from test/ParseableInterface/Inputs/exported-module-name-before/ExportAsCoreKit.h rename to test/ModuleInterface/Inputs/exported-module-name-before/ExportAsCoreKit.h diff --git a/test/ParseableInterface/Inputs/exported-module-name-before/module.modulemap b/test/ModuleInterface/Inputs/exported-module-name-before/module.modulemap similarity index 100% rename from test/ParseableInterface/Inputs/exported-module-name-before/module.modulemap rename to test/ModuleInterface/Inputs/exported-module-name-before/module.modulemap diff --git a/test/ParseableInterface/Inputs/function_builders_client.swift b/test/ModuleInterface/Inputs/function_builders_client.swift similarity index 100% rename from test/ParseableInterface/Inputs/function_builders_client.swift rename to test/ModuleInterface/Inputs/function_builders_client.swift diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/A.h b/test/ModuleInterface/Inputs/imports-clang-modules/A.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/A.h rename to test/ModuleInterface/Inputs/imports-clang-modules/A.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/B1.h b/test/ModuleInterface/Inputs/imports-clang-modules/B1.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/B1.h rename to test/ModuleInterface/Inputs/imports-clang-modules/B1.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/B2.h b/test/ModuleInterface/Inputs/imports-clang-modules/B2.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/B2.h rename to test/ModuleInterface/Inputs/imports-clang-modules/B2.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/B3.h b/test/ModuleInterface/Inputs/imports-clang-modules/B3.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/B3.h rename to test/ModuleInterface/Inputs/imports-clang-modules/B3.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/C.h b/test/ModuleInterface/Inputs/imports-clang-modules/C.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/C.h rename to test/ModuleInterface/Inputs/imports-clang-modules/C.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/D.h b/test/ModuleInterface/Inputs/imports-clang-modules/D.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/D.h rename to test/ModuleInterface/Inputs/imports-clang-modules/D.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/NotSoSecret.h b/test/ModuleInterface/Inputs/imports-clang-modules/NotSoSecret.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/NotSoSecret.h rename to test/ModuleInterface/Inputs/imports-clang-modules/NotSoSecret.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/NotSoSecret2.h b/test/ModuleInterface/Inputs/imports-clang-modules/NotSoSecret2.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/NotSoSecret2.h rename to test/ModuleInterface/Inputs/imports-clang-modules/NotSoSecret2.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/Secret_BAD.h b/test/ModuleInterface/Inputs/imports-clang-modules/Secret_BAD.h similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/Secret_BAD.h rename to test/ModuleInterface/Inputs/imports-clang-modules/Secret_BAD.h diff --git a/test/ParseableInterface/Inputs/imports-clang-modules/module.modulemap b/test/ModuleInterface/Inputs/imports-clang-modules/module.modulemap similarity index 100% rename from test/ParseableInterface/Inputs/imports-clang-modules/module.modulemap rename to test/ModuleInterface/Inputs/imports-clang-modules/module.modulemap diff --git a/test/ParseableInterface/Inputs/imports-other.swift b/test/ModuleInterface/Inputs/imports-other.swift similarity index 100% rename from test/ParseableInterface/Inputs/imports-other.swift rename to test/ModuleInterface/Inputs/imports-other.swift diff --git a/test/ParseableInterface/Inputs/imports-submodule-order/module.modulemap b/test/ModuleInterface/Inputs/imports-submodule-order/module.modulemap similarity index 100% rename from test/ParseableInterface/Inputs/imports-submodule-order/module.modulemap rename to test/ModuleInterface/Inputs/imports-submodule-order/module.modulemap diff --git a/test/ParseableInterface/Inputs/make-unreadable.py b/test/ModuleInterface/Inputs/make-unreadable.py similarity index 100% rename from test/ParseableInterface/Inputs/make-unreadable.py rename to test/ModuleInterface/Inputs/make-unreadable.py diff --git a/test/ParseableInterface/Inputs/opaque-result-types-client.swift b/test/ModuleInterface/Inputs/opaque-result-types-client.swift similarity index 100% rename from test/ParseableInterface/Inputs/opaque-result-types-client.swift rename to test/ModuleInterface/Inputs/opaque-result-types-client.swift diff --git a/test/ParseableInterface/Inputs/other.swift b/test/ModuleInterface/Inputs/other.swift similarity index 100% rename from test/ParseableInterface/Inputs/other.swift rename to test/ModuleInterface/Inputs/other.swift diff --git a/test/ParseableInterface/ModuleCache/Inputs/check-is-forwarding-module.py b/test/ModuleInterface/ModuleCache/Inputs/check-is-forwarding-module.py similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/check-is-forwarding-module.py rename to test/ModuleInterface/ModuleCache/Inputs/check-is-forwarding-module.py diff --git a/test/ParseableInterface/ModuleCache/Inputs/check-is-new.py b/test/ModuleInterface/ModuleCache/Inputs/check-is-new.py similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/check-is-new.py rename to test/ModuleInterface/ModuleCache/Inputs/check-is-new.py diff --git a/test/ParseableInterface/ModuleCache/Inputs/check-is-old.py b/test/ModuleInterface/ModuleCache/Inputs/check-is-old.py similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/check-is-old.py rename to test/ModuleInterface/ModuleCache/Inputs/check-is-old.py diff --git a/test/ParseableInterface/ModuleCache/Inputs/force-module-loading-mode/Lib.swiftinterface b/test/ModuleInterface/ModuleCache/Inputs/force-module-loading-mode/Lib.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/force-module-loading-mode/Lib.swiftinterface rename to test/ModuleInterface/ModuleCache/Inputs/force-module-loading-mode/Lib.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/Inputs/make-old.py b/test/ModuleInterface/ModuleCache/Inputs/make-old.py similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/make-old.py rename to test/ModuleInterface/ModuleCache/Inputs/make-old.py diff --git a/test/ParseableInterface/ModuleCache/Inputs/mock-sdk/ExportedLib.swiftinterface b/test/ModuleInterface/ModuleCache/Inputs/mock-sdk/ExportedLib.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/mock-sdk/ExportedLib.swiftinterface rename to test/ModuleInterface/ModuleCache/Inputs/mock-sdk/ExportedLib.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/Inputs/mock-sdk/SdkLib.swiftinterface b/test/ModuleInterface/ModuleCache/Inputs/mock-sdk/SdkLib.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/mock-sdk/SdkLib.swiftinterface rename to test/ModuleInterface/ModuleCache/Inputs/mock-sdk/SdkLib.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/Inputs/mock-sdk/usr/include/SomeCModule.h b/test/ModuleInterface/ModuleCache/Inputs/mock-sdk/usr/include/SomeCModule.h similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/mock-sdk/usr/include/SomeCModule.h rename to test/ModuleInterface/ModuleCache/Inputs/mock-sdk/usr/include/SomeCModule.h diff --git a/test/ParseableInterface/ModuleCache/Inputs/mock-sdk/usr/include/module.modulemap b/test/ModuleInterface/ModuleCache/Inputs/mock-sdk/usr/include/module.modulemap similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/mock-sdk/usr/include/module.modulemap rename to test/ModuleInterface/ModuleCache/Inputs/mock-sdk/usr/include/module.modulemap diff --git a/test/ParseableInterface/ModuleCache/Inputs/prebuilt-module-cache/Lib.swiftinterface b/test/ModuleInterface/ModuleCache/Inputs/prebuilt-module-cache/Lib.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/prebuilt-module-cache/Lib.swiftinterface rename to test/ModuleInterface/ModuleCache/Inputs/prebuilt-module-cache/Lib.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/Inputs/prebuilt-module-cache/LibExporter.swiftinterface b/test/ModuleInterface/ModuleCache/Inputs/prebuilt-module-cache/LibExporter.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/Inputs/prebuilt-module-cache/LibExporter.swiftinterface rename to test/ModuleInterface/ModuleCache/Inputs/prebuilt-module-cache/LibExporter.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface b/test/ModuleInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface rename to test/ModuleInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/RebuildRemarks/malformed-compiled-module.swift b/test/ModuleInterface/ModuleCache/RebuildRemarks/malformed-compiled-module.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/RebuildRemarks/malformed-compiled-module.swift rename to test/ModuleInterface/ModuleCache/RebuildRemarks/malformed-compiled-module.swift diff --git a/test/ParseableInterface/ModuleCache/RebuildRemarks/missing-dependency.swift b/test/ModuleInterface/ModuleCache/RebuildRemarks/missing-dependency.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/RebuildRemarks/missing-dependency.swift rename to test/ModuleInterface/ModuleCache/RebuildRemarks/missing-dependency.swift diff --git a/test/ParseableInterface/ModuleCache/RebuildRemarks/out-of-date-cached-module.swift b/test/ModuleInterface/ModuleCache/RebuildRemarks/out-of-date-cached-module.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/RebuildRemarks/out-of-date-cached-module.swift rename to test/ModuleInterface/ModuleCache/RebuildRemarks/out-of-date-cached-module.swift diff --git a/test/ParseableInterface/ModuleCache/RebuildRemarks/out-of-date-compiled-module.swift b/test/ModuleInterface/ModuleCache/RebuildRemarks/out-of-date-compiled-module.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/RebuildRemarks/out-of-date-compiled-module.swift rename to test/ModuleInterface/ModuleCache/RebuildRemarks/out-of-date-compiled-module.swift diff --git a/test/ParseableInterface/ModuleCache/RebuildRemarks/out-of-date-forwarding-module.swift b/test/ModuleInterface/ModuleCache/RebuildRemarks/out-of-date-forwarding-module.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/RebuildRemarks/out-of-date-forwarding-module.swift rename to test/ModuleInterface/ModuleCache/RebuildRemarks/out-of-date-forwarding-module.swift diff --git a/test/ParseableInterface/ModuleCache/RebuildRemarks/rebuild-transitive-import.swift b/test/ModuleInterface/ModuleCache/RebuildRemarks/rebuild-transitive-import.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/RebuildRemarks/rebuild-transitive-import.swift rename to test/ModuleInterface/ModuleCache/RebuildRemarks/rebuild-transitive-import.swift diff --git a/test/ParseableInterface/ModuleCache/SDKDependencies-disable-validation.swift b/test/ModuleInterface/ModuleCache/SDKDependencies-disable-validation.swift similarity index 86% rename from test/ParseableInterface/ModuleCache/SDKDependencies-disable-validation.swift rename to test/ModuleInterface/ModuleCache/SDKDependencies-disable-validation.swift index a80c2d591e58e..80da766c02a0e 100644 --- a/test/ParseableInterface/ModuleCache/SDKDependencies-disable-validation.swift +++ b/test/ModuleInterface/ModuleCache/SDKDependencies-disable-validation.swift @@ -4,8 +4,8 @@ // // RUN: mkdir %t/MCP %t/prebuilt-cache %t/my-sdk // RUN: cp -r %S/Inputs/mock-sdk/. %t/my-sdk -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface // // Check the prebuilt modules don't contain dependencies in the module cache, prebuilt cache, or resource dir // RUN: llvm-bcanalyzer -dump %t/prebuilt-cache/ExportedLib.swiftmodule | %FileCheck %s -check-prefix=PREBUILT @@ -19,8 +19,8 @@ // Re-build them in the opposite order // RUN: %empty-directory(%t/prebuilt-cache) // RUN: %empty-directory(%t/MCP) -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface // // Check they still don't contain dependencies in the module cache or prebuilt cache // RUN: llvm-bcanalyzer -dump %t/prebuilt-cache/ExportedLib.swiftmodule | %FileCheck %s -check-prefix=PREBUILT diff --git a/test/ParseableInterface/ModuleCache/SDKDependencies.swift b/test/ModuleInterface/ModuleCache/SDKDependencies.swift similarity index 87% rename from test/ParseableInterface/ModuleCache/SDKDependencies.swift rename to test/ModuleInterface/ModuleCache/SDKDependencies.swift index 98f6bd1f07545..20af84064f47d 100644 --- a/test/ParseableInterface/ModuleCache/SDKDependencies.swift +++ b/test/ModuleInterface/ModuleCache/SDKDependencies.swift @@ -4,8 +4,8 @@ // // RUN: mkdir %t/MCP %t/prebuilt-cache %t/my-sdk // RUN: cp -r %S/Inputs/mock-sdk/. %t/my-sdk -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface // // Check the prebuilt modules don't contain dependencies in the module cache, prebuilt cache, or resource dir // RUN: llvm-bcanalyzer -dump %t/prebuilt-cache/ExportedLib.swiftmodule | %FileCheck %s -check-prefix=PREBUILT @@ -19,8 +19,8 @@ // Re-build them in the opposite order // RUN: %empty-directory(%t/prebuilt-cache) // RUN: %empty-directory(%t/MCP) -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/SdkLib.swiftmodule -track-system-dependencies -module-name SdkLib %t/my-sdk/SdkLib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -serialize-parseable-module-interface-dependency-hashes -sdk %t/my-sdk -prebuilt-module-cache-path %t/prebuilt-cache -I %t/my-sdk -module-cache-path %t/MCP -o %t/prebuilt-cache/ExportedLib.swiftmodule -track-system-dependencies -module-name ExportedLib %t/my-sdk/ExportedLib.swiftinterface // // Check they still don't contain dependencies in the module cache or prebuilt cache // RUN: llvm-bcanalyzer -dump %t/prebuilt-cache/ExportedLib.swiftmodule | %FileCheck %s -check-prefix=PREBUILT diff --git a/test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface b/test/ModuleInterface/ModuleCache/SerializedSIL.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface rename to test/ModuleInterface/ModuleCache/SerializedSIL.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/SystemDependencies.swiftinterface b/test/ModuleInterface/ModuleCache/SystemDependencies.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/SystemDependencies.swiftinterface rename to test/ModuleInterface/ModuleCache/SystemDependencies.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/WrongName.swiftinterface b/test/ModuleInterface/ModuleCache/WrongName.swiftinterface similarity index 100% rename from test/ParseableInterface/ModuleCache/WrongName.swiftinterface rename to test/ModuleInterface/ModuleCache/WrongName.swiftinterface diff --git a/test/ParseableInterface/ModuleCache/force-module-load-mode-bad-config.swift b/test/ModuleInterface/ModuleCache/force-module-load-mode-bad-config.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/force-module-load-mode-bad-config.swift rename to test/ModuleInterface/ModuleCache/force-module-load-mode-bad-config.swift diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift b/test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift rename to test/ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift b/test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift rename to test/ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift diff --git a/test/ParseableInterface/ModuleCache/force-module-loading-mode.swift b/test/ModuleInterface/ModuleCache/force-module-loading-mode.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/force-module-loading-mode.swift rename to test/ModuleInterface/ModuleCache/force-module-loading-mode.swift diff --git a/test/ParseableInterface/ModuleCache/forwarding-module-dependencies.swift b/test/ModuleInterface/ModuleCache/forwarding-module-dependencies.swift similarity index 91% rename from test/ParseableInterface/ModuleCache/forwarding-module-dependencies.swift rename to test/ModuleInterface/ModuleCache/forwarding-module-dependencies.swift index 1705f1b14718c..da16601e4d54c 100644 --- a/test/ParseableInterface/ModuleCache/forwarding-module-dependencies.swift +++ b/test/ModuleInterface/ModuleCache/forwarding-module-dependencies.swift @@ -13,7 +13,7 @@ // on a C module with headers that should be in the dependency list. // Put it in the prebuilt cache. -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/mock-sdk/ExportedLib.swiftinterface -sdk %t/mock-sdk -o %t/PrebuiltModuleCache/ExportedLib.swiftmodule -serialize-parseable-module-interface-dependency-hashes -track-system-dependencies +// RUN: %target-swift-frontend -compile-module-from-interface %t/mock-sdk/ExportedLib.swiftinterface -sdk %t/mock-sdk -o %t/PrebuiltModuleCache/ExportedLib.swiftmodule -serialize-parseable-module-interface-dependency-hashes -track-system-dependencies // 2. Make sure the prebuilt module we built has SomeCModule.h as a dependency. diff --git a/test/ParseableInterface/ModuleCache/module-cache-bad-version.swift b/test/ModuleInterface/ModuleCache/module-cache-bad-version.swift similarity index 90% rename from test/ParseableInterface/ModuleCache/module-cache-bad-version.swift rename to test/ModuleInterface/ModuleCache/module-cache-bad-version.swift index 4ae36f61e361e..dbdfbd0475be0 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-bad-version.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-bad-version.swift @@ -5,7 +5,7 @@ // // RUN: echo 'public func LeafFunc() -> Int { return 10; }' >%t/leaf.swift // -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: test -f %t/LeafModule.swiftinterface // RUN: %FileCheck %s -check-prefix=CHECK-LEAFINTERFACE <%t/LeafModule.swiftinterface // CHECK-LEAFINTERFACE: {{swift-interface-format-version: [0-9\\.]+}} diff --git a/test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift b/test/ModuleInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift similarity index 84% rename from test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift rename to test/ModuleInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift index b338a08c23d50..27aad747e5426 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-deployment-target-irrelevant.swift @@ -12,11 +12,11 @@ // // Phase 1: build LeafModule into a .swiftinterface file with -target x86_64-macosx-10.9: // -// RUN: %swift -target x86_64-apple-macosx10.9 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -typecheck +// RUN: %swift -target x86_64-apple-macosx10.9 -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -typecheck // // Phase 2: build OtherModule into a .swiftinterface file with -target x86_64-macosx-10.10: // -// RUN: %swift -target x86_64-apple-macosx10.10 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -typecheck +// RUN: %swift -target x86_64-apple-macosx10.10 -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -typecheck // // Phase 3: build TestModule in -target x86_64-apple-macosx10.11 and import both of these: // diff --git a/test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift b/test/ModuleInterface/ModuleCache/module-cache-diagnostics.swift similarity index 95% rename from test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift rename to test/ModuleInterface/ModuleCache/module-cache-diagnostics.swift index 7df9b2cff2ff2..4efed5970b874 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-diagnostics.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-diagnostics.swift @@ -21,9 +21,9 @@ // Setup phase 2: build modules, pushing timestamps of inputs and intermediates into the past as we go. // // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface // RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule diff --git a/test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift b/test/ModuleInterface/ModuleCache/module-cache-effective-version-irrelevant.swift similarity index 80% rename from test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift rename to test/ModuleInterface/ModuleCache/module-cache-effective-version-irrelevant.swift index d38092434d60a..f7392a5c6afba 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-effective-version-irrelevant.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-effective-version-irrelevant.swift @@ -9,11 +9,11 @@ // // Phase 1: build LeafModule into a .swiftinterface file with -swift-version 4: // -// RUN: %target-swift-frontend -swift-version 4 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -typecheck +// RUN: %target-swift-frontend -swift-version 4 -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -typecheck // // Phase 2: build OtherModule into a .swiftinterface file with -swift-version 4.2: // -// RUN: %target-swift-frontend -swift-version 4.2 -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -typecheck +// RUN: %target-swift-frontend -swift-version 4.2 -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -typecheck // // Phase 3: build TestModule in -swift-version 5 and import both of these: // diff --git a/test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift b/test/ModuleInterface/ModuleCache/module-cache-errors-in-importing-file.swift similarity index 82% rename from test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift rename to test/ModuleInterface/ModuleCache/module-cache-errors-in-importing-file.swift index 2d149f9474010..561bf01d71317 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-errors-in-importing-file.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-errors-in-importing-file.swift @@ -10,7 +10,7 @@ // Setup phase 2: build the module. // -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/SomeModule.swiftinterface -module-name SomeModule %t/some-module.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/SomeModule.swiftinterface -module-name SomeModule %t/some-module.swift -emit-module -o /dev/null // Actual test: compile and verify the import succeeds (i.e. we only report the error in this file) // diff --git a/test/ParseableInterface/ModuleCache/module-cache-init.swift b/test/ModuleInterface/ModuleCache/module-cache-init.swift similarity index 92% rename from test/ParseableInterface/ModuleCache/module-cache-init.swift rename to test/ModuleInterface/ModuleCache/module-cache-init.swift index 9f5b9c3fa64bc..69364fbb9c3e2 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-init.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-init.swift @@ -9,7 +9,7 @@ // // Phase 1: build LeafModule into a .swiftinterface file: // -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: test -f %t/LeafModule.swiftinterface // RUN: %FileCheck %s -check-prefix=CHECK-LEAFINTERFACE <%t/LeafModule.swiftinterface // CHECK-LEAFINTERFACE: LeafFunc @@ -17,7 +17,7 @@ // // Phase 2: build OtherModule into a .swiftinterface _using_ LeafModule via LeafModule.swiftinterface, creating LeafModule-*.swiftmodule along the way. // -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: test -f %t/OtherModule.swiftinterface // RUN: %FileCheck %s -check-prefix=CHECK-OTHERINTERFACE <%t/OtherModule.swiftinterface // CHECK-OTHERINTERFACE: OtherFunc diff --git a/test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift b/test/ModuleInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift similarity index 87% rename from test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift rename to test/ModuleInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift index 11725abba02f2..c1bf9219c605e 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-intermediate-mtime-change-rebuilds-only-intermediate.swift @@ -19,9 +19,9 @@ // Setup phase 2: build modules, pushing timestamps of inputs and intermediates into the past as we go. // // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface // RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule diff --git a/test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift b/test/ModuleInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift similarity index 88% rename from test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift rename to test/ModuleInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift index 9e52d7dcbc383..cb7aaf610caf9 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-intermediate-size-change-rebuilds-only-intermediate.swift @@ -18,9 +18,9 @@ // Setup phase 2: build modules, pushing timestamps of inputs and intermediates into the past as we go. // // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface // RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule diff --git a/test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift b/test/ModuleInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift similarity index 87% rename from test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift rename to test/ModuleInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift index f429a34e8259f..db427dc6d447c 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-leaf-mtime-change-rebuilds-all.swift @@ -19,9 +19,9 @@ // Setup phase 2: build modules, pushing timestamps of inputs and intermediates into the past as we go. // // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface // RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule diff --git a/test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift b/test/ModuleInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift similarity index 87% rename from test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift rename to test/ModuleInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift index fa2aba0bddcb7..c28ebfd27c09d 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-leaf-size-change-rebuilds-all.swift @@ -18,9 +18,9 @@ // Setup phase 2: build modules, pushing timestamps of inputs and intermediates into the past as we go. // // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface // RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule diff --git a/test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift b/test/ModuleInterface/ModuleCache/module-cache-no-rebuild.swift similarity index 87% rename from test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift rename to test/ModuleInterface/ModuleCache/module-cache-no-rebuild.swift index 2e40b916d5022..45c1d219eab5f 100644 --- a/test/ParseableInterface/ModuleCache/module-cache-no-rebuild.swift +++ b/test/ModuleInterface/ModuleCache/module-cache-no-rebuild.swift @@ -18,9 +18,9 @@ // Setup phase 2: build modules, pushing timestamps of inputs and intermediates into the past as we go. // // RUN: %{python} %S/Inputs/make-old.py %t/leaf.swift %t/other.swift -// RUN: %target-swift-frontend -I %t -emit-parseable-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/LeafModule.swiftinterface -// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-parseable-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/LeafModule-*.swiftmodule %t/OtherModule.swiftinterface // RUN: %target-swift-frontend -I %t -module-cache-path %t/modulecache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %s // RUN: %{python} %S/Inputs/make-old.py %t/modulecache/OtherModule-*.swiftmodule diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-archs.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-archs.swift diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-fallback.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-fallback.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-fallback.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-fallback.swift diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-forwarding.swift similarity index 94% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-forwarding.swift index ea0b98a2a4402..a882d8843b634 100644 --- a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-forwarding.swift +++ b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-forwarding.swift @@ -5,7 +5,7 @@ // First, prebuild a module and put it in the prebuilt cache. // RUN: sed -e 's/FromInterface/FromPrebuilt/g' %S/Inputs/prebuilt-module-cache/Lib.swiftinterface | tr -d '\r' > %t/Lib.swiftinterface.tmp // RUN: mv %t/Lib.swiftinterface.tmp %t/Lib.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface -module-cache-path %t/MCP -serialize-parseable-module-interface-dependency-hashes -o %t/prebuilt-cache/Lib.swiftmodule %t/Lib.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -module-cache-path %t/MCP -serialize-parseable-module-interface-dependency-hashes -o %t/prebuilt-cache/Lib.swiftmodule %t/Lib.swiftinterface // Next, use the module and check if the forwarding module is in place. // RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -sdk %S/Inputs -I %S/Inputs/prebuilt-module-cache/ -prebuilt-module-cache-path %t/prebuilt-cache %s 2>&1 | %FileCheck -check-prefix=FROM-PREBUILT %s diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-nonexistent-module-cache-path.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-nonexistent-module-cache-path.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-nonexistent-module-cache-path.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-nonexistent-module-cache-path.swift diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-recursive.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-recursive.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-recursive.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-recursive.swift diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-root.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-root.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-root.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-root.swift diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache-unusable.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache-unusable.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache-unusable.swift diff --git a/test/ParseableInterface/ModuleCache/prebuilt-module-cache.swift b/test/ModuleInterface/ModuleCache/prebuilt-module-cache.swift similarity index 100% rename from test/ParseableInterface/ModuleCache/prebuilt-module-cache.swift rename to test/ModuleInterface/ModuleCache/prebuilt-module-cache.swift diff --git a/test/ParseableInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift b/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift similarity index 82% rename from test/ParseableInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift rename to test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift index a9441ce33a960..3f913718429ba 100644 --- a/test/ParseableInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift +++ b/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk-framework.swift @@ -5,11 +5,11 @@ // RUN: echo 'public func showsUpInBothPlaces() {}' > %t/Lib.swift // 1. Create a .swiftinterface file containing just one API, and put it inside a second build dir (without a .swiftmodule) -// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-parseable-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib +// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib // 2. Add a new API to the module, and compile just the serialized version in the build dir. // RUN: echo 'public func onlyInTheCompiledModule() {}' >> %t/Lib.swift -// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftmodule -emit-parseable-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib +// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftmodule -emit-module-interface-path %t/BuildDir/Lib.framework/Modules/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib // 3. Make sure when we compile this test file, we can access both APIs since we'll // load the compiled .swiftmodule instead of the .swiftinterface in the SDK. diff --git a/test/ParseableInterface/ModuleCache/prefer-local-module-to-sdk.swift b/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk.swift similarity index 84% rename from test/ParseableInterface/ModuleCache/prefer-local-module-to-sdk.swift rename to test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk.swift index 83adb3828eb94..d6053aacd1984 100644 --- a/test/ParseableInterface/ModuleCache/prefer-local-module-to-sdk.swift +++ b/test/ModuleInterface/ModuleCache/prefer-local-module-to-sdk.swift @@ -5,11 +5,11 @@ // RUN: echo 'public func showsUpInBothPlaces() {}' > %t/Lib.swift // 1. Create a .swiftinterface file containing just one API, and put it inside a second build dir (without a .swiftmodule) -// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-parseable-module-interface-path %t/SecondBuildDir/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib +// RUN: %target-swift-frontend -typecheck %t/Lib.swift -emit-module-interface-path %t/SecondBuildDir/Lib.swiftmodule/%target-cpu.swiftinterface -module-name Lib // 2. Add a new API to the module, and compile just the serialized version in the build dir. // RUN: echo 'public func onlyInTheCompiledModule() {}' >> %t/Lib.swift -// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.swiftmodule -emit-parseable-module-interface-path %t/BuildDir/Lib.swiftinterface +// RUN: %target-swift-frontend -emit-module %t/Lib.swift -o %t/BuildDir/Lib.swiftmodule -emit-module-interface-path %t/BuildDir/Lib.swiftinterface // 3. Make sure when we compile this test file, we can access both APIs since we'll // load the compiled .swiftmodule instead of the .swiftinterface in the SDK. diff --git a/test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift b/test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift similarity index 79% rename from test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift rename to test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift index 9c3df76e7627c..7ae35c9df8d58 100644 --- a/test/ParseableInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift +++ b/test/ModuleInterface/ModuleCache/swiftdoc-next-to-swiftinterface.swift @@ -1,5 +1,5 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -emit-module -emit-parseable-module-interface-path %t/Lib.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule %s +// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/Lib.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule %s // RUN: %target-swift-ide-test -print-module -module-to-print=Lib -access-filter-public -I %t -source-filename=x -prefer-type-repr=false -fully-qualified-types=true > %t/from-module.txt // RUN: %FileCheck %s < %t/from-module.txt @@ -10,7 +10,7 @@ // Try again with architecture-specific subdirectories. // RUN: %empty-directory(%t) // RUN: %empty-directory(%t/Lib.swiftmodule) -// RUN: %target-swift-frontend -emit-module -emit-parseable-module-interface-path %t/Lib.swiftmodule/%target-cpu.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule/%target-swiftmodule-name -module-name Lib %s +// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/Lib.swiftmodule/%target-cpu.swiftinterface -emit-module-doc -parse-stdlib -o %t/Lib.swiftmodule/%target-swiftmodule-name -module-name Lib %s // RUN: %target-swift-ide-test -print-module -module-to-print=Lib -access-filter-public -I %t -source-filename=x -prefer-type-repr=false -fully-qualified-types=true > %t/from-module.txt // RUN: %FileCheck %s < %t/from-module.txt diff --git a/test/ParseableInterface/NoWrongSDKWarning.swiftinterface b/test/ModuleInterface/NoWrongSDKWarning.swiftinterface similarity index 64% rename from test/ParseableInterface/NoWrongSDKWarning.swiftinterface rename to test/ModuleInterface/NoWrongSDKWarning.swiftinterface index 2e4ec3246bc6c..61b7f7fde6708 100644 --- a/test/ParseableInterface/NoWrongSDKWarning.swiftinterface +++ b/test/ModuleInterface/NoWrongSDKWarning.swiftinterface @@ -3,7 +3,7 @@ // Deliberately pass the wrong target at the command line and see what happens. // RUN: %empty-directory(%t) -// RUN: %swift -sdk %sdk -target arm64-apple-ios10 -build-module-from-parseable-interface %s -o %t/NoWrongSDKWarning.swiftmodule 2>&1 | %FileCheck -allow-empty %s +// RUN: %swift -sdk %sdk -target arm64-apple-ios10 -compile-module-from-interface %s -o %t/NoWrongSDKWarning.swiftmodule 2>&1 | %FileCheck -allow-empty %s // REQUIRES: OS=macosx diff --git a/test/ParseableInterface/ObjC.swiftinterface b/test/ModuleInterface/ObjC.swiftinterface similarity index 100% rename from test/ParseableInterface/ObjC.swiftinterface rename to test/ModuleInterface/ObjC.swiftinterface diff --git a/test/ParseableInterface/ParseStdlib.swiftinterface b/test/ModuleInterface/ParseStdlib.swiftinterface similarity index 81% rename from test/ParseableInterface/ParseStdlib.swiftinterface rename to test/ModuleInterface/ParseStdlib.swiftinterface index ba16186a50dca..d3a838b14d993 100644 --- a/test/ParseableInterface/ParseStdlib.swiftinterface +++ b/test/ModuleInterface/ParseStdlib.swiftinterface @@ -5,7 +5,7 @@ // not be written in any of the invocations below. // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -build-module-from-parseable-interface -o %t/ParseStdlib.swiftmodule %s +// RUN: %target-swift-frontend -compile-module-from-interface -o %t/ParseStdlib.swiftmodule %s // RUN: %target-swift-ide-test -print-module -module-to-print ParseStdlib -I %t -source-filename x -print-interface | %FileCheck %s // CHECK: func test(_: Builtin.Int42) diff --git a/test/ParseableInterface/SmokeTest.swiftinterface b/test/ModuleInterface/SmokeTest.swiftinterface similarity index 96% rename from test/ParseableInterface/SmokeTest.swiftinterface rename to test/ModuleInterface/SmokeTest.swiftinterface index de15e5ee78c9b..ea6b5663c5709 100644 --- a/test/ParseableInterface/SmokeTest.swiftinterface +++ b/test/ModuleInterface/SmokeTest.swiftinterface @@ -10,7 +10,7 @@ // ...and then make sure parse-and-typecheck-and-serialize works. // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -build-module-from-parseable-interface -o %t/SmokeTest.swiftmodule %s +// RUN: %target-swift-frontend -compile-module-from-interface -o %t/SmokeTest.swiftmodule %s // RUN: %target-swift-ide-test -print-module -module-to-print SmokeTest -I %t -source-filename x -print-interface > %t/SmokeTest.txt // RUN: %FileCheck %s < %t/SmokeTest.txt // RUN: %FileCheck -check-prefix NEGATIVE %s < %t/SmokeTest.txt diff --git a/test/ParseableInterface/access-filter.swift b/test/ModuleInterface/access-filter.swift similarity index 98% rename from test/ParseableInterface/access-filter.swift rename to test/ModuleInterface/access-filter.swift index 815a629ec8057..db1d1d26cb699 100644 --- a/test/ParseableInterface/access-filter.swift +++ b/test/ModuleInterface/access-filter.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.swiftinterface %s -module-name AccessFilter +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.swiftinterface %s -module-name AccessFilter // RUN: %FileCheck %s < %t.swiftinterface // RUN: %FileCheck -check-prefix NEGATIVE %s < %t.swiftinterface diff --git a/test/ParseableInterface/attrs.swift b/test/ModuleInterface/attrs.swift similarity index 79% rename from test/ParseableInterface/attrs.swift rename to test/ModuleInterface/attrs.swift index f5f5d06961af1..66b694ad40575 100644 --- a/test/ParseableInterface/attrs.swift +++ b/test/ModuleInterface/attrs.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.swiftinterface -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.swiftinterface -enable-library-evolution %s // RUN: %FileCheck %s < %t.swiftinterface // CHECK: @_transparent public func glass() -> Swift.Int { return 0 }{{$}} diff --git a/test/ParseableInterface/can-import.swift b/test/ModuleInterface/can-import.swift similarity index 82% rename from test/ParseableInterface/can-import.swift rename to test/ModuleInterface/can-import.swift index ac9c59261b69a..934eaa466a36e 100644 --- a/test/ParseableInterface/can-import.swift +++ b/test/ModuleInterface/can-import.swift @@ -1,5 +1,5 @@ // RUN: %empty-directory(%t) -// RUN: echo 'public func externalFunc() {}' | %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Library.swiftinterface - +// RUN: echo 'public func externalFunc() {}' | %target-swift-frontend -typecheck -emit-module-interface-path %t/Library.swiftinterface - // RUN: %target-swift-frontend -typecheck %s -I %t #if canImport(Library) diff --git a/test/ParseableInterface/conformances.swift b/test/ModuleInterface/conformances.swift similarity index 98% rename from test/ParseableInterface/conformances.swift rename to test/ModuleInterface/conformances.swift index 89ea7b2ebe914..cc18f3ec33b2c 100644 --- a/test/ParseableInterface/conformances.swift +++ b/test/ModuleInterface/conformances.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend-typecheck -emit-parseable-module-interface-path %t.swiftinterface %s +// RUN: %target-swift-frontend-typecheck -emit-module-interface-path %t.swiftinterface %s // RUN: %FileCheck %s < %t.swiftinterface // RUN: %FileCheck -check-prefix CHECK-END %s < %t.swiftinterface // RUN: %FileCheck -check-prefix NEGATIVE %s < %t.swiftinterface diff --git a/test/ParseableInterface/convenience-init.swift b/test/ModuleInterface/convenience-init.swift similarity index 74% rename from test/ParseableInterface/convenience-init.swift rename to test/ModuleInterface/convenience-init.swift index 1c0190817a3bb..2a8aee408be7b 100644 --- a/test/ParseableInterface/convenience-init.swift +++ b/test/ModuleInterface/convenience-init.swift @@ -1,18 +1,18 @@ // RUN: %empty-directory(%t) // Generate the parseable interface of the current file via the merge-modules step -// RUN: %target-build-swift -emit-module -o %t/Test.swiftmodule -emit-parseable-module-interface-path %t/TestMerge.swiftinterface -module-name Test %s +// RUN: %target-build-swift -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/TestMerge.swiftinterface -module-name Test %s // Generate the parseable interface of the current file via a single frontend invocation -// RUN: %target-swift-frontend -typecheck -enable-objc-interop -emit-parseable-module-interface-path %t/TestSingle.swiftinterface -module-name Test %s +// RUN: %target-swift-frontend -typecheck -enable-objc-interop -emit-module-interface-path %t/TestSingle.swiftinterface -module-name Test %s // Make sure both don't add override for inits shadowing convenience initializers // RUN: %FileCheck --check-prefixes=CHECK,SINGLE %s < %t/TestSingle.swiftinterface // RUN: %FileCheck --check-prefixes=CHECK,MERGE %s < %t/TestMerge.swiftinterface // Check we can consume the interface without issue -// RUN: %target-swift-frontend -swift-version 5 -build-module-from-parseable-interface -o %t/Test.swiftmodule %t/TestSingle.swiftinterface -// RUN: %target-swift-frontend -swift-version 5 -build-module-from-parseable-interface -o %t/Test.swiftmodule %t/TestMerge.swiftinterface +// RUN: %target-swift-frontend -swift-version 5 -compile-module-from-interface -o %t/Test.swiftmodule %t/TestSingle.swiftinterface +// RUN: %target-swift-frontend -swift-version 5 -compile-module-from-interface -o %t/Test.swiftmodule %t/TestMerge.swiftinterface public class Base { let x: Int diff --git a/test/ModuleInterface/dataflow-errors.swift b/test/ModuleInterface/dataflow-errors.swift new file mode 100644 index 0000000000000..e96b266686a60 --- /dev/null +++ b/test/ModuleInterface/dataflow-errors.swift @@ -0,0 +1,12 @@ +// RUN: rm -f %t +// RUN: not %target-swift-frontend -emit-module-interface-path %t -emit-module -o /dev/null %s +// RUN: test ! -f %t +// RUN: %target-swift-frontend -emit-module-interface-path %t -typecheck %s +// RUN: test -f %t + +public struct BadInit { + public var x: Int + public init() { + return // without initializing 'x' + } +} \ No newline at end of file diff --git a/test/ParseableInterface/default-args.swift b/test/ModuleInterface/default-args.swift similarity index 92% rename from test/ParseableInterface/default-args.swift rename to test/ModuleInterface/default-args.swift index cec17715ee839..a08ff97212aad 100644 --- a/test/ParseableInterface/default-args.swift +++ b/test/ModuleInterface/default-args.swift @@ -3,7 +3,7 @@ // RUN: %target-swift-frontend -merge-modules -emit-module -o %t/Test.swiftmodule %t/Test~partial.swiftmodule // RUN: %target-swift-ide-test -print-module -module-to-print=Test -source-filename=x -I %t -prefer-type-repr=false -fully-qualified-types=true | %FileCheck %s -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Test.swiftinterface -module-name Test -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/Test.swiftinterface -module-name Test -enable-library-evolution %s // RUN: rm %t/Test.swiftmodule // RUN: echo "import Test" > %t/test-client.swift // RUN: %target-swift-frontend -typecheck -I%t %t/test-client.swift diff --git a/test/ParseableInterface/default-prebuilt-module-location.swift b/test/ModuleInterface/default-prebuilt-module-location.swift similarity index 100% rename from test/ParseableInterface/default-prebuilt-module-location.swift rename to test/ModuleInterface/default-prebuilt-module-location.swift diff --git a/test/ParseableInterface/enums-layout.swift b/test/ModuleInterface/enums-layout.swift similarity index 100% rename from test/ParseableInterface/enums-layout.swift rename to test/ModuleInterface/enums-layout.swift diff --git a/test/ParseableInterface/escape-Type-and-Protocol.swift b/test/ModuleInterface/escape-Type-and-Protocol.swift similarity index 100% rename from test/ParseableInterface/escape-Type-and-Protocol.swift rename to test/ModuleInterface/escape-Type-and-Protocol.swift diff --git a/test/ParseableInterface/exported-module-name.swift b/test/ModuleInterface/exported-module-name.swift similarity index 62% rename from test/ParseableInterface/exported-module-name.swift rename to test/ModuleInterface/exported-module-name.swift index f4722edfbe3b4..002066ee6aa6f 100644 --- a/test/ParseableInterface/exported-module-name.swift +++ b/test/ModuleInterface/exported-module-name.swift @@ -1,9 +1,9 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/CoreKitClient.swiftinterface -module-name CoreKitClient -I %S/Inputs/exported-module-name-before %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/CoreKitClient.swiftinterface -module-name CoreKitClient -I %S/Inputs/exported-module-name-before %s // RUN: %FileCheck -implicit-check-not BAD %s < %t/CoreKitClient.swiftinterface // Test that we can rebuild it even when the "export as" module goes away. -// RUN: %target-swift-frontend -build-module-from-parseable-interface -o %t/CoreKitClient.swiftmodule -I %S/Inputs/exported-module-name-after %t/CoreKitClient.swiftinterface +// RUN: %target-swift-frontend -compile-module-from-interface -o %t/CoreKitClient.swiftmodule -I %S/Inputs/exported-module-name-after %t/CoreKitClient.swiftinterface // CHECK: import CoreKit import CoreKit diff --git a/test/ParseableInterface/fixed-layout-property-initializers.swift b/test/ModuleInterface/fixed-layout-property-initializers.swift similarity index 83% rename from test/ParseableInterface/fixed-layout-property-initializers.swift rename to test/ModuleInterface/fixed-layout-property-initializers.swift index 4430198281976..3f75ecf019e83 100644 --- a/test/ParseableInterface/fixed-layout-property-initializers.swift +++ b/test/ModuleInterface/fixed-layout-property-initializers.swift @@ -1,16 +1,16 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.swiftinterface %s // RUN: %FileCheck %s --check-prefix FROMSOURCE --check-prefix NONRESILIENT --check-prefix COMMON < %t.swiftinterface -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t-resilient.swiftinterface -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t-resilient.swiftinterface -enable-library-evolution %s // RUN: %FileCheck %s --check-prefix FROMSOURCE --check-prefix RESILIENT --check-prefix COMMON < %t-resilient.swiftinterface // RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule %t.swiftinterface -disable-objc-attr-requires-foundation-module -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -module-name Test -emit-parseable-module-interface-path - | %FileCheck %s --check-prefix FROMMODULE --check-prefix NONRESILIENT --check-prefix COMMON +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -module-name Test -emit-module-interface-path - | %FileCheck %s --check-prefix FROMMODULE --check-prefix NONRESILIENT --check-prefix COMMON // RUN: %target-swift-frontend -emit-module -o %t/TestResilient.swiftmodule -enable-library-evolution %t-resilient.swiftinterface -disable-objc-attr-requires-foundation-module -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/TestResilient.swiftmodule -module-name TestResilient -enable-library-evolution -emit-parseable-module-interface-path - | %FileCheck %s --check-prefix FROMMODULE --check-prefix RESILIENT --check-prefix COMMON +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/TestResilient.swiftmodule -module-name TestResilient -enable-library-evolution -emit-module-interface-path - | %FileCheck %s --check-prefix FROMMODULE --check-prefix RESILIENT --check-prefix COMMON // COMMON: @frozen public struct MyStruct { @frozen diff --git a/test/ParseableInterface/function_builders.swift b/test/ModuleInterface/function_builders.swift similarity index 93% rename from test/ParseableInterface/function_builders.swift rename to test/ModuleInterface/function_builders.swift index b760d6d6ed07c..b6058836c802a 100644 --- a/test/ParseableInterface/function_builders.swift +++ b/test/ModuleInterface/function_builders.swift @@ -1,5 +1,5 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -module-name FunctionBuilders -emit-parseable-module-interface-path %t/FunctionBuilders.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -module-name FunctionBuilders -emit-module-interface-path %t/FunctionBuilders.swiftinterface %s // RUN: %FileCheck %s < %t/FunctionBuilders.swiftinterface // RUN: %target-swift-frontend -I %t -typecheck -verify %S/Inputs/function_builders_client.swift diff --git a/test/ParseableInterface/iboutlet-private-set.swift b/test/ModuleInterface/iboutlet-private-set.swift similarity index 73% rename from test/ParseableInterface/iboutlet-private-set.swift rename to test/ModuleInterface/iboutlet-private-set.swift index b67c86d9bb723..700e18e2fc797 100644 --- a/test/ParseableInterface/iboutlet-private-set.swift +++ b/test/ModuleInterface/iboutlet-private-set.swift @@ -1,9 +1,9 @@ // REQUIRES: objc_interop // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-name Foo -emit-parseable-module-interface-path %t/Foo.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-name Foo -emit-module-interface-path %t/Foo.swiftinterface %s // RUN: %FileCheck %s -input-file %t/Foo.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Foo.swiftinterface -o %t/Foo.swiftmodule -module-name Foo +// RUN: %target-swift-frontend -compile-module-from-interface %t/Foo.swiftinterface -o %t/Foo.swiftmodule -module-name Foo // Test the interface we generate for @IBOutlet private(set) properties is // consumable. diff --git a/test/ParseableInterface/if-configs.swift b/test/ModuleInterface/if-configs.swift similarity index 95% rename from test/ParseableInterface/if-configs.swift rename to test/ModuleInterface/if-configs.swift index 4484440b3c477..4aefe7377da91 100644 --- a/test/ParseableInterface/if-configs.swift +++ b/test/ModuleInterface/if-configs.swift @@ -3,7 +3,7 @@ // RUN: %target-swift-frontend -merge-modules -emit-module -o %t/Test.swiftmodule %t/Test~partial.swiftmodule // RUN: %target-swift-ide-test -print-module -module-to-print=Test -source-filename=x -I %t -prefer-type-repr=false -fully-qualified-types=true | %FileCheck %s -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.swiftinterface -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.swiftinterface -enable-library-evolution %s // RUN: %FileCheck %s < %t.swiftinterface // CHECK: func hasClosureDefaultArgWithComplexNestedPoundIfs(_ x: () -> Swift.Void = { diff --git a/test/ParseableInterface/imports-submodule-order.swift b/test/ModuleInterface/imports-submodule-order.swift similarity index 63% rename from test/ParseableInterface/imports-submodule-order.swift rename to test/ModuleInterface/imports-submodule-order.swift index d6694bbc5ea87..db12d8f299992 100644 --- a/test/ParseableInterface/imports-submodule-order.swift +++ b/test/ModuleInterface/imports-submodule-order.swift @@ -1,5 +1,5 @@ -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - %s -I %S/Inputs/imports-submodule-order/ | %FileCheck %s -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - %s -I %S/Inputs/imports-submodule-order/ -D XY | %FileCheck %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s -I %S/Inputs/imports-submodule-order/ | %FileCheck %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s -I %S/Inputs/imports-submodule-order/ -D XY | %FileCheck %s #if XY @_exported import X.Submodule diff --git a/test/ParseableInterface/imports.swift b/test/ModuleInterface/imports.swift similarity index 84% rename from test/ParseableInterface/imports.swift rename to test/ModuleInterface/imports.swift index c599de9cad5b2..8f667e14dfba5 100644 --- a/test/ParseableInterface/imports.swift +++ b/test/ModuleInterface/imports.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -emit-module -o %t/empty.swiftmodule %S/../Inputs/empty.swift // RUN: %target-swift-frontend -emit-module -o %t/emptyButWithLibraryEvolution.swiftmodule %S/../Inputs/empty.swift -enable-library-evolution -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - %s %S/Inputs/imports-other.swift -I %S/Inputs/imports-clang-modules/ -I %t -verify -swift-version 5 -enable-library-evolution | %FileCheck -implicit-check-not BAD %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s %S/Inputs/imports-other.swift -I %S/Inputs/imports-clang-modules/ -I %t -verify -swift-version 5 -enable-library-evolution | %FileCheck -implicit-check-not BAD %s @_exported import empty // expected-warning {{module 'empty' was not compiled with library evolution support; using it means binary compatibility for 'imports' can't be guaranteed}} diff --git a/test/ParseableInterface/inherited-defaults-checks.swiftinterface b/test/ModuleInterface/inherited-defaults-checks.swiftinterface similarity index 100% rename from test/ParseableInterface/inherited-defaults-checks.swiftinterface rename to test/ModuleInterface/inherited-defaults-checks.swiftinterface diff --git a/test/ParseableInterface/inherited-defaults-execution.swift b/test/ModuleInterface/inherited-defaults-execution.swift similarity index 92% rename from test/ParseableInterface/inherited-defaults-execution.swift rename to test/ModuleInterface/inherited-defaults-execution.swift index 165da21ebb75f..52fa5c3f93f01 100644 --- a/test/ParseableInterface/inherited-defaults-execution.swift +++ b/test/ModuleInterface/inherited-defaults-execution.swift @@ -6,7 +6,7 @@ // 1) Build the 'Inherited' library and its interface from this file // -// RUN: %target-build-swift-dylib(%t/%target-library-name(Inherited)) -emit-module-path %t/Inherited.swiftmodule -emit-parseable-module-interface-path %t/Inherited.swiftinterface -module-name Inherited %s +// RUN: %target-build-swift-dylib(%t/%target-library-name(Inherited)) -emit-module-path %t/Inherited.swiftmodule -emit-module-interface-path %t/Inherited.swiftinterface -module-name Inherited %s // RUN: rm %t/Inherited.swiftmodule // 2) Check the interface includes the synthesized initializers of the base diff --git a/test/ParseableInterface/inherited-generic-parameters.swift b/test/ModuleInterface/inherited-generic-parameters.swift similarity index 100% rename from test/ParseableInterface/inherited-generic-parameters.swift rename to test/ModuleInterface/inherited-generic-parameters.swift diff --git a/test/ParseableInterface/inlinable-function.swift b/test/ModuleInterface/inlinable-function.swift similarity index 97% rename from test/ParseableInterface/inlinable-function.swift rename to test/ModuleInterface/inlinable-function.swift index fe1e03a4eefe8..83f801c9a0cf3 100644 --- a/test/ParseableInterface/inlinable-function.swift +++ b/test/ModuleInterface/inlinable-function.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-parseable-module-interface-path %t/Test.swiftinterface -module-name Test %s +// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/Test.swiftinterface -module-name Test %s // RUN: %FileCheck %s --check-prefix FROMSOURCE --check-prefix CHECK < %t/Test.swiftinterface -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -disable-objc-attr-requires-foundation-module -emit-parseable-module-interface-path %t/TestFromModule.swiftinterface -module-name Test +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -disable-objc-attr-requires-foundation-module -emit-module-interface-path %t/TestFromModule.swiftinterface -module-name Test // RUN: %FileCheck %s --check-prefix FROMMODULE --check-prefix CHECK < %t/TestFromModule.swiftinterface // FIXME: These shouldn't be different, or we'll get different output from diff --git a/test/ParseableInterface/lazy-vars.swift b/test/ModuleInterface/lazy-vars.swift similarity index 64% rename from test/ParseableInterface/lazy-vars.swift rename to test/ModuleInterface/lazy-vars.swift index 4027263d7f45c..980051dc48481 100644 --- a/test/ParseableInterface/lazy-vars.swift +++ b/test/ModuleInterface/lazy-vars.swift @@ -1,15 +1,15 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -module-name Test -emit-parseable-module-interface-path %t/Test.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -module-name Test -emit-module-interface-path %t/Test.swiftinterface %s // RUN: %FileCheck %s < %t/Test.swiftinterface --check-prefix CHECK --check-prefix NONRESILIENT -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Test.swiftinterface -o %t/Test.swiftmodule -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -emit-parseable-module-interface-path - %t/Test.swiftmodule -module-name Test | %FileCheck %s --check-prefix CHECK --check-prefix NONRESILIENT +// RUN: %target-swift-frontend -compile-module-from-interface %t/Test.swiftinterface -o %t/Test.swiftmodule +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -emit-module-interface-path - %t/Test.swiftmodule -module-name Test | %FileCheck %s --check-prefix CHECK --check-prefix NONRESILIENT -// RUN: %target-swift-frontend -typecheck -module-name TestResilient -emit-parseable-module-interface-path %t/TestResilient.swiftinterface -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -module-name TestResilient -emit-module-interface-path %t/TestResilient.swiftinterface -enable-library-evolution %s // RUN: %FileCheck %s < %t/TestResilient.swiftinterface --check-prefix CHECK --check-prefix RESILIENT -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/TestResilient.swiftinterface -o %t/TestResilient.swiftmodule -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -emit-parseable-module-interface-path - %t/TestResilient.swiftmodule -module-name TestResilient | %FileCheck %s --check-prefix CHECK --check-prefix RESILIENT +// RUN: %target-swift-frontend -compile-module-from-interface %t/TestResilient.swiftinterface -o %t/TestResilient.swiftmodule +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -emit-module-interface-path - %t/TestResilient.swiftmodule -module-name TestResilient | %FileCheck %s --check-prefix CHECK --check-prefix RESILIENT // CHECK: @frozen public struct HasLazyVarsFixedLayout { // CHECK-NEXT: public var foo: Swift.Int { diff --git a/test/ParseableInterface/linking-to-module.swift b/test/ModuleInterface/linking-to-module.swift similarity index 78% rename from test/ParseableInterface/linking-to-module.swift rename to test/ModuleInterface/linking-to-module.swift index 3d79f2a1fc10a..60c902098e98e 100644 --- a/test/ParseableInterface/linking-to-module.swift +++ b/test/ModuleInterface/linking-to-module.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) -// RUN: %target-build-swift -emit-library -module-name TestModule -module-link-name coreTestModuleKitUtilsTool %S/Inputs/TestModule.swift -emit-parseable-module-interface -o %t/%target-library-name(coreTestModuleKitUtilsTool) +// RUN: %target-build-swift -emit-library -module-name TestModule -module-link-name coreTestModuleKitUtilsTool %S/Inputs/TestModule.swift -emit-module-interface -o %t/%target-library-name(coreTestModuleKitUtilsTool) // RUN: %target-swift-frontend -emit-ir -I %t -L %t %s | %FileCheck %s import TestModule diff --git a/test/ParseableInterface/modifiers.swift b/test/ModuleInterface/modifiers.swift similarity index 90% rename from test/ParseableInterface/modifiers.swift rename to test/ModuleInterface/modifiers.swift index d31cb04e3f721..3306038d1f5c5 100644 --- a/test/ParseableInterface/modifiers.swift +++ b/test/ModuleInterface/modifiers.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-parseable-module-interface-path %t/Test.swiftinterface -module-name Test -disable-objc-attr-requires-foundation-module -enable-objc-interop %s +// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -emit-module-interface-path %t/Test.swiftinterface -module-name Test -disable-objc-attr-requires-foundation-module -enable-objc-interop %s // RUN: %FileCheck %s --check-prefix FROMSOURCE --check-prefix CHECK < %t/Test.swiftinterface -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -disable-objc-attr-requires-foundation-module -emit-parseable-module-interface-path - -module-name Test -enable-objc-interop | %FileCheck %s --check-prefix FROMMODULE --check-prefix CHECK +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -disable-objc-attr-requires-foundation-module -emit-module-interface-path - -module-name Test -enable-objc-interop | %FileCheck %s --check-prefix FROMMODULE --check-prefix CHECK // CHECK-LABEL: final public class FinalClass { public final class FinalClass { diff --git a/test/ParseableInterface/multiline-availability-message.swift b/test/ModuleInterface/multiline-availability-message.swift similarity index 71% rename from test/ParseableInterface/multiline-availability-message.swift rename to test/ModuleInterface/multiline-availability-message.swift index 9942b73b5d819..4a43d856bf47d 100644 --- a/test/ParseableInterface/multiline-availability-message.swift +++ b/test/ModuleInterface/multiline-availability-message.swift @@ -1,9 +1,9 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -module-name Test -emit-parseable-module-interface-path %t/Test.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -module-name Test -emit-module-interface-path %t/Test.swiftinterface %s // RUN: %FileCheck %s < %t/Test.swiftinterface -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Test.swiftinterface -o %t/Test.swiftmodule -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -emit-parseable-module-interface-path - %t/Test.swiftmodule -module-name Test | %FileCheck %s +// RUN: %target-swift-frontend -compile-module-from-interface %t/Test.swiftinterface -o %t/Test.swiftmodule +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -emit-module-interface-path - %t/Test.swiftmodule -module-name Test | %FileCheck %s // CHECK: @available(*, unavailable, message: "First line.\nAnother line!") // CHECK: public func catastrophicFunction() diff --git a/test/ParseableInterface/opaque-result-types.swift b/test/ModuleInterface/opaque-result-types.swift similarity index 98% rename from test/ParseableInterface/opaque-result-types.swift rename to test/ModuleInterface/opaque-result-types.swift index 35169caf53f78..8cb638d1f6bea 100644 --- a/test/ParseableInterface/opaque-result-types.swift +++ b/test/ModuleInterface/opaque-result-types.swift @@ -1,5 +1,5 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -module-name OpaqueResultTypes -emit-parseable-module-interface-path %t/OpaqueResultTypes.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -module-name OpaqueResultTypes -emit-module-interface-path %t/OpaqueResultTypes.swiftinterface %s // RUN: %FileCheck %s < %t/OpaqueResultTypes.swiftinterface // RUN: %target-swift-frontend -I %t -typecheck -verify %S/Inputs/opaque-result-types-client.swift diff --git a/test/ModuleInterface/optimization-level.swift b/test/ModuleInterface/optimization-level.swift new file mode 100644 index 0000000000000..9db790ede801a --- /dev/null +++ b/test/ModuleInterface/optimization-level.swift @@ -0,0 +1,16 @@ +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/Lib.swiftinterface %s -O +// RUN: %target-swift-frontend -compile-module-from-interface %t/Lib.swiftinterface -Xllvm -sil-print-pass-name -o /dev/null 2>&1 | %FileCheck --check-prefix OPT %s + +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/Lib.swiftinterface %s -Onone +// RUN: %target-swift-frontend -compile-module-from-interface %t/Lib.swiftinterface -Xllvm -sil-print-pass-name -o /dev/null 2>&1 | %FileCheck --check-prefix UNOPT %s + +// This is a bit of an implementation detail, but we want to make sure +// optimization passes don't run when compiling a .swiftinterface that was +// generated with -Onone. + +// OPT: EagerSpecializer +// UNOPT-NOT: EagerSpecializer +public func f() {} + diff --git a/test/ParseableInterface/option-preservation.swift b/test/ModuleInterface/option-preservation.swift similarity index 70% rename from test/ParseableInterface/option-preservation.swift rename to test/ModuleInterface/option-preservation.swift index 3c84b9c01cb66..7b47c847563ca 100644 --- a/test/ParseableInterface/option-preservation.swift +++ b/test/ModuleInterface/option-preservation.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -enable-library-evolution -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone -enforce-exclusivity=unchecked -autolink-force-load +// RUN: %target-swift-frontend -enable-library-evolution -emit-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone -enforce-exclusivity=unchecked -autolink-force-load // RUN: %FileCheck %s < %t.swiftinterface -check-prefix=CHECK-SWIFTINTERFACE // // CHECK-SWIFTINTERFACE: swift-module-flags: @@ -11,7 +11,7 @@ // Make sure flags show up when filelists are enabled -// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked -enforce-exclusivity=unchecked -autolink-force-load 2>&1 +// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked -enforce-exclusivity=unchecked -autolink-force-load 2>&1 // RUN: %FileCheck %s < %t/foo.swiftinterface --check-prefix CHECK-FILELIST-INTERFACE // CHECK-FILELIST-INTERFACE: swift-module-flags: diff --git a/test/ParseableInterface/preserve-type-repr.swift b/test/ModuleInterface/preserve-type-repr.swift similarity index 100% rename from test/ParseableInterface/preserve-type-repr.swift rename to test/ModuleInterface/preserve-type-repr.swift diff --git a/test/ParseableInterface/print-from-partial-modules.swift b/test/ModuleInterface/print-from-partial-modules.swift similarity index 78% rename from test/ParseableInterface/print-from-partial-modules.swift rename to test/ModuleInterface/print-from-partial-modules.swift index fdd38f6ad6a01..c5259fb10163c 100644 --- a/test/ParseableInterface/print-from-partial-modules.swift +++ b/test/ModuleInterface/print-from-partial-modules.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -emit-module -o %t/main~partial.swiftmodule -primary-file %s %S/Inputs/other.swift -module-name main // RUN: %target-swift-frontend -emit-module -o %t/other~partial.swiftmodule %s -primary-file %S/Inputs/other.swift -module-name main -// RUN: %target-swift-frontend -merge-modules -emit-module -o /dev/null -emit-parseable-module-interface-path - %t/main~partial.swiftmodule -module-name main %t/other~partial.swiftmodule | %FileCheck %s +// RUN: %target-swift-frontend -merge-modules -emit-module -o /dev/null -emit-module-interface-path - %t/main~partial.swiftmodule -module-name main %t/other~partial.swiftmodule | %FileCheck %s // CHECK: {{^}}public func verySimpleFunction(){{$}} public func verySimpleFunction() {} diff --git a/test/ParseableInterface/private-stored-member-type-layout.swift b/test/ModuleInterface/private-stored-member-type-layout.swift similarity index 93% rename from test/ParseableInterface/private-stored-member-type-layout.swift rename to test/ModuleInterface/private-stored-member-type-layout.swift index 3ff6d0a383ade..69b9d7cdbbb44 100644 --- a/test/ParseableInterface/private-stored-member-type-layout.swift +++ b/test/ModuleInterface/private-stored-member-type-layout.swift @@ -2,7 +2,7 @@ // Check that importing this module creates the right types -// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/private-stored-members.swiftinterface -module-name PrivateStoredMembers -emit-module -o %t/PrivateStoredMembers.swiftmodule %S/private-stored-members.swift +// RUN: %target-swift-frontend -emit-module-interface-path %t/private-stored-members.swiftinterface -module-name PrivateStoredMembers -emit-module -o %t/PrivateStoredMembers.swiftmodule %S/private-stored-members.swift // RUN: %target-swift-frontend -emit-ir %s -I %t 2>&1 -DSHOULD_IMPORT | %FileCheck %s --check-prefix CHECK-EXEC --check-prefix CHECK // Check that the types are also correct when importing a module created from an interface diff --git a/test/ParseableInterface/private-stored-members.swift b/test/ModuleInterface/private-stored-members.swift similarity index 87% rename from test/ParseableInterface/private-stored-members.swift rename to test/ModuleInterface/private-stored-members.swift index c02fe2670bb3d..508613dd37933 100644 --- a/test/ParseableInterface/private-stored-members.swift +++ b/test/ModuleInterface/private-stored-members.swift @@ -1,16 +1,16 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.swiftinterface %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.swiftinterface %s // RUN: %FileCheck %s < %t.swiftinterface --check-prefix CHECK --check-prefix COMMON -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t-resilient.swiftinterface -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t-resilient.swiftinterface -enable-library-evolution %s // RUN: %FileCheck %s --check-prefix RESILIENT --check-prefix COMMON < %t-resilient.swiftinterface // RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule %t.swiftinterface -disable-objc-attr-requires-foundation-module -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -module-name Test -emit-parseable-module-interface-path - | %FileCheck %s --check-prefix CHECK --check-prefix COMMON +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -module-name Test -emit-module-interface-path - | %FileCheck %s --check-prefix CHECK --check-prefix COMMON // RUN: %target-swift-frontend -emit-module -o %t/TestResilient.swiftmodule -enable-library-evolution %t.swiftinterface -disable-objc-attr-requires-foundation-module -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/TestResilient.swiftmodule -module-name TestResilient -enable-library-evolution -emit-parseable-module-interface-path - | %FileCheck %s --check-prefix RESILIENT --check-prefix COMMON +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/TestResilient.swiftmodule -module-name TestResilient -enable-library-evolution -emit-module-interface-path - | %FileCheck %s --check-prefix RESILIENT --check-prefix COMMON // COMMON: struct MyStruct {{{$}} diff --git a/test/ParseableInterface/property_wrappers.swift b/test/ModuleInterface/property_wrappers.swift similarity index 77% rename from test/ParseableInterface/property_wrappers.swift rename to test/ModuleInterface/property_wrappers.swift index 8ed82cdb57443..0196890e5b830 100644 --- a/test/ParseableInterface/property_wrappers.swift +++ b/test/ModuleInterface/property_wrappers.swift @@ -1,10 +1,10 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -swift-version 5 -module-name TestResilient -emit-parseable-module-interface-path %t/TestResilient.swiftinterface -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -swift-version 5 -module-name TestResilient -emit-module-interface-path %t/TestResilient.swiftinterface -enable-library-evolution %s // RUN: %FileCheck %s < %t/TestResilient.swiftinterface --check-prefix CHECK --check-prefix RESILIENT -// RUN: %target-swift-frontend -build-module-from-parseable-interface -swift-version 5 %t/TestResilient.swiftinterface -o %t/TestResilient.swiftmodule -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -swift-version 5 -emit-parseable-module-interface-path - %t/TestResilient.swiftmodule -module-name TestResilient | %FileCheck %s --check-prefix CHECK --check-prefix RESILIENT +// RUN: %target-swift-frontend -compile-module-from-interface -swift-version 5 %t/TestResilient.swiftinterface -o %t/TestResilient.swiftmodule +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules -swift-version 5 -emit-module-interface-path - %t/TestResilient.swiftmodule -module-name TestResilient | %FileCheck %s --check-prefix CHECK --check-prefix RESILIENT @propertyWrapper public struct Wrapper { diff --git a/test/ParseableInterface/show-in-interface.swift b/test/ModuleInterface/show-in-interface.swift similarity index 80% rename from test/ParseableInterface/show-in-interface.swift rename to test/ModuleInterface/show-in-interface.swift index 31dc94d873546..ba11f3ad92dd9 100644 --- a/test/ParseableInterface/show-in-interface.swift +++ b/test/ModuleInterface/show-in-interface.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -typecheck %s -parse-stdlib -emit-parseable-module-interface-path - | %FileCheck %s +// RUN: %target-swift-frontend -typecheck %s -parse-stdlib -emit-module-interface-path - | %FileCheck %s // CHECK: @_show_in_interface public protocol _UnderscoredProtocol { // CHECK-NEXT: } diff --git a/test/ModuleInterface/smoke-test.swift b/test/ModuleInterface/smoke-test.swift new file mode 100644 index 0000000000000..4ba540dcbf4e4 --- /dev/null +++ b/test/ModuleInterface/smoke-test.swift @@ -0,0 +1,10 @@ +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s | %FileCheck %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s %S/Inputs/other.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-MULTI-FILE %s + +// CHECK: public func verySimpleFunction(){{$}} +public func verySimpleFunction() {} + +// CHECK: public func ownership(_ x: __shared Swift.AnyObject){{$}} +public func ownership(_ x: __shared AnyObject) {} + +// CHECK-MULTI-FILE: public func otherFileFunction(){{$}} diff --git a/test/ModuleInterface/stdlib.swift b/test/ModuleInterface/stdlib.swift new file mode 100644 index 0000000000000..f221fcb10667f --- /dev/null +++ b/test/ModuleInterface/stdlib.swift @@ -0,0 +1,11 @@ +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - -parse-stdlib %s | %FileCheck %s +// RUN: %target-swift-frontend -emit-module-interface-path - -emit-module -o /dev/null -parse-stdlib %s | %FileCheck %s + +// CHECK-NOT: import Builtin + +// CHECK: func test() { +// CHECK-NEXT: Builtin.sizeof +// CHECK-NEXT: {{^}$}} +@inlinable public func test() { + Builtin.sizeof(Builtin.Int8.self) +} diff --git a/test/ParseableInterface/stored-properties-client.swift b/test/ModuleInterface/stored-properties-client.swift similarity index 100% rename from test/ParseableInterface/stored-properties-client.swift rename to test/ModuleInterface/stored-properties-client.swift diff --git a/test/ParseableInterface/stored-properties.swift b/test/ModuleInterface/stored-properties.swift similarity index 87% rename from test/ParseableInterface/stored-properties.swift rename to test/ModuleInterface/stored-properties.swift index 6454740e499d0..e641ad24aa2ae 100644 --- a/test/ParseableInterface/stored-properties.swift +++ b/test/ModuleInterface/stored-properties.swift @@ -1,16 +1,16 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.swiftinterface -module-name StoredProperties %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.swiftinterface -module-name StoredProperties %s // RUN: %FileCheck %s < %t.swiftinterface --check-prefix CHECK --check-prefix COMMON -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t-resilient.swiftinterface -module-name StoredProperties -enable-library-evolution %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t-resilient.swiftinterface -module-name StoredProperties -enable-library-evolution %s // RUN: %FileCheck %s < %t-resilient.swiftinterface --check-prefix RESILIENT --check-prefix COMMON // RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule -module-name StoredProperties %t.swiftinterface -disable-objc-attr-requires-foundation-module -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -module-name StoredProperties -emit-parseable-module-interface-path - | %FileCheck %s --check-prefix CHECK --check-prefix COMMON +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/Test.swiftmodule -module-name StoredProperties -emit-module-interface-path - | %FileCheck %s --check-prefix CHECK --check-prefix COMMON // RUN: %target-swift-frontend -emit-module -o %t/TestResilient.swiftmodule -module-name StoredProperties -enable-library-evolution %t-resilient.swiftinterface -disable-objc-attr-requires-foundation-module -// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/TestResilient.swiftmodule -module-name StoredProperties -enable-library-evolution -emit-parseable-module-interface-path - | %FileCheck %s --check-prefix RESILIENT --check-prefix COMMON +// RUN: %target-swift-frontend -emit-module -o /dev/null -merge-modules %t/TestResilient.swiftmodule -module-name StoredProperties -enable-library-evolution -emit-module-interface-path - | %FileCheck %s --check-prefix RESILIENT --check-prefix COMMON // COMMON: public struct HasStoredProperties { public struct HasStoredProperties { diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Bad.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Bad.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Bad.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Bad.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Good.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Good.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Good.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Good.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Swift.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Swift.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Swift.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/broken-stdlib-sdk/usr/lib/swift/Swift.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-ios-macabi.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-ios-macabi.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-ios-macabi.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-ios-macabi.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-macos.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-macos.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-macos.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64-apple-macos.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/Library/Frameworks/Zippered.framework/Modules/Zippered.swiftmodule/x86_64.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/x86_64.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/System/iOSSupport/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/iosmac-sdk/MacOSX.sdk/usr/lib/swift/Foo.swiftmodule/x86_64.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/BinaryOnly_BAD.framework/Modules/BinaryOnly_BAD.swiftmodule/xyz.swiftmodule b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/BinaryOnly_BAD.framework/Modules/BinaryOnly_BAD.swiftmodule/xyz.swiftmodule similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/BinaryOnly_BAD.framework/Modules/BinaryOnly_BAD.swiftmodule/xyz.swiftmodule rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/BinaryOnly_BAD.framework/Modules/BinaryOnly_BAD.swiftmodule/xyz.swiftmodule diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatInterface_BAD.framework/Modules/FlatInterface_BAD.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatInterface_BAD.framework/Modules/FlatInterface_BAD.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatInterface_BAD.framework/Modules/FlatInterface_BAD.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatInterface_BAD.framework/Modules/FlatInterface_BAD.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatModule_BAD.framework/Modules/FlatModule_BAD.swiftmodule b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatModule_BAD.framework/Modules/FlatModule_BAD.swiftmodule similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatModule_BAD.framework/Modules/FlatModule_BAD.swiftmodule rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/FlatModule_BAD.framework/Modules/FlatModule_BAD.swiftmodule diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/HasNested_BAD.framework/Frameworks/Nested.framework/Modules/Nested.swiftmodule/xyz.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/HasNested_BAD.framework/Frameworks/Nested.framework/Modules/Nested.swiftmodule/xyz.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/HasNested_BAD.framework/Frameworks/Nested.framework/Modules/Nested.swiftmodule/xyz.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/HasNested_BAD.framework/Frameworks/Nested.framework/Modules/Nested.swiftmodule/xyz.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyz.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyz.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyz.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyz.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/PrivateFrameworks/PrivateSimple.framework/Modules/PrivateSimple.swiftmodule/xyz.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/PrivateFrameworks/PrivateSimple.framework/Modules/PrivateSimple.swiftmodule/xyz.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/PrivateFrameworks/PrivateSimple.framework/Modules/PrivateSimple.swiftmodule/xyz.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/Library/PrivateFrameworks/PrivateSimple.framework/Modules/PrivateSimple.swiftmodule/xyz.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyzzy.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyzzy.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyzzy.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/System/Library/Frameworks/Simple.framework/Modules/Simple.swiftmodule/xyzzy.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/usr/lib/swift/Caramel.swiftmodule/xyz.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/usr/lib/swift/Caramel.swiftmodule/xyz.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/usr/lib/swift/Caramel.swiftmodule/xyz.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/System/iOSSupport/usr/lib/swift/Caramel.swiftmodule/xyz.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Flat.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Flat.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Flat.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Flat.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Normal.swiftmodule/xyz.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Normal.swiftmodule/xyz.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Normal.swiftmodule/xyz.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/mock-sdk/usr/lib/swift/Normal.swiftmodule/xyz.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/Platform.h b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/Platform.h similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/Platform.h rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/Platform.h diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/module.modulemap b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/module.modulemap similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/module.modulemap rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/include/module.modulemap diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/lib/swift/Swifty.swiftmodule/dummy-file-so-git-includes-this-otherwise-empty-directory b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/lib/swift/Swifty.swiftmodule/dummy-file-so-git-includes-this-otherwise-empty-directory similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/lib/swift/Swifty.swiftmodule/dummy-file-so-git-includes-this-otherwise-empty-directory rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/system-dependencies-sdk/usr/lib/swift/Swifty.swiftmodule/dummy-file-so-git-includes-this-otherwise-empty-directory diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfail-logs-framework/BadFMWK.framework/Modules/BadFMWK.swiftmodule/x86_64-apple-macos.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfail-logs-framework/BadFMWK.framework/Modules/BadFMWK.swiftmodule/x86_64-apple-macos.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfail-logs-framework/BadFMWK.framework/Modules/BadFMWK.swiftmodule/x86_64-apple-macos.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfail-logs-framework/BadFMWK.framework/Modules/BadFMWK.swiftmodule/x86_64-apple-macos.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Bad.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Bad.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Bad.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Bad.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Good.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Good.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Good.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Good.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Swift.swiftinterface b/test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Swift.swiftinterface similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Swift.swiftinterface rename to test/ModuleInterface/swift_build_sdk_interfaces/Inputs/xfails-sdk/usr/lib/swift/Swift.swiftinterface diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/check-only-mode.swift b/test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift similarity index 77% rename from test/ParseableInterface/swift_build_sdk_interfaces/check-only-mode.swift rename to test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift index 23dc5535d7e80..fa60a806ad84c 100644 --- a/test/ParseableInterface/swift_build_sdk_interfaces/check-only-mode.swift +++ b/test/ModuleInterface/swift_build_sdk_interfaces/check-only-mode.swift @@ -2,9 +2,9 @@ // RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule // RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule -// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal -// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat -// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK +// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal +// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat +// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK // RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt -check-only // RUN: ls %t/prebuilt | %FileCheck %s diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/compiler-crash.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/compiler-crash.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/compiler-crash.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/compiler-crash.test-sh diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift b/test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift similarity index 87% rename from test/ParseableInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift rename to test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift index 9fa4a0788d0b2..fdc22b4e71093 100644 --- a/test/ParseableInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift +++ b/test/ModuleInterface/swift_build_sdk_interfaces/compiler-uses-prebuilt.swift @@ -2,9 +2,9 @@ // RUN: mkdir -p %t/sdk/usr/lib/swift/Normal.swiftmodule // RUN: mkdir -p %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule -// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal -// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat -// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK +// RUN: echo 'public func normal() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Normal.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Normal +// RUN: echo 'public func flat() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Flat.swiftinterface -emit-module -o /dev/null -module-name Flat +// RUN: echo 'public func fmwk() {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/System/Library/Frameworks/FMWK.framework/Modules/FMWK.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name FMWK // RUN: %swift_build_sdk_interfaces -sdk %t/sdk -Fsystem %t/sdk/System/Library/Frameworks -v -o %t/prebuilt // RUN: ls %t/prebuilt | %FileCheck %s diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/early-exits.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/early-exits.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/early-exits.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/early-exits.test-sh diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/find-modules.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/find-modules.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/find-modules.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/find-modules.test-sh diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/ignore-non-stdlib-failures.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/ignore-non-stdlib-failures.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/ignore-non-stdlib-failures.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/ignore-non-stdlib-failures.test-sh diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/iosmac.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/iosmac.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/iosmac.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/iosmac.test-sh diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/lit.local.cfg b/test/ModuleInterface/swift_build_sdk_interfaces/lit.local.cfg similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/lit.local.cfg rename to test/ModuleInterface/swift_build_sdk_interfaces/lit.local.cfg diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/machine-parseable-monotonic-version.py b/test/ModuleInterface/swift_build_sdk_interfaces/machine-parseable-monotonic-version.py similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/machine-parseable-monotonic-version.py rename to test/ModuleInterface/swift_build_sdk_interfaces/machine-parseable-monotonic-version.py diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/track-system-dependencies.swift b/test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift similarity index 90% rename from test/ParseableInterface/swift_build_sdk_interfaces/track-system-dependencies.swift rename to test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift index 5e935fcf6174d..bf3e764bd3a15 100644 --- a/test/ParseableInterface/swift_build_sdk_interfaces/track-system-dependencies.swift +++ b/test/ModuleInterface/swift_build_sdk_interfaces/track-system-dependencies.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: cp -r %S/Inputs/system-dependencies-sdk %t/sdk -// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-parseable-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk +// RUN: echo 'import Platform; public func usesCStruct(_: SomeCStruct?) {}' | %target-swift-frontend - -emit-module-interface-path %t/sdk/usr/lib/swift/Swifty.swiftmodule/%target-cpu.swiftinterface -emit-module -o /dev/null -module-name Swifty -sdk %t/sdk // RUN: %swift_build_sdk_interfaces -sdk %t/sdk -v -o %t/prebuilt // RUN: ls %t/prebuilt | %FileCheck %s diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/xfail-logs.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/xfail-logs.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/xfail-logs.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/xfail-logs.test-sh diff --git a/test/ParseableInterface/swift_build_sdk_interfaces/xfails.test-sh b/test/ModuleInterface/swift_build_sdk_interfaces/xfails.test-sh similarity index 100% rename from test/ParseableInterface/swift_build_sdk_interfaces/xfails.test-sh rename to test/ModuleInterface/swift_build_sdk_interfaces/xfails.test-sh diff --git a/test/ParseableInterface/synthesized.swift b/test/ModuleInterface/synthesized.swift similarity index 92% rename from test/ParseableInterface/synthesized.swift rename to test/ModuleInterface/synthesized.swift index 539147e09b4d6..97dde58e55243 100644 --- a/test/ParseableInterface/synthesized.swift +++ b/test/ModuleInterface/synthesized.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - %s -disable-objc-attr-requires-foundation-module -enable-objc-interop > %t.swiftinterface +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path - %s -disable-objc-attr-requires-foundation-module -enable-objc-interop > %t.swiftinterface // RUN: %FileCheck %s < %t.swiftinterface // RUN: %FileCheck -check-prefix=NEGATIVE %s < %t.swiftinterface diff --git a/test/ParseableInterface/top-level-Type-and-Protocol.swift b/test/ModuleInterface/top-level-Type-and-Protocol.swift similarity index 100% rename from test/ParseableInterface/top-level-Type-and-Protocol.swift rename to test/ModuleInterface/top-level-Type-and-Protocol.swift diff --git a/test/ParseableInterface/unsupported-configurations.swift b/test/ModuleInterface/unsupported-configurations.swift similarity index 52% rename from test/ParseableInterface/unsupported-configurations.swift rename to test/ModuleInterface/unsupported-configurations.swift index 32f3dcb1dfdbb..f86bc0783aabb 100644 --- a/test/ParseableInterface/unsupported-configurations.swift +++ b/test/ModuleInterface/unsupported-configurations.swift @@ -1,21 +1,21 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/empty.swiftinterface %s -swift-version 4 2>&1 | %FileCheck -DVERSION=4 %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/empty.swiftinterface %s -swift-version 4 2>&1 | %FileCheck -DVERSION=4 %s // RUN: ls %t/empty.swiftinterface // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/empty.swiftinterface %s -swift-version 4.2 2>&1 | %FileCheck -DVERSION=4.2 %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/empty.swiftinterface %s -swift-version 4.2 2>&1 | %FileCheck -DVERSION=4.2 %s // RUN: ls %t/empty.swiftinterface // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/empty.swiftinterface %s -swift-version 4.2 -enable-library-evolution 2>&1 | %FileCheck -check-prefix=CHECK-VERSION-ONLY -DVERSION=4.2 %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/empty.swiftinterface %s -swift-version 4.2 -enable-library-evolution 2>&1 | %FileCheck -check-prefix=CHECK-VERSION-ONLY -DVERSION=4.2 %s // RUN: ls %t/empty.swiftinterface // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/empty.swiftinterface %s -swift-version 5 2>&1 | %FileCheck -check-prefix=CHECK-EVOLUTION-ONLY %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/empty.swiftinterface %s -swift-version 5 2>&1 | %FileCheck -check-prefix=CHECK-EVOLUTION-ONLY %s // RUN: ls %t/empty.swiftinterface // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/empty.swiftinterface %s -swift-version 5 -enable-library-evolution 2>&1 | %FileCheck -check-prefix=NEGATIVE -allow-empty %s +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t/empty.swiftinterface %s -swift-version 5 -enable-library-evolution 2>&1 | %FileCheck -check-prefix=NEGATIVE -allow-empty %s // RUN: ls %t/empty.swiftinterface // CHECK-DAG: warning: module interfaces are only supported with Swift language version 5 or later (currently using -swift-version [[VERSION]]) diff --git a/test/ParseableInterface/where-clause.swift b/test/ModuleInterface/where-clause.swift similarity index 100% rename from test/ParseableInterface/where-clause.swift rename to test/ModuleInterface/where-clause.swift diff --git a/test/ParseableInterface/dataflow-errors.swift b/test/ParseableInterface/dataflow-errors.swift deleted file mode 100644 index ef47939a0fc33..0000000000000 --- a/test/ParseableInterface/dataflow-errors.swift +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: rm -f %t -// RUN: not %target-swift-frontend -emit-parseable-module-interface-path %t -emit-module -o /dev/null %s -// RUN: test ! -f %t -// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t -typecheck %s -// RUN: test -f %t - -public struct BadInit { - public var x: Int - public init() { - return // without initializing 'x' - } -} \ No newline at end of file diff --git a/test/ParseableInterface/optimization-level.swift b/test/ParseableInterface/optimization-level.swift deleted file mode 100644 index 72992dc8ce0e6..0000000000000 --- a/test/ParseableInterface/optimization-level.swift +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Lib.swiftinterface %s -O -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Lib.swiftinterface -Xllvm -sil-print-pass-name -o /dev/null 2>&1 | %FileCheck --check-prefix OPT %s - -// RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t/Lib.swiftinterface %s -Onone -// RUN: %target-swift-frontend -build-module-from-parseable-interface %t/Lib.swiftinterface -Xllvm -sil-print-pass-name -o /dev/null 2>&1 | %FileCheck --check-prefix UNOPT %s - -// This is a bit of an implementation detail, but we want to make sure -// optimization passes don't run when compiling a .swiftinterface that was -// generated with -Onone. - -// OPT: EagerSpecializer -// UNOPT-NOT: EagerSpecializer -public func f() {} - diff --git a/test/ParseableInterface/smoke-test.swift b/test/ParseableInterface/smoke-test.swift deleted file mode 100644 index 713a45c792562..0000000000000 --- a/test/ParseableInterface/smoke-test.swift +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - %s | %FileCheck %s -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - %s %S/Inputs/other.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-MULTI-FILE %s - -// CHECK: public func verySimpleFunction(){{$}} -public func verySimpleFunction() {} - -// CHECK: public func ownership(_ x: __shared Swift.AnyObject){{$}} -public func ownership(_ x: __shared AnyObject) {} - -// CHECK-MULTI-FILE: public func otherFileFunction(){{$}} diff --git a/test/ParseableInterface/stdlib.swift b/test/ParseableInterface/stdlib.swift deleted file mode 100644 index d9596e5a82597..0000000000000 --- a/test/ParseableInterface/stdlib.swift +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path - -parse-stdlib %s | %FileCheck %s -// RUN: %target-swift-frontend -emit-parseable-module-interface-path - -emit-module -o /dev/null -parse-stdlib %s | %FileCheck %s - -// CHECK-NOT: import Builtin - -// CHECK: func test() { -// CHECK-NEXT: Builtin.sizeof -// CHECK-NEXT: {{^}$}} -@inlinable public func test() { - Builtin.sizeof(Builtin.Int8.self) -} diff --git a/test/SILGen/dynamic_accessors.swift b/test/SILGen/dynamic_accessors.swift index e31ceda3ecf5a..3cf07f11f307d 100644 --- a/test/SILGen/dynamic_accessors.swift +++ b/test/SILGen/dynamic_accessors.swift @@ -1,5 +1,5 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -emit-module -o /dev/null -disable-objc-attr-requires-foundation-module -enable-objc-interop -emit-parseable-module-interface-path %t/dynamic_accessors.swiftinterface %s +// RUN: %target-swift-frontend -emit-module -o /dev/null -disable-objc-attr-requires-foundation-module -enable-objc-interop -emit-module-interface-path %t/dynamic_accessors.swiftinterface %s // RUN: %target-swift-emit-silgen -disable-objc-attr-requires-foundation-module -enable-objc-interop %s | %FileCheck %s // RUN: %target-swift-frontend -emit-silgen -disable-objc-attr-requires-foundation-module -enable-objc-interop %t/dynamic_accessors.swiftinterface | %FileCheck %s diff --git a/test/SourceKit/CodeComplete/complete_swiftinterface.swift b/test/SourceKit/CodeComplete/complete_swiftinterface.swift index 4e8a988fe34f1..258d16228bf92 100644 --- a/test/SourceKit/CodeComplete/complete_swiftinterface.swift +++ b/test/SourceKit/CodeComplete/complete_swiftinterface.swift @@ -2,8 +2,8 @@ // RUN: %empty-directory(%t/modulecache) // 1) Build .swiftinterface files for MyPoint and MyExtensions, using a non-default module cache path -// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/MyPoint.swiftinterface -module-name MyPoint -emit-module -o /dev/null %S/Inputs/parseable-interface/MyPoint.swift -// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/MyPointExtensions.swiftinterface -module-name MyPointExtensions -emit-module -o /dev/null -module-cache-path %t/modulecache -I %t %S/Inputs/parseable-interface/MyPointExtensions.swift +// RUN: %target-swift-frontend -emit-module-interface-path %t/MyPoint.swiftinterface -module-name MyPoint -emit-module -o /dev/null %S/Inputs/parseable-interface/MyPoint.swift +// RUN: %target-swift-frontend -emit-module-interface-path %t/MyPointExtensions.swiftinterface -module-name MyPointExtensions -emit-module -o /dev/null -module-cache-path %t/modulecache -I %t %S/Inputs/parseable-interface/MyPointExtensions.swift // RUN: %empty-directory(%t/modulecache) // 2) Check completion using the default (cold) module cache diff --git a/test/SourceKit/CodeComplete/injected_vfs_swiftinterface.swift b/test/SourceKit/CodeComplete/injected_vfs_swiftinterface.swift index d61d9b05d77df..572de65437b03 100644 --- a/test/SourceKit/CodeComplete/injected_vfs_swiftinterface.swift +++ b/test/SourceKit/CodeComplete/injected_vfs_swiftinterface.swift @@ -9,5 +9,5 @@ func foo( // CHECK: key.name: "methodDefinedInSwiftModule()" // RUN: %empty-directory(%t) -// RUN: %target-swift-frontend -emit-parseable-module-interface-path %t/SwiftModule.swiftinterface -module-name SwiftModule -emit-module -o /dev/null %S/../Inputs/vfs/SwiftModule/SwiftModule.swift +// RUN: %target-swift-frontend -emit-module-interface-path %t/SwiftModule.swiftinterface -module-name SwiftModule -emit-module -o /dev/null %S/../Inputs/vfs/SwiftModule/SwiftModule.swift // RUN: %sourcekitd-test -req=complete -pos=6:31 -vfs-files=/target_file1.swift=%s,/SwiftModule/SwiftModule.swiftinterface=%t/SwiftModule.swiftinterface /target_file1.swift -pass-as-sourcetext -- /target_file1.swift -I /SwiftModule -target %target-triple | %FileCheck %s diff --git a/test/SourceKit/CursorInfo/cursor_swiftinterface.swift b/test/SourceKit/CursorInfo/cursor_swiftinterface.swift index fa11b29882b7b..9fc817d698189 100644 --- a/test/SourceKit/CursorInfo/cursor_swiftinterface.swift +++ b/test/SourceKit/CursorInfo/cursor_swiftinterface.swift @@ -17,7 +17,7 @@ func test() { // Setup phase 1: build the module interface (.swiftinterface) and doc (.swiftdoc). // -// RUN: %target-swift-frontend -I %t -module-name SomeModule -emit-parseable-module-interface-path %t/SomeModule.swiftinterface -emit-module-doc-path %t/SomeModule.swiftdoc %S/Inputs/SomeModule.swift -emit-module -o /dev/null +// RUN: %target-swift-frontend -I %t -module-name SomeModule -emit-module-interface-path %t/SomeModule.swiftinterface -emit-module-doc-path %t/SomeModule.swiftdoc %S/Inputs/SomeModule.swift -emit-module -o /dev/null // Actual test: Check the CusorInfo results of references to symbols in that // module, including the available refactoring actions, and associated doc diff --git a/test/SourceKit/InterfaceGen/gen_swift_module.swift b/test/SourceKit/InterfaceGen/gen_swift_module.swift index 47f96957c57c0..96994a786700a 100644 --- a/test/SourceKit/InterfaceGen/gen_swift_module.swift +++ b/test/SourceKit/InterfaceGen/gen_swift_module.swift @@ -30,6 +30,6 @@ func f(s : inout [Int]) { // Test we can generate the interface of a module loaded via a .swiftinterface file correctly // RUN: %empty-directory(%t.mod) -// RUN: %swift -emit-module -o /dev/null -emit-parseable-module-interface-path %t.mod/swift_mod.swiftinterface -O %S/Inputs/swift_mod.swift -parse-as-library +// RUN: %swift -emit-module -o /dev/null -emit-module-interface-path %t.mod/swift_mod.swiftinterface -O %S/Inputs/swift_mod.swift -parse-as-library // RUN: %sourcekitd-test -req=interface-gen -module swift_mod -- -I %t.mod -module-cache-path %t.mod/mcp > %t.response // RUN: diff -u %s.from_swiftinterface.response %t.response diff --git a/test/api-digester/compare-dump-abi-parsable-interface.swift b/test/api-digester/compare-dump-abi-parsable-interface.swift index 9041aac0212a9..b0645b417fcc5 100644 --- a/test/api-digester/compare-dump-abi-parsable-interface.swift +++ b/test/api-digester/compare-dump-abi-parsable-interface.swift @@ -3,8 +3,8 @@ // RUN: %empty-directory(%t.sdk) // RUN: %empty-directory(%t.module-cache) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache // RUN: %api-digester -diagnose-sdk -print-module -module cake -BI %t.mod1 -BI %S/Inputs/APINotesLeft -I %t.mod2 -I %S/Inputs/APINotesRight -sdk %clang-importer-sdk-path -bsdk %clang-importer-sdk-path -module-cache-path %t.module-cache -o %t.result -abi // RUN: %clang -E -P -x c %S/Outputs/Cake-abi.txt -o - | sed '/^\s*$/d' > %t.expected diff --git a/test/api-digester/compare-dump-binary-vs-interface.swift b/test/api-digester/compare-dump-binary-vs-interface.swift index 6acb3db19a568..a0466f0dc6407 100644 --- a/test/api-digester/compare-dump-binary-vs-interface.swift +++ b/test/api-digester/compare-dump-binary-vs-interface.swift @@ -10,7 +10,7 @@ // always give us some difference. // Generate .swiftinterface file for module cake -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache // Generate .swiftmodule file for module cake // RUN: %target-swift-frontend -emit-module -o %t.mod1/cake.swiftmodule %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache diff --git a/test/api-digester/compare-dump-parsable-interface.swift b/test/api-digester/compare-dump-parsable-interface.swift index 94a8e8d859222..b06c30ac97d7d 100644 --- a/test/api-digester/compare-dump-parsable-interface.swift +++ b/test/api-digester/compare-dump-parsable-interface.swift @@ -3,8 +3,8 @@ // RUN: %empty-directory(%t.sdk) // RUN: %empty-directory(%t.module-cache) -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache -// RUN: %target-swift-frontend -typecheck -emit-parseable-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod1/cake.swiftinterface %S/Inputs/cake_baseline/cake.swift -I %S/Inputs/APINotesLeft %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache +// RUN: %target-swift-frontend -typecheck -emit-module-interface-path %t.mod2/cake.swiftinterface %S/Inputs/cake_current/cake.swift -I %S/Inputs/APINotesRight %clang-importer-sdk-nosource -parse-as-library -enable-library-evolution -disable-objc-attr-requires-foundation-module -module-cache-path %t.module-cache // RUN: %api-digester -diagnose-sdk -print-module -module cake -BI %t.mod1 -BI %S/Inputs/APINotesLeft -I %t.mod2 -I %S/Inputs/APINotesRight -sdk %clang-importer-sdk-path -bsdk %clang-importer-sdk-path -module-cache-path %t.module-cache -o %t.result // RUN: %clang -E -P -x c %S/Outputs/Cake.txt -o - | sed '/^\s*$/d' > %t.expected diff --git a/unittests/FrontendTool/ModuleLoadingTests.cpp b/unittests/FrontendTool/ModuleLoadingTests.cpp index 81337b1ac6e13..5c643adc5d6b6 100644 --- a/unittests/FrontendTool/ModuleLoadingTests.cpp +++ b/unittests/FrontendTool/ModuleLoadingTests.cpp @@ -13,7 +13,7 @@ #include "gtest/gtest.h" #include "swift/AST/ASTContext.h" #include "swift/Frontend/Frontend.h" -#include "swift/Frontend/ParseableInterfaceModuleLoader.h" +#include "swift/Frontend/ModuleInterfaceLoader.h" #include "swift/Frontend/PrintingDiagnosticConsumer.h" #include "swift/Serialization/Validation.h" #include "llvm/ADT/SmallString.h" @@ -64,12 +64,12 @@ class OpenTrackingFileSystem : public llvm::vfs::ProxyFileSystem { } }; -class ParseableInterfaceModuleLoaderTest : public testing::Test { +class ModuleInterfaceLoaderTest : public testing::Test { protected: - void setupAndLoadParseableModule() { + void setupAndLoadModuleInterface() { SmallString<256> tempDir; ASSERT_FALSE(llvm::sys::fs::createUniqueDirectory( - "ParseableModuleBufferTests.emitModuleInMemory", tempDir)); + "ModuleInterfaceBufferTests.emitModuleInMemory", tempDir)); SWIFT_DEFER { llvm::sys::fs::remove_directories(tempDir); }; auto cacheDir = createFilename(tempDir, "ModuleCache"); @@ -99,7 +99,7 @@ class ParseableInterfaceModuleLoaderTest : public testing::Test { SearchPathOptions searchPathOpts; auto ctx = ASTContext::get(langOpts, searchPathOpts, sourceMgr, diags); - auto loader = ParseableInterfaceModuleLoader::create( + auto loader = ModuleInterfaceLoader::create( *ctx, cacheDir, prebuiltCacheDir, /*dependencyTracker*/nullptr, ModuleLoadingMode::PreferSerialized); @@ -138,8 +138,8 @@ class ParseableInterfaceModuleLoaderTest : public testing::Test { } }; -TEST_F(ParseableInterfaceModuleLoaderTest, LoadModuleFromBuffer) { - setupAndLoadParseableModule(); +TEST_F(ModuleInterfaceLoaderTest, LoadModuleFromBuffer) { + setupAndLoadModuleInterface(); } } // end namespace unittest