Skip to content

Commit 284eb2a

Browse files
[NFC] Cleanup deprecated Optional API usage in depscan
1 parent b78b569 commit 284eb2a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/AST/ModuleDependencies.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,8 @@ Optional<const ModuleDependencyInfo *> ModuleDependenciesCache::findDependency(
622622
scannerContextHash);
623623
// During a scan, only produce the cached source module info for the current
624624
// module under scan.
625-
if (optionalDep.hasValue()) {
626-
auto dep = optionalDep.getValue();
625+
if (optionalDep) {
626+
auto dep = *optionalDep;
627627
if (dep->getAsSwiftSourceModule() &&
628628
moduleName != mainScanModuleName &&
629629
moduleName != "DummyMainModuleForResolvingCrossImportOverlays") {

lib/ClangImporter/ClangModuleDependencyScanner.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,12 @@ Optional<const ModuleDependencyInfo*> ClangImporter::getModuleDependencies(
408408
std::vector<std::string> commandLineArgs =
409409
getClangDepScanningInvocationArguments(ctx);
410410
auto optionalWorkingDir = computeClangWorkingDirectory(commandLineArgs, ctx);
411-
if (!optionalWorkingDir.hasValue()) {
411+
if (!optionalWorkingDir) {
412412
ctx.Diags.diagnose(SourceLoc(), diag::clang_dependency_scan_error,
413413
"Missing '-working-directory' argument");
414414
return None;
415415
}
416-
std::string workingDir = optionalWorkingDir.getValue();
416+
std::string workingDir = *optionalWorkingDir;
417417

418418
auto moduleCachePath = getModuleCachePathFromClang(getClangInstance());
419419
auto lookupModuleOutput =
@@ -473,12 +473,12 @@ bool ClangImporter::addBridgingHeaderDependencies(
473473
std::vector<std::string> commandLineArgs =
474474
getClangDepScanningInvocationArguments(ctx, StringRef(bridgingHeader));
475475
auto optionalWorkingDir = computeClangWorkingDirectory(commandLineArgs, ctx);
476-
if (!optionalWorkingDir.hasValue()) {
476+
if (!optionalWorkingDir) {
477477
ctx.Diags.diagnose(SourceLoc(), diag::clang_dependency_scan_error,
478478
"Missing '-working-directory' argument");
479479
return true;
480480
}
481-
std::string workingDir = optionalWorkingDir.getValue();
481+
std::string workingDir = *optionalWorkingDir;
482482

483483
auto moduleCachePath = getModuleCachePathFromClang(getClangInstance());
484484
auto lookupModuleOutput =

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
11821182

11831183
// First check to see if the .swiftinterface exists at all. Bail if not.
11841184
auto &fs = *Ctx.SourceMgr.getFileSystem();
1185-
std::string InPath = BaseName.findInterfacePath(fs).getValueOr("");
1185+
std::string InPath = BaseName.findInterfacePath(fs).value_or("");
11861186
if (InPath.empty()) {
11871187
if (fs.exists(ModPath)) {
11881188
LLVM_DEBUG(llvm::dbgs()

0 commit comments

Comments
 (0)