[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.
This commit is contained in:
Steven Wu
2024-08-06 12:18:28 -07:00
parent 245fd5b7e8
commit 3b332bf125

View File

@@ -35,6 +35,7 @@
#include "clang/Index/IndexingAction.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Serialization/ASTReader.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Path.h"
using namespace swift;
@@ -636,8 +637,11 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
}
auto F = fileMgr.getFileRef(modulePath);
if (!F)
if (!F) {
// Ignore error and continue.
llvm::consumeError(F.takeError());
break;
}
// Use module real name for unit writer in case module aliasing
// is used. For example, if a file being indexed has `import Foo`