if (hasBase) {
if (isTypeInfo) {
base = APValue::LValueBase::getTypeInfo(
- TypeInfoLValue(typeInfo.value().getTypePtr()), type.value());
+ TypeInfoLValue(typeInfo->getTypePtr()), *type);
elemTy = base.getTypeInfoType();
} else if (isExpr) {
- base = APValue::LValueBase(cast<Expr>(stmt.value()),
- callIndex.value(), version.value());
+ base = APValue::LValueBase(cast<Expr>(*stmt),
+ *callIndex, *version);
elemTy = base.get<const Expr *>()->getType();
} else {
- base = APValue::LValueBase(cast<ValueDecl>(decl.value()),
- callIndex.value(), version.value());
+ base = APValue::LValueBase(cast<ValueDecl>(*decl),
+ *callIndex, *version);
elemTy = base.get<const ValueDecl *>()->getType();
}
}
/// DirectoryEntry::getName have been deleted, delete this class and replace
/// instances with Optional<DirectoryEntryRef>
operator const DirectoryEntry *() const {
- return has_value() ? &value().getDirEntry() : nullptr;
+ return has_value() ? &(*this)->getDirEntry() : nullptr;
}
};
/// FileEntry::getName have been deleted, delete this class and replace
/// instances with Optional<FileEntryRef>
operator const FileEntry *() const {
- return has_value() ? &value().getFileEntry() : nullptr;
+ return has_value() ? &(*this)->getFileEntry() : nullptr;
}
};
for (unsigned Bucket = 0; Bucket < NumBuckets; ++Bucket) {
HMapBucket B = getBucket(Bucket);
- if (B.Key != HMAP_EmptyBucketKey) {
- Optional<StringRef> Key = getString(B.Key);
- if (Key)
- Callback(Key.value());
- }
+ if (B.Key != HMAP_EmptyBucketKey)
+ if (Optional<StringRef> Key = getString(B.Key))
+ Callback(*Key);
}
}
}
/// Return true if the constraint is perfectly constrained to 'true'.
- bool isConstrainedTrue() const { return Val && Val.value(); }
+ bool isConstrainedTrue() const { return Val && *Val; }
/// Return true if the constraint is perfectly constrained to 'false'.
- bool isConstrainedFalse() const { return Val && !Val.value(); }
+ bool isConstrainedFalse() const { return Val && !*Val; }
/// Return true if the constrained is perfectly constrained.
bool isConstrained() const { return Val.has_value(); }
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) {
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
if (ActiveAttr)
- return ActiveAttr.value()->getMapType();
+ return (*ActiveAttr)->getMapType();
return std::nullopt;
}
OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) {
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
if (ActiveAttr)
- return ActiveAttr.value()->getDevType();
+ return (*ActiveAttr)->getDevType();
return std::nullopt;
}
OMPDeclareTargetDeclAttr::getLocation(const ValueDecl *VD) {
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
if (ActiveAttr)
- return ActiveAttr.value()->getRange().getBegin();
+ return (*ActiveAttr)->getRange().getBegin();
return std::nullopt;
}
Stmt *BodyFarm::getBody(const FunctionDecl *D) {
Optional<Stmt *> &Val = Bodies[D];
if (Val)
- return Val.value();
+ return *Val;
Val = nullptr;
Optional<Stmt *> &Val = Bodies[D];
if (Val)
- return Val.value();
+ return *Val;
Val = nullptr;
// For now, we only synthesize getters.
assert(BlockIt != CFCtx.getStmtToBlock().end());
const auto &State = BlockToState[BlockIt->getSecond()->getBlockID()];
assert(State);
- return &State.value().Env;
+ return &State->Env;
}
private:
if (OldBlockState) {
if (isLoopHead(*Block)) {
LatticeJoinEffect Effect1 = Analysis.widenTypeErased(
- NewBlockState.Lattice, OldBlockState.value().Lattice);
+ NewBlockState.Lattice, OldBlockState->Lattice);
LatticeJoinEffect Effect2 =
NewBlockState.Env.widen(OldBlockState->Env, Analysis);
if (Effect1 == LatticeJoinEffect::Unchanged &&
// The state of `Block` didn't change from widening so there's no need
// to revisit its successors.
continue;
- } else if (Analysis.isEqualTypeErased(OldBlockState.value().Lattice,
+ } else if (Analysis.isEqualTypeErased(OldBlockState->Lattice,
NewBlockState.Lattice) &&
OldBlockState->Env.equivalentTo(NewBlockState.Env, Analysis)) {
// The state of `Block` didn't change after transfer so there's no need
PathPieces::const_iterator X_I = X.begin(), X_end = X.end();
PathPieces::const_iterator Y_I = Y.begin(), Y_end = Y.end();
- for ( ; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I) {
- Optional<bool> b = comparePiece(**X_I, **Y_I);
- if (b)
- return b.value();
- }
+ for (; X_I != X_end && Y_I != Y_end; ++X_I, ++Y_I)
+ if (Optional<bool> b = comparePiece(**X_I, **Y_I))
+ return *b;
return std::nullopt;
}
if (*XI != *YI)
return (*XI) < (*YI);
}
- Optional<bool> b = comparePath(X.path, Y.path);
- assert(b);
- return b.value();
+ return *comparePath(X.path, Y.path);
}
void PathDiagnosticConsumer::FlushDiagnostics(
Value getValue(const CFGBlock *block, const CFGBlock *dstBlock,
const VarDecl *vd) {
- const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
- assert(idx);
- return getValueVector(block)[idx.value()];
+ Optional<unsigned> idx = declToIndex.getValueIndex(vd);
+ return getValueVector(block)[*idx];
}
};
}
ValueVector::reference CFGBlockValues::operator[](const VarDecl *vd) {
- const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
- assert(idx);
- return scratch[idx.value()];
+ return scratch[*declToIndex.getValueIndex(vd)];
}
//------------------------------------------------------------------------====//
const SarifArtifactLocation &Location = I->second.Location;
json::Object ArtifactLocationObject{{"uri", Location.URI}};
if (Location.Index.has_value())
- ArtifactLocationObject["index"] = Location.Index.value();
+ ArtifactLocationObject["index"] = *Location.Index;
return json::Object{{{"artifactLocation", std::move(ArtifactLocationObject)},
{"region", createTextRegion(SourceMgr, R)}}};
}
const SarifArtifact &A = Pair.getValue();
json::Object Loc{{"uri", A.Location.URI}};
if (A.Location.Index.has_value()) {
- Loc["index"] = static_cast<int64_t>(A.Location.Index.value());
+ Loc["index"] = static_cast<int64_t>(*A.Location.Index);
}
json::Object Artifact;
Artifact["location"] = std::move(Loc);
if (A.Length.has_value())
- Artifact["length"] = static_cast<int64_t>(A.Length.value());
+ Artifact["length"] = static_cast<int64_t>(*A.Length);
if (!A.Roles.empty())
Artifact["roles"] = json::Array(A.Roles);
if (!A.MimeType.empty())
if (!StartIndex)
StartIndex = FieldIndex;
} else if (StartIndex) {
- EHStack.pushCleanup<SanitizeDtorFieldRange>(
- NormalAndEHCleanup, DD, StartIndex.value(), FieldIndex);
+ EHStack.pushCleanup<SanitizeDtorFieldRange>(NormalAndEHCleanup, DD,
+ *StartIndex, FieldIndex);
StartIndex = std::nullopt;
}
}
void End() {
if (StartIndex)
EHStack.pushCleanup<SanitizeDtorFieldRange>(NormalAndEHCleanup, DD,
- StartIndex.value(), -1);
+ *StartIndex, -1);
}
};
} // end anonymous namespace
/// at position \p Key.
void serializeObject(Object &Paren, StringRef Key, Optional<Object> Obj) {
if (Obj)
- Paren[Key] = std::move(Obj.value());
+ Paren[Key] = std::move(*Obj);
}
/// Helper function to inject a JSON array \p Array into object \p Paren at
/// position \p Key.
void serializeArray(Object &Paren, StringRef Key, Optional<Array> Array) {
if (Array)
- Paren[Key] = std::move(Array.value());
+ Paren[Key] = std::move(*Array);
}
/// Serialize a \c VersionTuple \p V with the Symbol Graph semantic version
auto TO = std::make_shared<TargetOptions>();
TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
if (getFrontendOpts().AuxTargetCPU)
- TO->CPU = getFrontendOpts().AuxTargetCPU.value();
+ TO->CPU = *getFrontendOpts().AuxTargetCPU;
if (getFrontendOpts().AuxTargetFeatures)
- TO->FeaturesAsWritten = getFrontendOpts().AuxTargetFeatures.value();
+ TO->FeaturesAsWritten = *getFrontendOpts().AuxTargetFeatures;
TO->HostTriple = getTarget().getTriple().str();
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
}
StringRef Scanner::lexIdentifier(const char *&First, const char *const End) {
Optional<StringRef> Id = tryLexIdentifierOrSkipLine(First, End);
assert(Id && "expected identifier token");
- return Id.value();
+ return *Id;
}
bool Scanner::isNextIdentifierOrSkipLine(StringRef Id, const char *&First,
isPublic = VisMD->isPublic();
}
- return DefInfo(nullptr, UndefLoc, !isPublic || isPublic.value());
+ return DefInfo(nullptr, UndefLoc, !isPublic || *isPublic);
}
const MacroDirective::DefInfo
Module *Mod, llvm::Optional<const FileEntry *> File) const {
bool NeedsFramework = false;
SmallVector<Module::UnresolvedHeaderDirective, 1> NewHeaders;
- const auto Size = File ? File.value()->getSize() : 0;
- const auto ModTime = File ? File.value()->getModificationTime() : 0;
+ const auto Size = File ? (*File)->getSize() : 0;
+ const auto ModTime = File ? (*File)->getModificationTime() : 0;
for (auto &Header : Mod->UnresolvedHeaders) {
if (File && ((Header.ModTime && Header.ModTime != ModTime) ||
// The last ')' has been reached; return the value if one found or
// a diagnostic and a dummy value.
if (Result) {
- OS << Result.value();
+ OS << *Result;
// For strict conformance to __has_cpp_attribute rules, use 'L'
// suffix for dated literals.
- if (Result.value() > 1)
+ if (*Result > 1)
OS << 'L';
} else {
OS << 0;
// See if the external source can see if the entity is in the file without
// deserializing it.
- Optional<bool> IsInFile =
- ExternalSource->isPreprocessedEntityInFileID(LoadedIndex, FID);
- if (IsInFile)
- return IsInFile.value();
+ if (Optional<bool> IsInFile =
+ ExternalSource->isPreprocessedEntityInFileID(LoadedIndex, FID))
+ return *IsInFile;
// The external source did not provide a definite answer, go and deserialize
// the entity to check it.
if (DevTypeData) {
if (DeviceTypeLoc.isValid()) {
// We already saw another device_type clause, diagnose it.
- Diag(DevTypeData.value().Loc,
+ Diag(DevTypeData->Loc,
diag::warn_omp_more_one_device_type_clause);
break;
}
- switch (static_cast<OpenMPDeviceType>(DevTypeData.value().Type)) {
+ switch (static_cast<OpenMPDeviceType>(DevTypeData->Type)) {
case OMPC_DEVICE_TYPE_any:
DTCI.DT = OMPDeclareTargetDeclAttr::DT_Any;
break;
if (!Val || ParseOnly)
return nullptr;
if (getLangOpts().OpenMP < 51 && Kind == OMPC_default &&
- (static_cast<DefaultKind>(Val.value().Type) == OMP_DEFAULT_private ||
- static_cast<DefaultKind>(Val.value().Type) ==
+ (static_cast<DefaultKind>(Val->Type) == OMP_DEFAULT_private ||
+ static_cast<DefaultKind>(Val->Type) ==
OMP_DEFAULT_firstprivate)) {
- Diag(Val.value().LOpen, diag::err_omp_invalid_dsa)
- << getOpenMPClauseName(static_cast<DefaultKind>(Val.value().Type) ==
+ Diag(Val->LOpen, diag::err_omp_invalid_dsa)
+ << getOpenMPClauseName(static_cast<DefaultKind>(Val->Type) ==
OMP_DEFAULT_private
? OMPC_private
: OMPC_firstprivate)
<< getOpenMPClauseName(OMPC_default) << "5.1";
return nullptr;
}
- return Actions.ActOnOpenMPSimpleClause(Kind, Val.value().Type,
- Val.value().TypeLoc, Val.value().LOpen,
- Val.value().Loc, Val.value().RLoc);
+ return Actions.ActOnOpenMPSimpleClause(Kind, Val->Type,
+ Val->TypeLoc, Val->LOpen,
+ Val->Loc, Val->RLoc);
}
/// Parsing of OpenMP clauses like 'ordered'.
return;
if (*NRVO && isDeclScope(*NRVO))
- NRVO.value()->setNRVOVariable(true);
+ (*NRVO)->setNRVOVariable(true);
// It's necessary to propagate NRVO candidate to the parent scope for cases
// when the parent scope doesn't contain a return statement.
InferredTarget = BaseMethodTarget;
} else {
bool ResolutionError = resolveCalleeCUDATargetConflict(
- InferredTarget.value(), BaseMethodTarget, &*InferredTarget);
+ *InferredTarget, BaseMethodTarget, &*InferredTarget);
if (ResolutionError) {
if (Diagnose) {
Diag(ClassDecl->getLocation(),
diag::note_implicit_member_target_infer_collision)
- << (unsigned)CSM << InferredTarget.value() << BaseMethodTarget;
+ << (unsigned)CSM << *InferredTarget << BaseMethodTarget;
}
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
return true;
InferredTarget = FieldMethodTarget;
} else {
bool ResolutionError = resolveCalleeCUDATargetConflict(
- InferredTarget.value(), FieldMethodTarget, &*InferredTarget);
+ *InferredTarget, FieldMethodTarget, &*InferredTarget);
if (ResolutionError) {
if (Diagnose) {
Diag(ClassDecl->getLocation(),
diag::note_implicit_member_target_infer_collision)
- << (unsigned)CSM << InferredTarget.value() << FieldMethodTarget;
+ << (unsigned)CSM << *InferredTarget << FieldMethodTarget;
}
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
return true;
// it's the least restrictive option that can be invoked from any target.
bool NeedsH = true, NeedsD = true;
if (InferredTarget) {
- if (InferredTarget.value() == CFT_Device)
+ if (*InferredTarget == CFT_Device)
NeedsH = false;
- else if (InferredTarget.value() == CFT_Host)
+ else if (*InferredTarget == CFT_Host)
NeedsD = false;
}
}();
if (DiagSelect) {
S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg)
- << DiagSelect.value() << TheCall->getSourceRange();
+ << *DiagSelect << TheCall->getSourceRange();
return ExprError();
}
else if (auto New = dyn_cast<CXXNewExpr>(E)) {
if (New->isArray())
if (auto ArraySize = New->getArraySize())
- Exprs.push_back(ArraySize.value());
+ Exprs.push_back(*ArraySize);
}
} while (!Exprs.empty());
}
// specified by the value of this argument.
if (AlignmentParam && !FD->hasAttr<AllocAlignAttr>()) {
FD->addAttr(AllocAlignAttr::CreateImplicit(
- Context, ParamIdx(AlignmentParam.value(), FD), FD->getLocation()));
+ Context, ParamIdx(*AlignmentParam, FD), FD->getLocation()));
}
// FIXME:
std::pair<const Expr *, OMPOrderedClause *> getOrderedRegionParam() const {
if (const SharingMapTy *Top = getTopOfStackOrNull())
if (Top->OrderedRegion)
- return Top->OrderedRegion.value();
+ return *Top->OrderedRegion;
return std::make_pair(nullptr, nullptr);
}
/// Returns true, if parent region is ordered (has associated
getParentOrderedRegionParam() const {
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
if (Parent->OrderedRegion)
- return Parent->OrderedRegion.value();
+ return *Parent->OrderedRegion;
return std::make_pair(nullptr, nullptr);
}
/// Marks current region as having an 'order' clause.
// != with increment is treated as <; != with decrement is treated as >
if (!TestIsLessOp)
TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract);
- if (UB &&
- (IsConstZero ||
- (TestIsLessOp.value() ? (IsConstNeg || (IsUnsigned && Subtract))
- : (IsConstPos || (IsUnsigned && !Subtract))))) {
+ if (UB && (IsConstZero ||
+ (*TestIsLessOp ? (IsConstNeg || (IsUnsigned && Subtract))
+ : (IsConstPos || (IsUnsigned && !Subtract))))) {
SemaRef.Diag(NewStep->getExprLoc(),
diag::err_omp_loop_incr_not_compatible)
- << LCDecl << TestIsLessOp.value() << NewStep->getSourceRange();
+ << LCDecl << *TestIsLessOp << NewStep->getSourceRange();
SemaRef.Diag(ConditionLoc,
diag::note_omp_loop_cond_requres_compatible_incr)
- << TestIsLessOp.value() << ConditionSrcRange;
+ << *TestIsLessOp << ConditionSrcRange;
return true;
}
- if (TestIsLessOp.value() == Subtract) {
+ if (*TestIsLessOp == Subtract) {
NewStep =
SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep)
.get();
UBVal = MinUB.get();
}
}
- Expr *UBExpr = TestIsLessOp.value() ? UBVal : LBVal;
- Expr *LBExpr = TestIsLessOp.value() ? LBVal : UBVal;
+ Expr *UBExpr = *TestIsLessOp ? UBVal : LBVal;
+ Expr *LBExpr = *TestIsLessOp ? LBVal : UBVal;
Expr *Upper = tryBuildCapture(SemaRef, UBExpr, Captures).get();
Expr *Lower = tryBuildCapture(SemaRef, LBExpr, Captures).get();
if (!Upper || !Lower)
// init value.
Expr *MinExpr = nullptr;
Expr *MaxExpr = nullptr;
- Expr *LBExpr = TestIsLessOp.value() ? LB : UB;
- Expr *UBExpr = TestIsLessOp.value() ? UB : LB;
- bool LBNonRect = TestIsLessOp.value() ? InitDependOnLC.has_value()
- : CondDependOnLC.has_value();
- bool UBNonRect = TestIsLessOp.value() ? CondDependOnLC.has_value()
- : InitDependOnLC.has_value();
+ Expr *LBExpr = *TestIsLessOp ? LB : UB;
+ Expr *UBExpr = *TestIsLessOp ? UB : LB;
+ bool LBNonRect =
+ *TestIsLessOp ? InitDependOnLC.has_value() : CondDependOnLC.has_value();
+ bool UBNonRect =
+ *TestIsLessOp ? CondDependOnLC.has_value() : InitDependOnLC.has_value();
Expr *Lower =
LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
Expr *Upper =
if (!NewLB.isUsable() || !NewUB.isUsable())
return nullptr;
- ExprResult CondExpr = SemaRef.BuildBinOp(
- S, DefaultLoc,
- TestIsLessOp.value() ? (TestIsStrictOp ? BO_LT : BO_LE)
- : (TestIsStrictOp ? BO_GT : BO_GE),
- NewLB.get(), NewUB.get());
+ ExprResult CondExpr =
+ SemaRef.BuildBinOp(S, DefaultLoc,
+ *TestIsLessOp ? (TestIsStrictOp ? BO_LT : BO_LE)
+ : (TestIsStrictOp ? BO_GT : BO_GE),
+ NewLB.get(), NewUB.get());
if (CondExpr.isUsable()) {
if (!SemaRef.Context.hasSameUnqualifiedType(CondExpr.get()->getType(),
SemaRef.Context.BoolTy))
return nullptr;
// Upper - Lower
Expr *Upper =
- TestIsLessOp.value() ? Cnt : tryBuildCapture(SemaRef, LB, Captures).get();
+ *TestIsLessOp ? Cnt : tryBuildCapture(SemaRef, LB, Captures).get();
Expr *Lower =
- TestIsLessOp.value() ? tryBuildCapture(SemaRef, LB, Captures).get() : Cnt;
+ *TestIsLessOp ? tryBuildCapture(SemaRef, LB, Captures).get() : Cnt;
if (!Upper || !Lower)
return nullptr;
auto *VD = cast<ValueDecl>(ND);
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
- if (ActiveAttr && ActiveAttr.value()->getDevType() != DTCI.DT &&
- ActiveAttr.value()->getLevel() == Level) {
+ if (ActiveAttr && (*ActiveAttr)->getDevType() != DTCI.DT &&
+ (*ActiveAttr)->getLevel() == Level) {
Diag(Loc, diag::err_omp_device_type_mismatch)
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(DTCI.DT)
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(
- ActiveAttr.value()->getDevType());
+ (*ActiveAttr)->getDevType());
return;
}
- if (ActiveAttr && ActiveAttr.value()->getMapType() != MT &&
- ActiveAttr.value()->getLevel() == Level) {
+ if (ActiveAttr && (*ActiveAttr)->getMapType() != MT &&
+ (*ActiveAttr)->getLevel() == Level) {
Diag(Loc, diag::err_omp_declare_target_to_and_link) << ND;
return;
}
- if (ActiveAttr && ActiveAttr.value()->getLevel() == Level)
+ if (ActiveAttr && (*ActiveAttr)->getLevel() == Level)
return;
Expr *IndirectE = nullptr;
bool IsIndirect = false;
if (DTCI.Indirect) {
- IndirectE = DTCI.Indirect.value();
+ IndirectE = *DTCI.Indirect;
if (!IndirectE)
IsIndirect = true;
}
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
unsigned Level = DeclareTargetNesting.size();
- if (ActiveAttr && ActiveAttr.value()->getLevel() >= Level)
+ if (ActiveAttr && (*ActiveAttr)->getLevel() >= Level)
return;
DeclareTargetContextInfo &DTCI = DeclareTargetNesting.back();
Expr *IndirectE = nullptr;
bool IsIndirect = false;
if (DTCI.Indirect) {
- IndirectE = DTCI.Indirect.value();
+ IndirectE = *DTCI.Indirect;
if (!IndirectE)
IsIndirect = true;
}
if (!DeclVarData)
return;
- E = DeclVarData.value().second;
- FD = DeclVarData.value().first;
+ E = DeclVarData->second;
+ FD = DeclVarData->first;
if (auto *VariantDRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) {
if (auto *VariantFD = dyn_cast<FunctionDecl>(VariantDRE->getDecl())) {
llvm::Optional<ProgramStateRef> MaybeState =
performKernelMalloc(Call, C, State);
if (MaybeState)
- State = MaybeState.value();
+ State = *MaybeState;
else
State = MallocMemAux(C, Call, Call.getArgExpr(0), UndefinedVal(), State,
AF_Malloc);
if (!DV)
continue;
- assert(!HasRefTypeParam || isa<Loc>(DV.value()));
+ assert(!HasRefTypeParam || isa<Loc>(*DV));
// Process the case when the argument is not a location.
- if (ExpectedToBeNonNull && !isa<Loc>(DV.value())) {
+ if (ExpectedToBeNonNull && !isa<Loc>(*DV)) {
// If the argument is a union type, we want to handle a potential
// transparent_union GCC extension.
if (!ArgE)
ExplorationStrategyKind::BFSBlockDFSContents)
.Default(std::nullopt);
assert(K && "User mode is invalid.");
- return K.value();
+ return *K;
}
CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
.Case("all", CTUPhase1InliningKind::All)
.Default(std::nullopt);
assert(K && "CTU inlining mode is invalid.");
- return K.value();
+ return *K;
}
IPAKind AnalyzerOptions::getIPAMode() const {
.Default(std::nullopt);
assert(K && "IPA Mode is invalid.");
- return K.value();
+ return *K;
}
bool
PathDiagnosticLocation Loc(Cond, SM, LCtx);
auto event = std::make_shared<PathDiagnosticEventPiece>(Loc, Message);
if (shouldPrune)
- event->setPrunable(shouldPrune.value());
+ event->setPrunable(*shouldPrune);
return event;
}
// Check if this function has been marked as non-inlinable.
Optional<bool> MayInline = Engine.FunctionSummaries->mayInline(D);
if (MayInline) {
- if (!MayInline.value())
+ if (!*MayInline)
return false;
} else {
// Output the macro name.
Indent(o, indent) << "<key>name</key>";
- EmitString(o, MacroName.value()) << '\n';
+ EmitString(o, *MacroName) << '\n';
// Output what it expands into.
Indent(o, indent) << "<key>expansion</key>";
- EmitString(o, ExpansionText.value()) << '\n';
+ EmitString(o, *ExpansionText) << '\n';
// Finish up.
--indent;
// complete.
template <typename T, typename Function>
auto transformOptional(const Optional<T> &O, const Function &F)
- -> Optional<decltype(F(O.value()))> {
+ -> Optional<decltype(F(*O))> {
if (O)
- return F(O.value());
+ return F(*O);
return std::nullopt;
}
// complete.
template <typename T, typename Function>
auto transformOptional(Optional<T> &&O, const Function &F)
- -> Optional<decltype(F(std::move(O).value()))> {
+ -> Optional<decltype(F(*std::move(O)))> {
if (O)
- return F(std::move(O).value());
+ return F(*std::move(O));
return std::nullopt;
}
Optional<int> Count =
getOptionalIntLoopAttribute(LoopID, "llvm.loop.unroll.count");
if (Count)
- return Count.value() == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
+ return *Count == 1 ? TM_SuppressedByUser : TM_ForcedByUser;
if (getBooleanLoopAttribute(LoopID, "llvm.loop.unroll.enable"))
return TM_ForcedByUser;