Skip to content

Commit 2282065

Browse files
committed
Rename "Name Binding" action to "Resolve Imports"
1 parent cb1e9dd commit 2282065

File tree

10 files changed

+25
-24
lines changed

10 files changed

+25
-24
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ class CompilerInstance {
545545
///
546546
/// Like a parse-only invocation, a single file is required. Unlike a
547547
/// parse-only invocation, module imports will be processed.
548-
void performParseAndNameBindingOnly();
548+
void performParseAndResolveImportsOnly();
549549

550550
private:
551551
SourceFile *

include/swift/Frontend/FrontendOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class FrontendOptions {
105105
enum class ActionType {
106106
NoneAction, ///< No specific action
107107
Parse, ///< Parse only
108-
NameBind, ///< Parse and perform name-binding only
108+
ResolveImports, ///< Parse and resolve imports only
109109
Typecheck, ///< Parse and type-check only
110110
DumpParse, ///< Parse only and dump AST
111111
DumpInterfaceHash, ///< Parse and dump the interface token hash.

include/swift/Option/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@ def fixit_all : Flag<["-"], "fixit-all">,
637637
def parse: Flag<["-"], "parse">,
638638
HelpText<"Parse input file(s)">, ModeOpt,
639639
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
640-
def namebind : Flag<["-"], "name-bind">,
641-
HelpText<"Parse and perform name binding on input file(s)">, ModeOpt,
640+
def resolve_imports : Flag<["-"], "resolve-imports">,
641+
HelpText<"Parse and resolve imports in input file(s)">, ModeOpt,
642642
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
643643
def typecheck : Flag<["-"], "typecheck">,
644644
HelpText<"Parse and type-check input file(s)">, ModeOpt,

lib/Driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
13701370
OI.LinkAction = LinkKind::None;
13711371
break;
13721372
case options::OPT_parse:
1373-
case options::OPT_namebind:
1373+
case options::OPT_resolve_imports:
13741374
case options::OPT_typecheck:
13751375
case options::OPT_dump_parse:
13761376
case options::OPT_dump_ast:

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ ArgsToFrontendOptionsConverter::determineRequestedAction(const ArgList &args) {
322322
return FrontendOptions::ActionType::EmitImportedModules;
323323
if (Opt.matches(OPT_parse))
324324
return FrontendOptions::ActionType::Parse;
325-
if (Opt.matches(OPT_namebind))
326-
return FrontendOptions::ActionType::NameBind;
325+
if (Opt.matches(OPT_resolve_imports))
326+
return FrontendOptions::ActionType::ResolveImports;
327327
if (Opt.matches(OPT_typecheck))
328328
return FrontendOptions::ActionType::Typecheck;
329329
if (Opt.matches(OPT_dump_parse))

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ shouldImplicityImportSwiftOnoneSupportModule(CompilerInvocation &Invocation) {
425425
return Invocation.getFrontendOptions().isCreatingSIL();
426426
}
427427

428-
void CompilerInstance::performParseAndNameBindingOnly() {
428+
void CompilerInstance::performParseAndResolveImportsOnly() {
429429
performSemaUpTo(SourceFile::NameBound);
430430
}
431431

@@ -474,7 +474,6 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
474474
parseAndCheckTypesUpTo(implicitImports, LimitStage);
475475
}
476476

477-
478477
CompilerInstance::ImplicitImports::ImplicitImports(CompilerInstance &compiler) {
479478
kind = compiler.Invocation.getImplicitModuleImportKind();
480479

lib/Frontend/FrontendOptions.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bool FrontendOptions::needsProperModuleName(ActionType action) {
3131
switch (action) {
3232
case ActionType::NoneAction:
3333
case ActionType::Parse:
34-
case ActionType::NameBind:
34+
case ActionType::ResolveImports:
3535
case ActionType::Typecheck:
3636
case ActionType::DumpParse:
3737
case ActionType::DumpAST:
@@ -66,7 +66,7 @@ bool FrontendOptions::isActionImmediate(ActionType action) {
6666
switch (action) {
6767
case ActionType::NoneAction:
6868
case ActionType::Parse:
69-
case ActionType::NameBind:
69+
case ActionType::ResolveImports:
7070
case ActionType::Typecheck:
7171
case ActionType::DumpParse:
7272
case ActionType::DumpAST:
@@ -136,7 +136,7 @@ FrontendOptions::suffixForPrincipalOutputFileForAction(ActionType action) {
136136
return StringRef();
137137

138138
case ActionType::Parse:
139-
case ActionType::NameBind:
139+
case ActionType::ResolveImports:
140140
case ActionType::Typecheck:
141141
case ActionType::DumpParse:
142142
case ActionType::DumpInterfaceHash:
@@ -198,7 +198,7 @@ bool FrontendOptions::canActionEmitDependencies(ActionType action) {
198198
case ActionType::Immediate:
199199
case ActionType::REPL:
200200
return false;
201-
case ActionType::NameBind:
201+
case ActionType::ResolveImports:
202202
case ActionType::Typecheck:
203203
case ActionType::MergeModules:
204204
case ActionType::EmitModuleOnly:
@@ -220,7 +220,7 @@ bool FrontendOptions::canActionEmitReferenceDependencies(ActionType action) {
220220
switch (action) {
221221
case ActionType::NoneAction:
222222
case ActionType::Parse:
223-
case ActionType::NameBind:
223+
case ActionType::ResolveImports:
224224
case ActionType::DumpParse:
225225
case ActionType::DumpInterfaceHash:
226226
case ActionType::DumpAST:
@@ -263,7 +263,7 @@ bool FrontendOptions::canActionEmitObjCHeader(ActionType action) {
263263
case ActionType::REPL:
264264
return false;
265265
case ActionType::Parse:
266-
case ActionType::NameBind:
266+
case ActionType::ResolveImports:
267267
case ActionType::Typecheck:
268268
case ActionType::MergeModules:
269269
case ActionType::EmitModuleOnly:
@@ -294,7 +294,7 @@ bool FrontendOptions::canActionEmitLoadedModuleTrace(ActionType action) {
294294
case ActionType::Immediate:
295295
case ActionType::REPL:
296296
return false;
297-
case ActionType::NameBind:
297+
case ActionType::ResolveImports:
298298
case ActionType::Typecheck:
299299
case ActionType::MergeModules:
300300
case ActionType::EmitModuleOnly:
@@ -316,7 +316,7 @@ bool FrontendOptions::canActionEmitModule(ActionType action) {
316316
switch (action) {
317317
case ActionType::NoneAction:
318318
case ActionType::Parse:
319-
case ActionType::NameBind:
319+
case ActionType::ResolveImports:
320320
case ActionType::Typecheck:
321321
case ActionType::DumpParse:
322322
case ActionType::DumpInterfaceHash:
@@ -351,7 +351,7 @@ bool FrontendOptions::canActionEmitModuleDoc(ActionType action) {
351351
bool FrontendOptions::doesActionProduceOutput(ActionType action) {
352352
switch (action) {
353353
case ActionType::Parse:
354-
case ActionType::NameBind:
354+
case ActionType::ResolveImports:
355355
case ActionType::Typecheck:
356356
case ActionType::DumpParse:
357357
case ActionType::DumpAST:
@@ -397,7 +397,7 @@ bool FrontendOptions::doesActionProduceTextualOutput(ActionType action) {
397397
return false;
398398

399399
case ActionType::Parse:
400-
case ActionType::NameBind:
400+
case ActionType::ResolveImports:
401401
case ActionType::Typecheck:
402402
case ActionType::DumpParse:
403403
case ActionType::DumpInterfaceHash:

lib/FrontendTool/FrontendTool.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,8 @@ static bool performCompile(CompilerInstance &Instance,
898898
if (FrontendOptions::shouldActionOnlyParse(Action)) {
899899
Instance.performParseOnly(/*EvaluateConditionals*/
900900
Action == FrontendOptions::ActionType::EmitImportedModules);
901-
} else if (Action == FrontendOptions::ActionType::NameBind) {
902-
Instance.performParseAndNameBindingOnly();
901+
} else if (Action == FrontendOptions::ActionType::ResolveImports) {
902+
Instance.performParseAndResolveImportsOnly();
903903
} else {
904904
Instance.performSema();
905905
}
@@ -922,7 +922,7 @@ static bool performCompile(CompilerInstance &Instance,
922922
(void)emitMakeDependenciesIfNeeded(Context.Diags,
923923
Instance.getDependencyTracker(), opts);
924924

925-
if (Action == FrontendOptions::ActionType::NameBind)
925+
if (Action == FrontendOptions::ActionType::ResolveImports)
926926
return Context.hadError();
927927

928928
if (observer)

test/Driver/options.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
// PARSE_NO_REFERENCE_DEPS: error: this mode does not support emitting reference dependency files{{$}}
3737
// RUN: not %target-swift-frontend -dump-ast -emit-reference-dependencies %s 2>&1 | %FileCheck -check-prefix=DUMP_NO_REFERENCE_DEPS %s
3838
// DUMP_NO_REFERENCE_DEPS: error: this mode does not support emitting reference dependency files{{$}}
39+
// RUN: not %target-swift-frontend -resolve-imports -emit-reference-dependencies %s 2>&1 | %FileCheck -check-prefix=RESOLVE_IMPORTS_NO_REFERENCE_DEPS %s
40+
// RESOLVE_IMPORTS_NO_REFERENCE_DEPS: error: this mode does not support emitting reference dependency files{{$}}
3941

4042
// Should not fail with non-zero exit code.
4143
// RUN: %target-swift-frontend -emit-silgen %S/Inputs/invalid-module-name.swift > /dev/null

test/Frontend/dependencies.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// RUN: %empty-directory(%t)
44

5-
// RUN: %target-swift-frontend -emit-dependencies-path - -name-bind %S/../Inputs/empty\ file.swift | %FileCheck -check-prefix=CHECK-BASIC %s
5+
// RUN: %target-swift-frontend -emit-dependencies-path - -resolve-imports %S/../Inputs/empty\ file.swift | %FileCheck -check-prefix=CHECK-BASIC %s
66
// RUN: %target-swift-frontend -emit-reference-dependencies-path - -typecheck -primary-file %S/../Inputs/empty\ file.swift | %FileCheck -check-prefix=CHECK-BASIC-YAML %s
77

88
// RUN: %target-swift-frontend -emit-dependencies-path %t.d -emit-reference-dependencies-path %t.swiftdeps -typecheck -primary-file %S/../Inputs/empty\ file.swift
@@ -38,7 +38,7 @@
3838
// CHECK-MULTIPLE-OUTPUTS: Swift.swiftmodule
3939
// CHECK-MULTIPLE-OUTPUTS-NOT: :
4040

41-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -name-bind %s | %FileCheck -check-prefix=CHECK-IMPORT %s
41+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-dependencies-path - -resolve-imports %s | %FileCheck -check-prefix=CHECK-IMPORT %s
4242
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -import-objc-header %S/Inputs/dependencies/extra-header.h -emit-reference-dependencies-path - -typecheck -primary-file %s | %FileCheck -check-prefix=CHECK-IMPORT-YAML %s
4343

4444
// CHECK-IMPORT-LABEL: - :

0 commit comments

Comments
 (0)