Skip to content

Commit 3b332bf

Browse files
[IndexRecord] Fix an handled error in IndexRecord
Fix an unhandled error when querying file system. Just properly ignore and continue if the file can't be read.
1 parent 245fd5b commit 3b332bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Index/IndexRecord.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "clang/Index/IndexingAction.h"
3636
#include "clang/Lex/Preprocessor.h"
3737
#include "clang/Serialization/ASTReader.h"
38+
#include "llvm/Support/Error.h"
3839
#include "llvm/Support/Path.h"
3940

4041
using namespace swift;
@@ -636,8 +637,11 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
636637
}
637638

638639
auto F = fileMgr.getFileRef(modulePath);
639-
if (!F)
640+
if (!F) {
641+
// Ignore error and continue.
642+
llvm::consumeError(F.takeError());
640643
break;
644+
}
641645

642646
// Use module real name for unit writer in case module aliasing
643647
// is used. For example, if a file being indexed has `import Foo`

0 commit comments

Comments
 (0)