Skip to content

Rename "textual interface" to "parseable interface" #19713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/swift/AST/DiagnosticsFrontend.def
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ ERROR(error_mode_cannot_emit_module,none,
ERROR(error_mode_cannot_emit_module_doc,none,
"this mode does not support emitting module documentation files", ())
ERROR(error_mode_cannot_emit_interface,none,
"this mode does not support emitting textual interface files", ())
"this mode does not support emitting parseable interface files", ())

WARNING(emit_reference_dependencies_without_primary_file,none,
"ignoring -emit-reference-dependencies (requires -primary-file)", ())
Expand Down Expand Up @@ -260,8 +260,8 @@ ERROR(error_invalid_debug_prefix_map, none,
ERROR(invalid_vfs_overlay_file,none,
"invalid virtual overlay file '%0'", (StringRef))

WARNING(textual_interface_scoped_import_unsupported,none,
"scoped imports are not yet supported in textual module interfaces",
WARNING(parseable_interface_scoped_import_unsupported,none,
"scoped imports are not yet supported in parseable module interfaces",
())

#ifndef DIAG_NO_UNDEF
Expand Down
6 changes: 3 additions & 3 deletions include/swift/AST/PrintOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,13 @@ struct PrintOptions {
return result;
}

/// Retrieve the set of options suitable for stable textual interfaces.
/// Retrieve the set of options suitable for parseable module interfaces.
///
/// This is a format that will be parsed again later, so the output must be
/// consistent and well-formed.
///
/// \see swift::emitModuleInterface
static PrintOptions printTextualInterfaceFile();
/// \see swift::emitParseableInterface
static PrintOptions printParseableInterfaceFile();

static PrintOptions printModuleInterface();
static PrintOptions printTypeInterface(Type T);
Expand Down
10 changes: 5 additions & 5 deletions include/swift/Basic/SupplementaryOutputPaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ struct SupplementaryOutputPaths {
/// \sa swift::writeTBDFile
std::string TBDPath;

/// The path to which we should emit a textual module interface, which can be
/// used by a client source file to import this module.
/// The path to which we should emit a parseable 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,
/// but is intended to be stable across compiler versions.
///
/// Currently only makes sense when the compiler has whole-module knowledge.
///
/// \sa swift::emitModuleInterface
std::string ModuleInterfaceOutputPath;
/// \sa swift::emitParseableInterface
std::string ParseableInterfaceOutputPath;

SupplementaryOutputPaths() = default;
SupplementaryOutputPaths(const SupplementaryOutputPaths &) = default;
Expand All @@ -132,7 +132,7 @@ struct SupplementaryOutputPaths {
ModuleDocOutputPath.empty() && DependenciesFilePath.empty() &&
ReferenceDependenciesFilePath.empty() &&
SerializedDiagnosticsPath.empty() && LoadedModuleTracePath.empty() &&
TBDPath.empty() && ModuleInterfaceOutputPath.empty();
TBDPath.empty() && ParseableInterfaceOutputPath.empty();
}
};
} // namespace swift
Expand Down
8 changes: 4 additions & 4 deletions include/swift/Driver/Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ class Driver {
StringRef workingDirectory,
CommandOutput *Output) const;

void chooseTextualInterfacePath(Compilation &C, const JobAction *JA,
StringRef workingDirectory,
llvm::SmallString<128> &buffer,
CommandOutput *output) const;
void chooseParseableInterfacePath(Compilation &C, const JobAction *JA,
StringRef workingDirectory,
llvm::SmallString<128> &buffer,
CommandOutput *output) const;

void chooseRemappingOutputPath(Compilation &C, const TypeToPathMap *OutputMap,
CommandOutput *Output) const;
Expand Down
8 changes: 4 additions & 4 deletions include/swift/Frontend/Frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ class CompilerInvocation {
/// if not in that mode.
std::string getTBDPathForWholeModule() const;

/// 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 getModuleInterfaceOutputPathForWholeModule() const;
/// ParseableInterfaceOutputPath only makes sense in whole module compilation
/// mode, so return the ParseableInterfaceOutputPath when in that mode and
/// fail an assert if not in that mode.
std::string getParseableInterfaceOutputPathForWholeModule() const;
};

/// A class which manages the state and execution of the compiler.
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Frontend/FrontendInputsAndOutputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class FrontendInputsAndOutputs {
bool hasLoadedModuleTracePath() const;
bool hasModuleOutputPath() const;
bool hasModuleDocOutputPath() const;
bool hasModuleInterfaceOutputPath() const;
bool hasParseableInterfaceOutputPath() const;
bool hasTBDPath() const;

bool hasDependencyTrackerPath() const;
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def emit_fixits_path

def emit_interface_path
: Separate<["-"], "emit-interface-path">, MetaVarName<"<path>">,
HelpText<"Output textual interface file to <path>">;
HelpText<"Output parseable interface file to <path>">;

def tbd_install_name
: Separate<["-"], "tbd-install_name">, MetaVarName<"<path>">,
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def emit_module_path_EQ : Joined<["-"], "emit-module-path=">,

def experimental_emit_interface : Flag<["-"], "experimental-emit-interface">,
Flags<[NoInteractiveOption, HelpHidden]>,
HelpText<"Test out the textual interfaces feature">;
HelpText<"Test out the parseable interfaces feature">;

def emit_objc_header : Flag<["-"], "emit-objc-header">,
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
Expand Down
6 changes: 3 additions & 3 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static bool contributesToParentTypeStorage(const AbstractStorageDecl *ASD) {
return !ND->isResilient() && ASD->hasStorage() && !ASD->isStatic();
}

PrintOptions PrintOptions::printTextualInterfaceFile() {
PrintOptions PrintOptions::printParseableInterfaceFile() {
PrintOptions result;
result.PrintLongAttrsOnSeparateLines = true;
result.TypeDefinitions = true;
Expand All @@ -100,7 +100,7 @@ PrintOptions PrintOptions::printTextualInterfaceFile() {
printer << " " << AFD->getInlinableBodyText(scratch);
};

class ShouldPrintForTextualInterface : public ShouldPrintChecker {
class ShouldPrintForParseableInterface : public ShouldPrintChecker {
bool shouldPrint(const Decl *D, const PrintOptions &options) override {
// Skip anything that isn't 'public' or '@usableFromInline'.
if (auto *VD = dyn_cast<ValueDecl>(D)) {
Expand Down Expand Up @@ -143,7 +143,7 @@ PrintOptions PrintOptions::printTextualInterfaceFile() {
}
};
result.CurrentPrintabilityChecker =
std::make_shared<ShouldPrintForTextualInterface>();
std::make_shared<ShouldPrintForParseableInterface>();

// FIXME: We don't really need 'public' on everything; we could just change
// the default to 'public' and mark the 'internal' things.
Expand Down
4 changes: 2 additions & 2 deletions lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2474,7 +2474,7 @@ Job *Driver::buildJobsForAction(Compilation &C, const JobAction *JA,
Output.get());

if (C.getArgs().hasArg(options::OPT_experimental_emit_interface))
chooseTextualInterfacePath(C, JA, workingDirectory, Buf, Output.get());
chooseParseableInterfacePath(C, JA, workingDirectory, Buf, Output.get());

if (C.getArgs().hasArg(options::OPT_update_code) && isa<CompileJobAction>(JA))
chooseRemappingOutputPath(C, OutputMap, Output.get());
Expand Down Expand Up @@ -2772,7 +2772,7 @@ void Driver::chooseRemappingOutputPath(Compilation &C,
}
}

void Driver::chooseTextualInterfacePath(Compilation &C, const JobAction *JA,
void Driver::chooseParseableInterfacePath(Compilation &C, const JobAction *JA,
StringRef workingDirectory,
llvm::SmallString<128> &buffer,
CommandOutput *output) const {
Expand Down
2 changes: 1 addition & 1 deletion lib/Frontend/ArgsToFrontendOptionsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ bool ArgsToFrontendOptionsConverter::checkUnusedSupplementaryOutputPaths()
return true;
}
if (!FrontendOptions::canActionEmitInterface(Opts.RequestedAction) &&
Opts.InputsAndOutputs.hasModuleInterfaceOutputPath()) {
Opts.InputsAndOutputs.hasParseableInterfaceOutputPath()) {
Diags.diagnose(SourceLoc(), diag::error_mode_cannot_emit_interface);
return true;
}
Expand Down
14 changes: 8 additions & 6 deletions lib/Frontend/ArgsToFrontendOutputsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 moduleInterfaceOutput = getSupplementaryFilenamesFromArguments(
auto parseableInterfaceOutput = getSupplementaryFilenamesFromArguments(
options::OPT_emit_interface_path);

if (!objCHeaderOutput || !moduleOutput || !moduleDocOutput ||
!dependenciesFile || !referenceDependenciesFile ||
!serializedDiagnostics || !fixItsOutput || !loadedModuleTrace || !TBD ||
!moduleInterfaceOutput) {
!parseableInterfaceOutput) {
return None;
}
std::vector<SupplementaryOutputPaths> result;
Expand All @@ -318,7 +318,7 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
sop.FixItsOutputPath = (*fixItsOutput)[i];
sop.LoadedModuleTracePath = (*loadedModuleTrace)[i];
sop.TBDPath = (*TBD)[i];
sop.ModuleInterfaceOutputPath = (*moduleInterfaceOutput)[i];
sop.ParseableInterfaceOutputPath = (*parseableInterfaceOutput)[i];

result.push_back(sop);
}
Expand Down Expand Up @@ -395,7 +395,8 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
defaultSupplementaryOutputPathExcludingExtension);

// There is no non-path form of -emit-interface-path
auto moduleInterfaceOutputPath = pathsFromArguments.ModuleInterfaceOutputPath;
auto parseableInterfaceOutputPath =
pathsFromArguments.ParseableInterfaceOutputPath;

ID emitModuleOption;
std::string moduleExtension;
Expand All @@ -418,7 +419,7 @@ SupplementaryOutputPathsComputer::computeOutputPathsForOneInput(
sop.FixItsOutputPath = fixItsOutputPath;
sop.LoadedModuleTracePath = loadedModuleTracePath;
sop.TBDPath = tbdPath;
sop.ModuleInterfaceOutputPath = moduleInterfaceOutputPath;
sop.ParseableInterfaceOutputPath = parseableInterfaceOutputPath;
return sop;
}

Expand Down Expand Up @@ -493,7 +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_SwiftModuleInterfaceFile,paths.ModuleInterfaceOutputPath}
{file_types::TY_SwiftModuleInterfaceFile,
paths.ParseableInterfaceOutputPath}
};
for (const std::pair<file_types::ID, std::string &> &typeAndString :
typesAndStrings) {
Expand Down
8 changes: 4 additions & 4 deletions lib/Frontend/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ std::string CompilerInvocation::getTBDPathForWholeModule() const {
}

std::string
CompilerInvocation::getModuleInterfaceOutputPathForWholeModule() const {
CompilerInvocation::getParseableInterfaceOutputPathForWholeModule() const {
assert(getFrontendOptions().InputsAndOutputs.isWholeModule() &&
"ModuleInterfaceOutputPath only makes sense when the whole module can "
"be seen");
"ParseableInterfaceOutputPath only makes sense when the whole module "
"can be seen");
return getPrimarySpecificPathsForAtMostOnePrimary()
.SupplementaryOutputs.ModuleInterfaceOutputPath;
.SupplementaryOutputs.ParseableInterfaceOutputPath;
}

void CompilerInstance::createSILModule() {
Expand Down
4 changes: 2 additions & 2 deletions lib/Frontend/FrontendInputsAndOutputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ bool FrontendInputsAndOutputs::hasModuleDocOutputPath() const {
return outs.ModuleDocOutputPath;
});
}
bool FrontendInputsAndOutputs::hasModuleInterfaceOutputPath() const {
bool FrontendInputsAndOutputs::hasParseableInterfaceOutputPath() const {
return hasSupplementaryOutputPath(
[](const SupplementaryOutputPaths &outs) -> const std::string & {
return outs.ModuleInterfaceOutputPath;
return outs.ParseableInterfaceOutputPath;
});
}
bool FrontendInputsAndOutputs::hasTBDPath() const {
Expand Down
2 changes: 1 addition & 1 deletion lib/Frontend/FrontendOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void FrontendOptions::forAllOutputPaths(
input.getPrimarySpecificPaths().SupplementaryOutputs;
const std::string *outputs[] = {&outs.ModuleOutputPath,
&outs.ModuleDocOutputPath,
&outs.ModuleInterfaceOutputPath,
&outs.ParseableInterfaceOutputPath,
&outs.ObjCHeaderOutputPath};
for (const std::string *next : outputs) {
if (!next->empty())
Expand Down
2 changes: 1 addition & 1 deletion lib/FrontendTool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_swift_library(swiftFrontendTool STATIC
ImportedModules.cpp
ReferenceDependencies.cpp
TBD.cpp
TextualInterfaceGeneration.cpp
ParseableInterfaceGeneration.cpp
DEPENDS
swift-syntax-generated-headers SwiftOptions
LINK_LIBRARIES
Expand Down
17 changes: 9 additions & 8 deletions lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "ImportedModules.h"
#include "ReferenceDependencies.h"
#include "TBD.h"
#include "TextualInterfaceGeneration.h"
#include "ParseableInterfaceGeneration.h"

#include "swift/Subsystems.h"
#include "swift/AST/ASTScope.h"
Expand Down Expand Up @@ -356,19 +356,20 @@ static bool printAsObjCIfNeeded(StringRef outputPath, ModuleDecl *M,
});
}

/// Prints the stable textual interface for \p M to \p outputPath.
/// Prints the stable parseable 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::emitModuleInterface
static bool printModuleInterfaceIfNeeded(StringRef outputPath, ModuleDecl *M) {
/// \see swift::emitParseableInterface
static bool printParseableInterfaceIfNeeded(StringRef outputPath,
ModuleDecl *M) {
if (outputPath.empty())
return false;
return atomicallyWritingToTextFile(outputPath, M->getDiags(),
[M](raw_ostream &out) -> bool {
return swift::emitModuleInterface(out, M);
return swift::emitParseableInterface(out, M);
});
}

Expand Down Expand Up @@ -888,9 +889,9 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs(
Instance.getMainModule(), opts.ImplicitObjCHeaderPath, moduleIsPublic);
}

if (opts.InputsAndOutputs.hasModuleInterfaceOutputPath()) {
hadAnyError |= printModuleInterfaceIfNeeded(
Invocation.getModuleInterfaceOutputPathForWholeModule(),
if (opts.InputsAndOutputs.hasParseableInterfaceOutputPath()) {
hadAnyError |= printParseableInterfaceIfNeeded(
Invocation.getParseableInterfaceOutputPathForWholeModule(),
Instance.getMainModule());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//===--- TextualInterfaceGeneration.cpp - swiftinterface files ------------===//
//===--- ParseableInterfaceGeneration.cpp - swiftinterface files ----------===//
//
// This source file is part of the Swift.org open source project
//
Expand All @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//

#include "TextualInterfaceGeneration.h"
#include "ParseableInterfaceGeneration.h"

#include "swift/AST/ASTContext.h"
#include "swift/AST/Decl.h"
Expand All @@ -21,7 +21,7 @@
using namespace swift;

/// Diagnose any scoped imports in \p imports, i.e. those with a non-empty
/// access path. These are not yet supported by textual interfaces, since the
/// access path. These are not yet supported by parseable 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.
Expand All @@ -33,7 +33,7 @@ static void diagnoseScopedImports(DiagnosticEngine &diags,
if (importPair.first.empty())
continue;
diags.diagnose(importPair.first.front().second,
diag::textual_interface_scoped_import_unsupported);
diag::parseable_interface_scoped_import_unsupported);
}
}

Expand Down Expand Up @@ -80,12 +80,12 @@ static void printImports(raw_ostream &out, ModuleDecl *M) {
}
}

bool swift::emitModuleInterface(raw_ostream &out, ModuleDecl *M) {
bool swift::emitParseableInterface(raw_ostream &out, ModuleDecl *M) {
assert(M);

printImports(out, M);

const PrintOptions printOptions = PrintOptions::printTextualInterfaceFile();
const PrintOptions printOptions = PrintOptions::printParseableInterfaceFile();
SmallVector<Decl *, 16> topLevelDecls;
M->getTopLevelDecls(topLevelDecls);
for (const Decl *D : topLevelDecls) {
Expand Down
Loading