mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -105,7 +105,7 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) {
|
||||
static std::string
|
||||
getVersionedPrebuiltModulePath(Optional<llvm::VersionTuple> sdkVer,
|
||||
StringRef defaultPrebuiltPath) {
|
||||
if (!sdkVer.hasValue())
|
||||
if (!sdkVer.has_value())
|
||||
return defaultPrebuiltPath.str();
|
||||
std::string versionStr = sdkVer->getAsString();
|
||||
StringRef vs = versionStr;
|
||||
@@ -439,9 +439,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
auto vers =
|
||||
VersionParser::parseVersionString(A->getValue(), SourceLoc(), &Diags);
|
||||
bool isValid = false;
|
||||
if (vers.hasValue()) {
|
||||
if (auto effectiveVers = vers.getValue().getEffectiveLanguageVersion()) {
|
||||
Opts.EffectiveLanguageVersion = effectiveVers.getValue();
|
||||
if (vers.has_value()) {
|
||||
if (auto effectiveVers = vers.value().getEffectiveLanguageVersion()) {
|
||||
Opts.EffectiveLanguageVersion = effectiveVers.value();
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
@@ -452,8 +452,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
if (auto A = Args.getLastArg(OPT_package_description_version)) {
|
||||
auto vers =
|
||||
VersionParser::parseVersionString(A->getValue(), SourceLoc(), &Diags);
|
||||
if (vers.hasValue()) {
|
||||
Opts.PackageDescriptionVersion = vers.getValue();
|
||||
if (vers.has_value()) {
|
||||
Opts.PackageDescriptionVersion = vers.value();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -1719,7 +1719,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
.Default(None);
|
||||
}
|
||||
if (Args.getLastArg(OPT_enable_lexical_lifetimes_noArg)) {
|
||||
if (!enableLexicalLifetimesFlag.getValueOr(true)) {
|
||||
if (!enableLexicalLifetimesFlag.value_or(true)) {
|
||||
// Error if lexical lifetimes have been disabled via the meta-var form
|
||||
// and enabled via the flag.
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
|
||||
@@ -1731,8 +1731,8 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
}
|
||||
}
|
||||
|
||||
if (enableLexicalLifetimesFlag.getValueOr(false) &&
|
||||
!enableLexicalBorrowScopesFlag.getValueOr(true)) {
|
||||
if (enableLexicalLifetimesFlag.value_or(false) &&
|
||||
!enableLexicalBorrowScopesFlag.value_or(true)) {
|
||||
// Error if lexical lifetimes have been enabled but lexical borrow scopes--
|
||||
// on which they are dependent--have been disabled.
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
|
||||
@@ -1742,7 +1742,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
}
|
||||
|
||||
if (Args.hasArg(OPT_enable_experimental_move_only) &&
|
||||
!enableLexicalBorrowScopesFlag.getValueOr(true)) {
|
||||
!enableLexicalBorrowScopesFlag.value_or(true)) {
|
||||
// Error if move-only is enabled and lexical borrow scopes--on which it
|
||||
// depends--has been disabled.
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
|
||||
@@ -1752,7 +1752,7 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
|
||||
}
|
||||
|
||||
if (Args.hasArg(OPT_enable_experimental_move_only) &&
|
||||
!enableLexicalLifetimesFlag.getValueOr(true)) {
|
||||
!enableLexicalLifetimesFlag.value_or(true)) {
|
||||
// Error if move-only is enabled and lexical lifetimes--on which it
|
||||
// depends--has been disabled.
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
|
||||
@@ -2239,7 +2239,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
||||
.Case("llvm-full", IRGenLLVMLTOKind::Full)
|
||||
.Default(llvm::None);
|
||||
if (LLVMLTOKind)
|
||||
Opts.LLVMLTOKind = LLVMLTOKind.getValue();
|
||||
Opts.LLVMLTOKind = LLVMLTOKind.value();
|
||||
else
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
|
||||
Reference in New Issue
Block a user