[NFC] Cleanup deprecated Optional API usage in depscan

This commit is contained in:
Steven Wu
2023-06-23 14:12:16 -07:00
parent b78b569450
commit 284eb2a264
3 changed files with 7 additions and 7 deletions

View File

@@ -622,8 +622,8 @@ Optional<const ModuleDependencyInfo *> ModuleDependenciesCache::findDependency(
scannerContextHash);
// During a scan, only produce the cached source module info for the current
// module under scan.
if (optionalDep.hasValue()) {
auto dep = optionalDep.getValue();
if (optionalDep) {
auto dep = *optionalDep;
if (dep->getAsSwiftSourceModule() &&
moduleName != mainScanModuleName &&
moduleName != "DummyMainModuleForResolvingCrossImportOverlays") {

View File

@@ -408,12 +408,12 @@ Optional<const ModuleDependencyInfo*> ClangImporter::getModuleDependencies(
std::vector<std::string> commandLineArgs =
getClangDepScanningInvocationArguments(ctx);
auto optionalWorkingDir = computeClangWorkingDirectory(commandLineArgs, ctx);
if (!optionalWorkingDir.hasValue()) {
if (!optionalWorkingDir) {
ctx.Diags.diagnose(SourceLoc(), diag::clang_dependency_scan_error,
"Missing '-working-directory' argument");
return None;
}
std::string workingDir = optionalWorkingDir.getValue();
std::string workingDir = *optionalWorkingDir;
auto moduleCachePath = getModuleCachePathFromClang(getClangInstance());
auto lookupModuleOutput =
@@ -473,12 +473,12 @@ bool ClangImporter::addBridgingHeaderDependencies(
std::vector<std::string> commandLineArgs =
getClangDepScanningInvocationArguments(ctx, StringRef(bridgingHeader));
auto optionalWorkingDir = computeClangWorkingDirectory(commandLineArgs, ctx);
if (!optionalWorkingDir.hasValue()) {
if (!optionalWorkingDir) {
ctx.Diags.diagnose(SourceLoc(), diag::clang_dependency_scan_error,
"Missing '-working-directory' argument");
return true;
}
std::string workingDir = optionalWorkingDir.getValue();
std::string workingDir = *optionalWorkingDir;
auto moduleCachePath = getModuleCachePathFromClang(getClangInstance());
auto lookupModuleOutput =

View File

@@ -1182,7 +1182,7 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
// First check to see if the .swiftinterface exists at all. Bail if not.
auto &fs = *Ctx.SourceMgr.getFileSystem();
std::string InPath = BaseName.findInterfacePath(fs).getValueOr("");
std::string InPath = BaseName.findInterfacePath(fs).value_or("");
if (InPath.empty()) {
if (fs.exists(ModPath)) {
LLVM_DEBUG(llvm::dbgs()