Skip to content

Commit ab4ecc3

Browse files
committed
Allow empty lists of files when looking up files containing a source location
1 parent 721d52f commit ab4ecc3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/AST/Module.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,8 @@ void ModuleDecl::updateSourceFileLocationMap() {
573573
}
574574

575575
// If we are up-to-date, there's nothing to do.
576-
if (sourceFileLocationMap->numFiles == getFiles().size() &&
576+
ArrayRef<FileUnit *> files = Files;
577+
if (sourceFileLocationMap->numFiles == files.size() &&
577578
sourceFileLocationMap->numAuxiliaryFiles ==
578579
AuxiliaryFiles.size())
579580
return;
@@ -582,7 +583,7 @@ void ModuleDecl::updateSourceFileLocationMap() {
582583
sourceFileLocationMap->allSourceFiles.clear();
583584

584585
// First, add all of the source files with a backing buffer.
585-
for (auto *fileUnit : getFiles()) {
586+
for (auto *fileUnit : files) {
586587
if (auto sourceFile = dyn_cast<SourceFile>(fileUnit)) {
587588
if (sourceFile->getBufferID())
588589
sourceFileLocationMap->allSourceFiles.push_back(sourceFile);

0 commit comments

Comments
 (0)