Skip to content

Commit 44a8b56

Browse files
committed
Rename getFiles to getFilesToEmit
Rename the member on ASTLoweringDescriptor and IRGenDescriptor to make it more explicit it returns the files that need emitting, rather than just the files that happen to be present. This distinction will become important once we start emitting code only for a specific set of symbols.
1 parent add2219 commit 44a8b56

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

include/swift/AST/IRGenRequests.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ struct IRGenDescriptor {
199199
}
200200

201201
/// Retrieves the files to perform IR generation for.
202-
TinyPtrVector<FileUnit *> getFiles() const;
202+
TinyPtrVector<FileUnit *> getFilesToEmit() const;
203203

204204
/// For a single file, returns its parent module, otherwise returns the module
205205
/// itself.

include/swift/AST/SILGenRequests.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ struct ASTLoweringDescriptor {
7575
return ASTLoweringDescriptor{mod, conv, opts};
7676
}
7777

78-
/// For a single file input, returns a single element array containing that
79-
/// file. Otherwise returns an array of each file in the module.
80-
ArrayRef<FileUnit *> getFiles() const;
78+
/// Retrieves the files to generate SIL for. If the descriptor is configured
79+
/// only to emit a specific set of SILDeclRefs, this will be empty.
80+
ArrayRef<FileUnit *> getFilesToEmit() const;
8181

8282
/// If the module or file contains SIL that needs parsing, returns the file
8383
/// to be parsed, or \c nullptr if parsing isn't required.

lib/IRGen/IRGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ GeneratedModule IRGenRequest::evaluate(Evaluator &evaluator,
930930
return GeneratedModule::null();
931931
}
932932

933-
auto filesToEmit = desc.getFiles();
933+
auto filesToEmit = desc.getFilesToEmit();
934934
auto *primaryFile =
935935
dyn_cast_or_null<SourceFile>(desc.Ctx.dyn_cast<FileUnit *>());
936936

lib/IRGen/IRGenRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SourceLoc swift::extractNearestSourceLoc(const IRGenDescriptor &desc) {
5252
return SourceLoc();
5353
}
5454

55-
TinyPtrVector<FileUnit *> IRGenDescriptor::getFiles() const {
55+
TinyPtrVector<FileUnit *> IRGenDescriptor::getFilesToEmit() const {
5656
// For a whole module, we emit IR for all files.
5757
if (auto *mod = Ctx.dyn_cast<ModuleDecl *>())
5858
return TinyPtrVector<FileUnit *>(mod->getFiles());

lib/SILGen/SILGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,14 +1947,14 @@ ASTLoweringRequest::evaluate(Evaluator &evaluator,
19471947
desc.opts);
19481948
SILGenModuleRAII scope(*silMod);
19491949

1950-
for (auto file : desc.getFiles()) {
1950+
for (auto file : desc.getFilesToEmit()) {
19511951
if (auto *nextSF = dyn_cast<SourceFile>(file))
19521952
scope.emitSourceFile(nextSF);
19531953
}
19541954

19551955
// Also make sure to process any intermediate files that may contain SIL.
19561956
bool shouldDeserialize =
1957-
llvm::any_of(desc.getFiles(), [](const FileUnit *File) -> bool {
1957+
llvm::any_of(desc.getFilesToEmit(), [](const FileUnit *File) -> bool {
19581958
return isa<SerializedASTFile>(File);
19591959
});
19601960
if (shouldDeserialize) {

lib/SILGen/SILGenRequests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ evaluator::DependencySource ASTLoweringRequest::readDependencySource(
6060
return {dyn_cast<SourceFile>(unit), evaluator::DependencyScope::Cascading};
6161
}
6262

63-
ArrayRef<FileUnit *> ASTLoweringDescriptor::getFiles() const {
63+
ArrayRef<FileUnit *> ASTLoweringDescriptor::getFilesToEmit() const {
6464
if (auto *mod = context.dyn_cast<ModuleDecl *>())
6565
return mod->getFiles();
6666

@@ -71,18 +71,18 @@ ArrayRef<FileUnit *> ASTLoweringDescriptor::getFiles() const {
7171

7272
SourceFile *ASTLoweringDescriptor::getSourceFileToParse() const {
7373
#ifndef NDEBUG
74-
auto sfCount = llvm::count_if(getFiles(), [](FileUnit *file) {
74+
auto sfCount = llvm::count_if(getFilesToEmit(), [](FileUnit *file) {
7575
return isa<SourceFile>(file);
7676
});
77-
auto silFileCount = llvm::count_if(getFiles(), [](FileUnit *file) {
77+
auto silFileCount = llvm::count_if(getFilesToEmit(), [](FileUnit *file) {
7878
auto *SF = dyn_cast<SourceFile>(file);
7979
return SF && SF->Kind == SourceFileKind::SIL;
8080
});
8181
assert(silFileCount == 0 || (silFileCount == 1 && sfCount == 1) &&
8282
"Cannot currently mix a .sil file with other SourceFiles");
8383
#endif
8484

85-
for (auto *file : getFiles()) {
85+
for (auto *file : getFilesToEmit()) {
8686
// Skip other kinds of files.
8787
auto *SF = dyn_cast<SourceFile>(file);
8888
if (!SF)

0 commit comments

Comments
 (0)