[clang] Adopt new FileManager error-returning APIs
Update the callers of FileManager::getFile and FileManager::getDirectory to handle the new llvm::ErrorOr-returning methods.
Signed-off-by: Harlan Haskins <harlan@apple.com>
llvm-svn: 367616
diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 2db8f83..1833ebb 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -657,7 +657,7 @@
Idx += Length;
// Find the imported module file.
- const FileEntry *DependsOnFile
+ auto DependsOnFile
= FileMgr.getFile(ImportedFile, /*OpenFile=*/false,
/*CacheFailure=*/false);
@@ -669,11 +669,11 @@
// Save the information in ImportedModuleFileInfo so we can verify after
// loading all pcms.
ImportedModuleFiles.insert(std::make_pair(
- DependsOnFile, ImportedModuleFileInfo(StoredSize, StoredModTime,
- StoredSignature)));
+ *DependsOnFile, ImportedModuleFileInfo(StoredSize, StoredModTime,
+ StoredSignature)));
// Record the dependency.
- unsigned DependsOnID = getModuleFileInfo(DependsOnFile).ID;
+ unsigned DependsOnID = getModuleFileInfo(*DependsOnFile).ID;
getModuleFileInfo(File).Dependencies.push_back(DependsOnID);
}
@@ -894,12 +894,12 @@
}
// If we can't find the module file, skip it.
- const FileEntry *ModuleFile = FileMgr.getFile(D->path());
+ auto ModuleFile = FileMgr.getFile(D->path());
if (!ModuleFile)
continue;
// Load this module file.
- if (llvm::Error Err = Builder.loadModuleFile(ModuleFile))
+ if (llvm::Error Err = Builder.loadModuleFile(*ModuleFile))
return Err;
}