[clang] Use value instead of getValue (NFC)

This commit is contained in:
Kazu Hirata 2022-07-13 23:39:33 -07:00
parent 05523dc32d
commit cb2c8f694d
51 changed files with 194 additions and 197 deletions

View File

@ -520,15 +520,15 @@ let Class = PropertyTypeCase<APValue, "LValue"> in {
if (hasBase) {
if (isTypeInfo) {
base = APValue::LValueBase::getTypeInfo(
TypeInfoLValue(typeInfo.getValue().getTypePtr()), type.getValue());
TypeInfoLValue(typeInfo.value().getTypePtr()), type.value());
elemTy = base.getTypeInfoType();
} else if (isExpr) {
base = APValue::LValueBase(cast<Expr>(stmt.getValue()),
callIndex.getValue(), version.getValue());
base = APValue::LValueBase(cast<Expr>(stmt.value()),
callIndex.value(), version.value());
elemTy = base.get<const Expr *>()->getType();
} else {
base = APValue::LValueBase(cast<ValueDecl>(decl.getValue()),
callIndex.getValue(), version.getValue());
base = APValue::LValueBase(cast<ValueDecl>(decl.value()),
callIndex.value(), version.value());
elemTy = base.get<const ValueDecl *>()->getType();
}
}

View File

@ -1019,7 +1019,7 @@ public:
SVal getObjectUnderConstruction() const {
return ExprEngine::getObjectUnderConstruction(getState(), getOriginExpr(),
getLocationContext())
.getValue();
.value();
}
/// Number of non-placement arguments to the call. It is equal to 2 for

View File

@ -53,10 +53,10 @@ public:
}
/// Return true if the constraint is perfectly constrained to 'true'.
bool isConstrainedTrue() const { return Val && Val.getValue(); }
bool isConstrainedTrue() const { return Val && Val.value(); }
/// Return true if the constraint is perfectly constrained to 'false'.
bool isConstrainedFalse() const { return Val && !Val.getValue(); }
bool isConstrainedFalse() const { return Val && !Val.value(); }
/// Return true if the constrained is perfectly constrained.
bool isConstrained() const { return Val.has_value(); }

View File

@ -344,7 +344,7 @@ protected:
if (!res)
Cached[hash] = ConditionTruthVal();
else
Cached[hash] = ConditionTruthVal(res.getValue());
Cached[hash] = ConditionTruthVal(res.value());
return Cached[hash];
}

View File

@ -209,8 +209,8 @@ public:
}
bool isValid() const { return Valid; }
bool isScalar() const { return Scale && Scale.getValue() == 0; }
bool isVector() const { return Scale && Scale.getValue() != 0; }
bool isScalar() const { return Scale && Scale.value() == 0; }
bool isVector() const { return Scale && Scale.value() != 0; }
bool isVector(unsigned Width) const {
return isVector() && ElementBitwidth == Width;
}

View File

@ -96,7 +96,7 @@ public:
if (auto *Directives = Contents->DepDirectives.load()) {
if (Directives->has_value())
return ArrayRef<dependency_directives_scan::Directive>(
Directives->getValue());
Directives->value());
}
return None;
}

View File

@ -169,7 +169,7 @@ llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy>
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(const ValueDecl *VD) {
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
if (ActiveAttr)
return ActiveAttr.getValue()->getMapType();
return ActiveAttr.value()->getMapType();
return llvm::None;
}
@ -177,7 +177,7 @@ llvm::Optional<OMPDeclareTargetDeclAttr::DevTypeTy>
OMPDeclareTargetDeclAttr::getDeviceType(const ValueDecl *VD) {
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
if (ActiveAttr)
return ActiveAttr.getValue()->getDevType();
return ActiveAttr.value()->getDevType();
return llvm::None;
}
@ -185,7 +185,7 @@ llvm::Optional<SourceLocation>
OMPDeclareTargetDeclAttr::getLocation(const ValueDecl *VD) {
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr = getActiveAttr(VD);
if (ActiveAttr)
return ActiveAttr.getValue()->getRange().getBegin();
return ActiveAttr.value()->getRange().getBegin();
return llvm::None;
}

View File

@ -699,7 +699,7 @@ static Stmt *create_OSAtomicCompareAndSwap(ASTContext &C, const FunctionDecl *D)
Stmt *BodyFarm::getBody(const FunctionDecl *D) {
Optional<Stmt *> &Val = Bodies[D];
if (Val)
return Val.getValue();
return Val.value();
Val = nullptr;
@ -874,7 +874,7 @@ Stmt *BodyFarm::getBody(const ObjCMethodDecl *D) {
Optional<Stmt *> &Val = Bodies[D];
if (Val)
return Val.getValue();
return Val.value();
Val = nullptr;
// For now, we only synthesize getters.

View File

@ -36,7 +36,7 @@ buildStmtToBasicBlockMap(const CFG &Cfg) {
if (!Stmt)
continue;
StmtToBlock[Stmt.getValue().getStmt()] = Block;
StmtToBlock[Stmt.value().getStmt()] = Block;
}
if (const Stmt *TerminatorStmt = Block->getTerminatorStmt())
StmtToBlock[TerminatorStmt] = Block;

View File

@ -104,7 +104,7 @@ Constraints
auto StatusString = debugString(Result.getStatus());
auto Solution = Result.getSolution();
auto SolutionString =
Solution.hasValue() ? "\n" + debugString(Solution.getValue()) : "";
Solution.hasValue() ? "\n" + debugString(Solution.value()) : "";
return formatv(
Template,

View File

@ -51,7 +51,7 @@ public:
assert(BlockIT != CFCtx.getStmtToBlock().end());
const auto &State = BlockToState[BlockIT->getSecond()->getBlockID()];
assert(State);
return &State.getValue().Env;
return &State.value().Env;
}
private:
@ -212,7 +212,7 @@ static TypeErasedDataflowAnalysisState computeBlockInputState(
if (!MaybePredState)
continue;
TypeErasedDataflowAnalysisState PredState = MaybePredState.getValue();
TypeErasedDataflowAnalysisState PredState = MaybePredState.value();
if (ApplyBuiltinTransfer) {
if (const Stmt *PredTerminatorStmt = Pred->getTerminatorStmt()) {
const StmtToEnvMapImpl StmtToEnv(CFCtx, BlockStates);
@ -370,7 +370,7 @@ runTypeErasedDataflowAnalysis(
transferBlock(CFCtx, BlockStates, *Block, InitEnv, Analysis);
if (OldBlockState &&
Analysis.isEqualTypeErased(OldBlockState.getValue().Lattice,
Analysis.isEqualTypeErased(OldBlockState.value().Lattice,
NewBlockState.Lattice) &&
OldBlockState->Env.equivalentTo(NewBlockState.Env, Analysis)) {
// The state of `Block` didn't change after transfer so there's no need to

View File

@ -320,7 +320,7 @@ static Optional<bool> comparePath(const PathPieces &X, const PathPieces &Y) {
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.getValue();
return b.value();
}
return None;
@ -397,7 +397,7 @@ static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y) {
}
Optional<bool> b = comparePath(X.path, Y.path);
assert(b);
return b.getValue();
return b.value();
}
void PathDiagnosticConsumer::FlushDiagnostics(

View File

@ -149,7 +149,7 @@ public:
const VarDecl *vd) {
const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
assert(idx);
return getValueVector(block)[idx.getValue()];
return getValueVector(block)[idx.value()];
}
};
@ -210,7 +210,7 @@ void CFGBlockValues::resetScratch() {
ValueVector::reference CFGBlockValues::operator[](const VarDecl *vd) {
const Optional<unsigned> &idx = declToIndex.getValueIndex(vd);
assert(idx);
return scratch[idx.getValue()];
return scratch[idx.value()];
}
//------------------------------------------------------------------------====//

View File

@ -252,7 +252,7 @@ bool RISCVTargetInfo::hasFeature(StringRef Feature) const {
.Case("64bit", Is64Bit)
.Default(None);
if (Result)
return Result.getValue();
return Result.value();
if (ISAInfo->isSupportedExtensionFeature(Feature))
return ISAInfo->hasExtension(Feature);

View File

@ -1783,14 +1783,14 @@ namespace {
StartIndex = FieldIndex;
} else if (StartIndex) {
EHStack.pushCleanup<SanitizeDtorFieldRange>(
NormalAndEHCleanup, DD, StartIndex.getValue(), FieldIndex);
NormalAndEHCleanup, DD, StartIndex.value(), FieldIndex);
StartIndex = None;
}
}
void End() {
if (StartIndex)
EHStack.pushCleanup<SanitizeDtorFieldRange>(NormalAndEHCleanup, DD,
StartIndex.getValue(), -1);
StartIndex.value(), -1);
}
};
} // end anonymous namespace

View File

@ -3326,7 +3326,7 @@ class OffloadingActionBuilder final {
AssociatedOffloadKind);
if (CompileDeviceOnly && CurPhase == FinalPhase && BundleOutput &&
BundleOutput.getValue()) {
BundleOutput.value()) {
for (unsigned I = 0, E = GpuArchList.size(); I != E; ++I) {
OffloadAction::DeviceDependences DDep;
DDep.add(*CudaDeviceActions[I], *ToolChains.front(), GpuArchList[I],

View File

@ -475,8 +475,8 @@ void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA,
}
if (SectionAddressData) {
std::string DataSectionArg = std::string("-Tdata=0x") +
llvm::utohexstr(SectionAddressData.getValue());
std::string DataSectionArg =
std::string("-Tdata=0x") + llvm::utohexstr(SectionAddressData.value());
CmdArgs.push_back(Args.MakeArgString(DataSectionArg));
} else {
// We do not have an entry for this CPU in the address mapping table yet.

View File

@ -2329,7 +2329,7 @@ void Clang::AddHexagonTargetArgs(const ArgList &Args,
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back(Args.MakeArgString("-hexagon-small-data-threshold=" +
Twine(G.getValue())));
Twine(G.value())));
}
if (!Args.hasArg(options::OPT_fno_short_enums))

View File

@ -2087,7 +2087,7 @@ void Generic_GCC::GCCInstallationDetector::print(raw_ostream &OS) const {
bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
if (BiarchSibling) {
M = BiarchSibling.getValue();
M = BiarchSibling.value();
return true;
}
return false;

View File

@ -340,8 +340,8 @@ constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-pie");
if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
CmdArgs.push_back(Args.MakeArgString("-G" + Twine(G.getValue())));
UseG0 = G.getValue() == 0;
CmdArgs.push_back(Args.MakeArgString("-G" + Twine(G.value())));
UseG0 = G.value() == 0;
}
CmdArgs.push_back("-o");

View File

@ -31,14 +31,14 @@ namespace {
/// at position \p Key.
void serializeObject(Object &Paren, StringRef Key, Optional<Object> Obj) {
if (Obj)
Paren[Key] = std::move(Obj.getValue());
Paren[Key] = std::move(Obj.value());
}
/// 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.getValue());
Paren[Key] = std::move(Array.value());
}
/// Serialize a \c VersionTuple \p V with the Symbol Graph semantic version

View File

@ -115,9 +115,9 @@ bool CompilerInstance::createTarget() {
auto TO = std::make_shared<TargetOptions>();
TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
if (getFrontendOpts().AuxTargetCPU)
TO->CPU = getFrontendOpts().AuxTargetCPU.getValue();
TO->CPU = getFrontendOpts().AuxTargetCPU.value();
if (getFrontendOpts().AuxTargetFeatures)
TO->FeaturesAsWritten = getFrontendOpts().AuxTargetFeatures.getValue();
TO->FeaturesAsWritten = getFrontendOpts().AuxTargetFeatures.value();
TO->HostTriple = getTarget().getTriple().str();
setAuxTarget(TargetInfo::CreateTargetInfo(getDiagnostics(), TO));
}

View File

@ -1976,7 +1976,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
} else {
Opts.DiagnosticsHotnessThreshold = *ResultOrErr;
if ((!Opts.DiagnosticsHotnessThreshold ||
Opts.DiagnosticsHotnessThreshold.getValue() > 0) &&
Opts.DiagnosticsHotnessThreshold.value() > 0) &&
!UsingProfile)
Diags.Report(diag::warn_drv_diagnostics_hotness_requires_pgo)
<< "-fdiagnostics-hotness-threshold=";
@ -1993,7 +1993,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
} else {
Opts.DiagnosticsMisExpectTolerance = *ResultOrErr;
if ((!Opts.DiagnosticsMisExpectTolerance ||
Opts.DiagnosticsMisExpectTolerance.getValue() > 0) &&
Opts.DiagnosticsMisExpectTolerance.value() > 0) &&
!UsingProfile)
Diags.Report(diag::warn_drv_diagnostics_misexpect_requires_pgo)
<< "-fdiagnostics-misexpect-tolerance=";

View File

@ -832,11 +832,11 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
unsigned minor = 0;
if (tuple.getMinor())
minor = tuple.getMinor().getValue();
minor = tuple.getMinor().value();
unsigned subminor = 0;
if (tuple.getSubminor())
subminor = tuple.getSubminor().getValue();
subminor = tuple.getSubminor().value();
Builder.defineMacro("__OBJFW_RUNTIME_ABI__",
Twine(tuple.getMajor() * 10000 + minor * 100 +

View File

@ -550,7 +550,7 @@ Scanner::tryLexIdentifierOrSkipLine(const char *&First, const char *const End) {
StringRef Scanner::lexIdentifier(const char *&First, const char *const End) {
Optional<StringRef> Id = tryLexIdentifierOrSkipLine(First, End);
assert(Id && "expected identifier token");
return Id.getValue();
return Id.value();
}
bool Scanner::isNextIdentifierOrSkipLine(StringRef Id, const char *&First,

View File

@ -213,7 +213,7 @@ MacroDirective::DefInfo MacroDirective::getDefinition() {
isPublic = VisMD->isPublic();
}
return DefInfo(nullptr, UndefLoc, !isPublic || isPublic.getValue());
return DefInfo(nullptr, UndefLoc, !isPublic || isPublic.value());
}
const MacroDirective::DefInfo

View File

@ -1219,8 +1219,8 @@ void ModuleMap::resolveHeaderDirectives(
Module *Mod, llvm::Optional<const FileEntry *> File) const {
bool NeedsFramework = false;
SmallVector<Module::UnresolvedHeaderDirective, 1> NewHeaders;
const auto Size = File ? File.getValue()->getSize() : 0;
const auto ModTime = File ? File.getValue()->getModificationTime() : 0;
const auto Size = File ? File.value()->getSize() : 0;
const auto ModTime = File ? File.value()->getModificationTime() : 0;
for (auto &Header : Mod->UnresolvedHeaders) {
if (File && ((Header.ModTime && Header.ModTime != ModTime) ||

View File

@ -1326,10 +1326,10 @@ already_lexed:
// The last ')' has been reached; return the value if one found or
// a diagnostic and a dummy value.
if (Result) {
OS << Result.getValue();
OS << Result.value();
// For strict conformance to __has_cpp_attribute rules, use 'L'
// suffix for dated literals.
if (Result.getValue() > 1)
if (Result.value() > 1)
OS << 'L';
} else {
OS << 0;

View File

@ -115,7 +115,7 @@ bool PreprocessingRecord::isEntityInFileID(iterator PPEI, FileID FID) {
Optional<bool> IsInFile =
ExternalSource->isPreprocessedEntityInFileID(LoadedIndex, FID);
if (IsInFile)
return IsInFile.getValue();
return IsInFile.value();
// The external source did not provide a definite answer, go and deserialize
// the entity to check it.

View File

@ -1884,11 +1884,11 @@ void Parser::ParseOMPDeclareTargetClauses(
if (DevTypeData) {
if (DeviceTypeLoc.isValid()) {
// We already saw another device_type clause, diagnose it.
Diag(DevTypeData.getValue().Loc,
Diag(DevTypeData.value().Loc,
diag::warn_omp_more_one_device_type_clause);
break;
}
switch (static_cast<OpenMPDeviceType>(DevTypeData.getValue().Type)) {
switch (static_cast<OpenMPDeviceType>(DevTypeData.value().Type)) {
case OMPC_DEVICE_TYPE_any:
DTCI.DT = OMPDeclareTargetDeclAttr::DT_Any;
break;
@ -3634,20 +3634,20 @@ OMPClause *Parser::ParseOpenMPSimpleClause(OpenMPClauseKind Kind,
if (!Val || ParseOnly)
return nullptr;
if (getLangOpts().OpenMP < 51 && Kind == OMPC_default &&
(static_cast<DefaultKind>(Val.getValue().Type) == OMP_DEFAULT_private ||
static_cast<DefaultKind>(Val.getValue().Type) ==
(static_cast<DefaultKind>(Val.value().Type) == OMP_DEFAULT_private ||
static_cast<DefaultKind>(Val.value().Type) ==
OMP_DEFAULT_firstprivate)) {
Diag(Val.getValue().LOpen, diag::err_omp_invalid_dsa)
<< getOpenMPClauseName(static_cast<DefaultKind>(Val.getValue().Type) ==
Diag(Val.value().LOpen, diag::err_omp_invalid_dsa)
<< getOpenMPClauseName(static_cast<DefaultKind>(Val.value().Type) ==
OMP_DEFAULT_private
? OMPC_private
: OMPC_firstprivate)
<< getOpenMPClauseName(OMPC_default) << "5.1";
return nullptr;
}
return Actions.ActOnOpenMPSimpleClause(
Kind, Val.getValue().Type, Val.getValue().TypeLoc, Val.getValue().LOpen,
Val.getValue().Loc, Val.getValue().RLoc);
return Actions.ActOnOpenMPSimpleClause(Kind, Val.value().Type,
Val.value().TypeLoc, Val.value().LOpen,
Val.value().Loc, Val.value().RLoc);
}
/// Parsing of OpenMP clauses like 'ordered'.

View File

@ -381,13 +381,13 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
InferredTarget = BaseMethodTarget;
} else {
bool ResolutionError = resolveCalleeCUDATargetConflict(
InferredTarget.getValue(), BaseMethodTarget,
InferredTarget.value(), BaseMethodTarget,
InferredTarget.getPointer());
if (ResolutionError) {
if (Diagnose) {
Diag(ClassDecl->getLocation(),
diag::note_implicit_member_target_infer_collision)
<< (unsigned)CSM << InferredTarget.getValue() << BaseMethodTarget;
<< (unsigned)CSM << InferredTarget.value() << BaseMethodTarget;
}
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
return true;
@ -425,14 +425,13 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
InferredTarget = FieldMethodTarget;
} else {
bool ResolutionError = resolveCalleeCUDATargetConflict(
InferredTarget.getValue(), FieldMethodTarget,
InferredTarget.value(), FieldMethodTarget,
InferredTarget.getPointer());
if (ResolutionError) {
if (Diagnose) {
Diag(ClassDecl->getLocation(),
diag::note_implicit_member_target_infer_collision)
<< (unsigned)CSM << InferredTarget.getValue()
<< FieldMethodTarget;
<< (unsigned)CSM << InferredTarget.value() << FieldMethodTarget;
}
MemberDecl->addAttr(CUDAInvalidTargetAttr::CreateImplicit(Context));
return true;
@ -445,9 +444,9 @@ bool Sema::inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl,
// it's the least restrictive option that can be invoked from any target.
bool NeedsH = true, NeedsD = true;
if (InferredTarget) {
if (InferredTarget.getValue() == CFT_Device)
if (InferredTarget.value() == CFT_Device)
NeedsH = false;
else if (InferredTarget.getValue() == CFT_Host)
else if (InferredTarget.value() == CFT_Host)
NeedsD = false;
}

View File

@ -1880,7 +1880,7 @@ static ExprResult SemaBuiltinLaunder(Sema &S, CallExpr *TheCall) {
}();
if (DiagSelect) {
S.Diag(TheCall->getBeginLoc(), diag::err_builtin_launder_invalid_arg)
<< DiagSelect.getValue() << TheCall->getSourceRange();
<< DiagSelect.value() << TheCall->getSourceRange();
return ExprError();
}

View File

@ -15514,7 +15514,7 @@ void Sema::AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(
// specified by the value of this argument.
if (AlignmentParam && !FD->hasAttr<AllocAlignAttr>()) {
FD->addAttr(AllocAlignAttr::CreateImplicit(
Context, ParamIdx(AlignmentParam.getValue(), FD), FD->getLocation()));
Context, ParamIdx(AlignmentParam.value(), FD), FD->getLocation()));
}
// FIXME:

View File

@ -2673,7 +2673,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (IOSToWatchOSMapping) {
if (auto MappedVersion = IOSToWatchOSMapping->map(
Version, MinimumWatchOSVersion, None)) {
return MappedVersion.getValue();
return MappedVersion.value();
}
}
@ -2682,10 +2682,10 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
if (NewMajor >= 2) {
if (Version.getMinor()) {
if (Version.getSubminor())
return VersionTuple(NewMajor, Version.getMinor().getValue(),
Version.getSubminor().getValue());
return VersionTuple(NewMajor, Version.getMinor().value(),
Version.getSubminor().value());
else
return VersionTuple(NewMajor, Version.getMinor().getValue());
return VersionTuple(NewMajor, Version.getMinor().value());
}
return VersionTuple(NewMajor);
}

View File

@ -847,7 +847,7 @@ public:
std::pair<const Expr *, OMPOrderedClause *> getOrderedRegionParam() const {
if (const SharingMapTy *Top = getTopOfStackOrNull())
if (Top->OrderedRegion)
return Top->OrderedRegion.getValue();
return Top->OrderedRegion.value();
return std::make_pair(nullptr, nullptr);
}
/// Returns true, if parent region is ordered (has associated
@ -862,7 +862,7 @@ public:
getParentOrderedRegionParam() const {
if (const SharingMapTy *Parent = getSecondOnStackOrNull())
if (Parent->OrderedRegion)
return Parent->OrderedRegion.getValue();
return Parent->OrderedRegion.value();
return std::make_pair(nullptr, nullptr);
}
/// Marks current region as nowait (it has a 'nowait' clause).
@ -7942,18 +7942,18 @@ bool OpenMPIterationSpaceChecker::setStep(Expr *NewStep, bool Subtract) {
if (!TestIsLessOp)
TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract);
if (UB &&
(IsConstZero || (TestIsLessOp.getValue()
? (IsConstNeg || (IsUnsigned && Subtract))
: (IsConstPos || (IsUnsigned && !Subtract))))) {
(IsConstZero ||
(TestIsLessOp.value() ? (IsConstNeg || (IsUnsigned && Subtract))
: (IsConstPos || (IsUnsigned && !Subtract))))) {
SemaRef.Diag(NewStep->getExprLoc(),
diag::err_omp_loop_incr_not_compatible)
<< LCDecl << TestIsLessOp.getValue() << NewStep->getSourceRange();
<< LCDecl << TestIsLessOp.value() << NewStep->getSourceRange();
SemaRef.Diag(ConditionLoc,
diag::note_omp_loop_cond_requres_compatible_incr)
<< TestIsLessOp.getValue() << ConditionSrcRange;
<< TestIsLessOp.value() << ConditionSrcRange;
return true;
}
if (TestIsLessOp.getValue() == Subtract) {
if (TestIsLessOp.value() == Subtract) {
NewStep =
SemaRef.CreateBuiltinUnaryOp(NewStep->getExprLoc(), UO_Minus, NewStep)
.get();
@ -8708,8 +8708,8 @@ Expr *OpenMPIterationSpaceChecker::buildNumIterations(
UBVal = MinUB.get();
}
}
Expr *UBExpr = TestIsLessOp.getValue() ? UBVal : LBVal;
Expr *LBExpr = TestIsLessOp.getValue() ? LBVal : UBVal;
Expr *UBExpr = TestIsLessOp.value() ? UBVal : LBVal;
Expr *LBExpr = TestIsLessOp.value() ? LBVal : UBVal;
Expr *Upper = tryBuildCapture(SemaRef, UBExpr, Captures).get();
Expr *Lower = tryBuildCapture(SemaRef, LBExpr, Captures).get();
if (!Upper || !Lower)
@ -8772,12 +8772,12 @@ std::pair<Expr *, Expr *> OpenMPIterationSpaceChecker::buildMinMaxValues(
// init value.
Expr *MinExpr = nullptr;
Expr *MaxExpr = nullptr;
Expr *LBExpr = TestIsLessOp.getValue() ? LB : UB;
Expr *UBExpr = TestIsLessOp.getValue() ? UB : LB;
bool LBNonRect = TestIsLessOp.getValue() ? InitDependOnLC.has_value()
: CondDependOnLC.has_value();
bool UBNonRect = TestIsLessOp.getValue() ? CondDependOnLC.has_value()
: InitDependOnLC.has_value();
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 *Lower =
LBNonRect ? LBExpr : tryBuildCapture(SemaRef, LBExpr, Captures).get();
Expr *Upper =
@ -8901,8 +8901,8 @@ Expr *OpenMPIterationSpaceChecker::buildPreCond(
ExprResult CondExpr = SemaRef.BuildBinOp(
S, DefaultLoc,
TestIsLessOp.getValue() ? (TestIsStrictOp ? BO_LT : BO_LE)
: (TestIsStrictOp ? BO_GT : BO_GE),
TestIsLessOp.value() ? (TestIsStrictOp ? BO_LT : BO_LE)
: (TestIsStrictOp ? BO_GT : BO_GE),
NewLB.get(), NewUB.get());
if (CondExpr.isUsable()) {
if (!SemaRef.Context.hasSameUnqualifiedType(CondExpr.get()->getType(),
@ -8978,12 +8978,10 @@ Expr *OpenMPIterationSpaceChecker::buildOrderedLoopData(
!SemaRef.getLangOpts().CPlusPlus)
return nullptr;
// Upper - Lower
Expr *Upper = TestIsLessOp.getValue()
? Cnt
: tryBuildCapture(SemaRef, LB, Captures).get();
Expr *Lower = TestIsLessOp.getValue()
? tryBuildCapture(SemaRef, LB, Captures).get()
: Cnt;
Expr *Upper =
TestIsLessOp.value() ? Cnt : tryBuildCapture(SemaRef, LB, Captures).get();
Expr *Lower =
TestIsLessOp.value() ? tryBuildCapture(SemaRef, LB, Captures).get() : Cnt;
if (!Upper || !Lower)
return nullptr;
@ -22587,27 +22585,27 @@ void Sema::ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc,
auto *VD = cast<ValueDecl>(ND);
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
if (ActiveAttr && ActiveAttr.getValue()->getDevType() != DTCI.DT &&
ActiveAttr.getValue()->getLevel() == Level) {
if (ActiveAttr && ActiveAttr.value()->getDevType() != DTCI.DT &&
ActiveAttr.value()->getLevel() == Level) {
Diag(Loc, diag::err_omp_device_type_mismatch)
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(DTCI.DT)
<< OMPDeclareTargetDeclAttr::ConvertDevTypeTyToStr(
ActiveAttr.getValue()->getDevType());
ActiveAttr.value()->getDevType());
return;
}
if (ActiveAttr && ActiveAttr.getValue()->getMapType() != MT &&
ActiveAttr.getValue()->getLevel() == Level) {
if (ActiveAttr && ActiveAttr.value()->getMapType() != MT &&
ActiveAttr.value()->getLevel() == Level) {
Diag(Loc, diag::err_omp_declare_target_to_and_link) << ND;
return;
}
if (ActiveAttr && ActiveAttr.getValue()->getLevel() == Level)
if (ActiveAttr && ActiveAttr.value()->getLevel() == Level)
return;
Expr *IndirectE = nullptr;
bool IsIndirect = false;
if (DTCI.Indirect) {
IndirectE = DTCI.Indirect.getValue();
IndirectE = DTCI.Indirect.value();
if (!IndirectE)
IsIndirect = true;
}
@ -22701,13 +22699,13 @@ void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D,
llvm::Optional<OMPDeclareTargetDeclAttr *> ActiveAttr =
OMPDeclareTargetDeclAttr::getActiveAttr(VD);
unsigned Level = DeclareTargetNesting.size();
if (ActiveAttr && ActiveAttr.getValue()->getLevel() >= Level)
if (ActiveAttr && ActiveAttr.value()->getLevel() >= Level)
return;
DeclareTargetContextInfo &DTCI = DeclareTargetNesting.back();
Expr *IndirectE = nullptr;
bool IsIndirect = false;
if (DTCI.Indirect) {
IndirectE = DTCI.Indirect.getValue();
IndirectE = DTCI.Indirect.value();
if (!IndirectE)
IsIndirect = true;
}

View File

@ -469,8 +469,8 @@ static void instantiateOMPDeclareVariantAttr(
if (!DeclVarData)
return;
E = DeclVarData.getValue().second;
FD = DeclVarData.getValue().first;
E = DeclVarData.value().second;
FD = DeclVarData.value().first;
if (auto *VariantDRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) {
if (auto *VariantFD = dyn_cast<FunctionDecl>(VariantDRE->getDecl())) {

View File

@ -769,7 +769,7 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
if (!errorNode)
errorNode = C.generateNonFatalErrorNode();
if (!errorNode.getValue())
if (!errorNode.value())
continue;
SmallString<128> sbuf;
@ -787,7 +787,7 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
os << "'";
auto R = std::make_unique<PathSensitiveBugReport>(*BT, os.str(),
errorNode.getValue());
errorNode.value());
R->addRange(msg.getArgSourceRange(I));
C.emitReport(std::move(R));
}

View File

@ -1189,9 +1189,10 @@ MallocChecker::performKernelMalloc(const CallEvent &Call, CheckerContext &C,
}
NonLoc Flags = V.castAs<NonLoc>();
NonLoc ZeroFlag = C.getSValBuilder()
.makeIntVal(KernelZeroFlagVal.getValue(), FlagsEx->getType())
.castAs<NonLoc>();
NonLoc ZeroFlag =
C.getSValBuilder()
.makeIntVal(KernelZeroFlagVal.value(), FlagsEx->getType())
.castAs<NonLoc>();
SVal MaskedFlagsUC = C.getSValBuilder().evalBinOpNN(State, BO_And,
Flags, ZeroFlag,
FlagsEx->getType());
@ -1239,7 +1240,7 @@ void MallocChecker::checkKernelMalloc(const CallEvent &Call,
llvm::Optional<ProgramStateRef> MaybeState =
performKernelMalloc(Call, C, State);
if (MaybeState)
State = MaybeState.getValue();
State = MaybeState.value();
else
State = MallocMemAux(C, Call, Call.getArgExpr(0), UndefinedVal(), State,
AF_Malloc);

View File

@ -136,10 +136,10 @@ void NonNullParamChecker::checkPreCall(const CallEvent &Call,
if (!DV)
continue;
assert(!HasRefTypeParam || isa<Loc>(DV.getValue()));
assert(!HasRefTypeParam || isa<Loc>(DV.value()));
// Process the case when the argument is not a location.
if (ExpectedToBeNonNull && !isa<Loc>(DV.getValue())) {
if (ExpectedToBeNonNull && !isa<Loc>(DV.value())) {
// If the argument is a union type, we want to handle a potential
// transparent_union GCC extension.
if (!ArgE)

View File

@ -234,7 +234,8 @@ void UnixAPIMisuseChecker::CheckOpenVariant(CheckerContext &C,
}
NonLoc oflags = V.castAs<NonLoc>();
NonLoc ocreateFlag = C.getSValBuilder()
.makeIntVal(Val_O_CREAT.getValue(), oflagsEx->getType()).castAs<NonLoc>();
.makeIntVal(Val_O_CREAT.value(), oflagsEx->getType())
.castAs<NonLoc>();
SVal maskedFlagsUC = C.getSValBuilder().evalBinOpNN(state, BO_And,
oflags, ocreateFlag,
oflagsEx->getType());

View File

@ -78,7 +78,7 @@ AnalyzerOptions::getExplorationStrategy() const {
ExplorationStrategyKind::BFSBlockDFSContents)
.Default(None);
assert(K && "User mode is invalid.");
return K.getValue();
return K.value();
}
CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
@ -89,7 +89,7 @@ CTUPhase1InliningKind AnalyzerOptions::getCTUPhase1Inlining() const {
.Case("all", CTUPhase1InliningKind::All)
.Default(None);
assert(K && "CTU inlining mode is invalid.");
return K.getValue();
return K.value();
}
IPAKind AnalyzerOptions::getIPAMode() const {
@ -102,7 +102,7 @@ IPAKind AnalyzerOptions::getIPAMode() const {
.Default(None);
assert(K && "IPA Mode is invalid.");
return K.getValue();
return K.value();
}
bool

View File

@ -2950,7 +2950,7 @@ PathDiagnosticPieceRef ConditionBRVisitor::VisitTrueTest(
PathDiagnosticLocation Loc(Cond, SM, LCtx);
auto event = std::make_shared<PathDiagnosticEventPiece>(Loc, Message);
if (shouldPrune)
event->setPrunable(shouldPrune.getValue());
event->setPrunable(shouldPrune.value());
return event;
}
@ -3084,9 +3084,9 @@ bool ConditionBRVisitor::printValue(const Expr *CondVarExpr, raw_ostream &Out,
Out << (TookTrue ? "not equal to 0" : "0");
} else {
if (Ty->isBooleanType())
Out << (IntValue.getValue()->getBoolValue() ? "true" : "false");
Out << (IntValue.value()->getBoolValue() ? "true" : "false");
else
Out << *IntValue.getValue();
Out << *IntValue.value();
}
return true;
@ -3282,7 +3282,7 @@ void FalsePositiveRefutationBRVisitor::finalizeVisitor(
if (!IsSAT)
return;
if (!IsSAT.getValue())
if (!IsSAT.value())
BR.markInvalid("Infeasible constraints", EndPathNode->getLocationContext());
}

View File

@ -1016,7 +1016,7 @@ bool ExprEngine::shouldInlineCall(const CallEvent &Call, const Decl *D,
// Check if this function has been marked as non-inlinable.
Optional<bool> MayInline = Engine.FunctionSummaries->mayInline(D);
if (MayInline) {
if (!MayInline.getValue())
if (!MayInline.value())
return false;
} else {

View File

@ -407,11 +407,11 @@ void PlistPrinter::ReportMacroExpansions(raw_ostream &o, unsigned indent) {
// Output the macro name.
Indent(o, indent) << "<key>name</key>";
EmitString(o, MacroName.getValue()) << '\n';
EmitString(o, MacroName.value()) << '\n';
// Output what it expands into.
Indent(o, indent) << "<key>expansion</key>";
EmitString(o, ExpansionText.getValue()) << '\n';
EmitString(o, ExpansionText.value()) << '\n';
// Finish up.
--indent;

View File

@ -114,7 +114,7 @@ bool RVVType::verifyType() const {
return false;
if (isFloat() && ElementBitwidth == 8)
return false;
unsigned V = Scale.getValue();
unsigned V = Scale.value();
switch (ElementBitwidth) {
case 1:
case 8:
@ -798,7 +798,7 @@ RVVType::computeTypes(BasicType BT, int Log2LMUL, unsigned NF,
if (!T)
return llvm::None;
// Record legal type index
Types.push_back(T.getValue());
Types.push_back(T.value());
}
return Types;
}

View File

@ -408,7 +408,7 @@ int clang_main(int Argc, char **Argv) {
llvm::Optional<std::string> OptCL = llvm::sys::Process::GetEnv("CL");
if (OptCL) {
SmallVector<const char *, 8> PrependedOpts;
getCLEnvVarOptions(OptCL.getValue(), Saver, PrependedOpts);
getCLEnvVarOptions(OptCL.value(), Saver, PrependedOpts);
// Insert right after the program name to prepend to the argument list.
Args.insert(Args.begin() + 1, PrependedOpts.begin(), PrependedOpts.end());
@ -417,7 +417,7 @@ int clang_main(int Argc, char **Argv) {
llvm::Optional<std::string> Opt_CL_ = llvm::sys::Process::GetEnv("_CL_");
if (Opt_CL_) {
SmallVector<const char *, 8> AppendedOpts;
getCLEnvVarOptions(Opt_CL_.getValue(), Saver, AppendedOpts);
getCLEnvVarOptions(Opt_CL_.value(), Saver, AppendedOpts);
// Insert at the end of the argument list to append.
Args.append(AppendedOpts.begin(), AppendedOpts.end());

View File

@ -538,7 +538,7 @@ bool CursorVisitor::VisitChildren(CXCursor Cursor) {
const Optional<bool> V = handleDeclForVisitation(*TL);
if (!V)
continue;
return V.getValue();
return V.value();
}
} else if (VisitDeclContext(
CXXUnit->getASTContext().getTranslationUnitDecl()))
@ -643,7 +643,7 @@ bool CursorVisitor::VisitDeclContext(DeclContext *DC) {
const Optional<bool> V = handleDeclForVisitation(D);
if (!V)
continue;
return V.getValue();
return V.value();
}
return false;
}
@ -677,7 +677,7 @@ Optional<bool> CursorVisitor::handleDeclForVisitation(const Decl *D) {
const Optional<bool> V = shouldVisitCursor(Cursor);
if (!V)
return None;
if (!V.getValue())
if (!V.value())
return false;
if (Visit(Cursor, true))
return true;
@ -1076,7 +1076,7 @@ bool CursorVisitor::VisitObjCContainerDecl(ObjCContainerDecl *D) {
const Optional<bool> &V = shouldVisitCursor(Cursor);
if (!V)
continue;
if (!V.getValue())
if (!V.value())
return false;
if (Visit(Cursor, true))
return true;

View File

@ -181,14 +181,14 @@ EMPTY zz
// A b cd ef gh
// zz
EXPECT_EQ("", Ctx->getExpandedText(at(3, 10)).getValue());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(3, 10)).getValue());
EXPECT_EQ("", Ctx->getExpandedText(at(3, 10)).value());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(3, 10)).value());
EXPECT_EQ("", Ctx->getExpandedText(at(3, 19)).getValue());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(3, 19)).getValue());
EXPECT_EQ("", Ctx->getExpandedText(at(3, 19)).value());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(3, 19)).value());
EXPECT_EQ("", Ctx->getExpandedText(at(4, 1)).getValue());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 1)).getValue());
EXPECT_EQ("", Ctx->getExpandedText(at(4, 1)).value());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 1)).value());
}
TEST_F(MacroExpansionContextTest, TransitiveExpansions) {
@ -200,10 +200,10 @@ TEST_F(MacroExpansionContextTest, TransitiveExpansions) {
// After preprocessing:
// A b cd ) 1 ef gh
EXPECT_EQ("WOOF", Ctx->getOriginalText(at(4, 10)).getValue());
EXPECT_EQ("WOOF", Ctx->getOriginalText(at(4, 10)).value());
EXPECT_EQ("", Ctx->getExpandedText(at(4, 18)).getValue());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 18)).getValue());
EXPECT_EQ("", Ctx->getExpandedText(at(4, 18)).value());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 18)).value());
}
TEST_F(MacroExpansionContextTest, MacroFunctions) {
@ -219,17 +219,17 @@ TEST_F(MacroExpansionContextTest, MacroFunctions) {
// WOOF( ) ) ) 1
// bar barr( ) ) ) 1( ) ) ) 1),,),')
EXPECT_EQ("$$ ef ()))1", Ctx->getExpandedText(at(4, 10)).getValue());
EXPECT_EQ("WOOF($$ ef)", Ctx->getOriginalText(at(4, 10)).getValue());
EXPECT_EQ("$$ ef ()))1", Ctx->getExpandedText(at(4, 10)).value());
EXPECT_EQ("WOOF($$ ef)", Ctx->getOriginalText(at(4, 10)).value());
EXPECT_EQ("", Ctx->getExpandedText(at(4, 22)).getValue());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 22)).getValue());
EXPECT_EQ("", Ctx->getExpandedText(at(4, 22)).value());
EXPECT_EQ("EMPTY", Ctx->getOriginalText(at(4, 22)).value());
EXPECT_EQ("WOOF ()))1", Ctx->getExpandedText(at(5, 3)).getValue());
EXPECT_EQ("WOOF(WOOF)", Ctx->getOriginalText(at(5, 3)).getValue());
EXPECT_EQ("WOOF ()))1", Ctx->getExpandedText(at(5, 3)).value());
EXPECT_EQ("WOOF(WOOF)", Ctx->getOriginalText(at(5, 3)).value());
EXPECT_EQ("bar barr ()))1()))1", Ctx->getExpandedText(at(6, 3)).getValue());
EXPECT_EQ("WOOF(WOOF(bar barr))", Ctx->getOriginalText(at(6, 3)).getValue());
EXPECT_EQ("bar barr ()))1()))1", Ctx->getExpandedText(at(6, 3)).value());
EXPECT_EQ("WOOF(WOOF(bar barr))", Ctx->getOriginalText(at(6, 3)).value());
}
TEST_F(MacroExpansionContextTest, VariadicMacros) {
@ -251,24 +251,23 @@ TEST_F(MacroExpansionContextTest, VariadicMacros) {
// fprintf (stderr, "success!\n" );
EXPECT_EQ(R"(fprintf (stderr ,"success!\n",))",
Ctx->getExpandedText(at(3, 3)).getValue());
Ctx->getExpandedText(at(3, 3)).value());
EXPECT_EQ(R"(eprintf("success!\n", ))",
Ctx->getOriginalText(at(3, 3)).getValue());
Ctx->getOriginalText(at(3, 3)).value());
EXPECT_EQ(R"(fprintf (stderr ,"success!\n",))",
Ctx->getExpandedText(at(4, 3)).getValue());
EXPECT_EQ(R"(eprintf("success!\n"))",
Ctx->getOriginalText(at(4, 3)).getValue());
Ctx->getExpandedText(at(4, 3)).value());
EXPECT_EQ(R"(eprintf("success!\n"))", Ctx->getOriginalText(at(4, 3)).value());
EXPECT_EQ(R"(fprintf (stderr ,"success!\n"))",
Ctx->getExpandedText(at(8, 3)).getValue());
Ctx->getExpandedText(at(8, 3)).value());
EXPECT_EQ(R"(eprintf2("success!\n", ))",
Ctx->getOriginalText(at(8, 3)).getValue());
Ctx->getOriginalText(at(8, 3)).value());
EXPECT_EQ(R"(fprintf (stderr ,"success!\n"))",
Ctx->getExpandedText(at(9, 3)).getValue());
Ctx->getExpandedText(at(9, 3)).value());
EXPECT_EQ(R"(eprintf2("success!\n"))",
Ctx->getOriginalText(at(9, 3)).getValue());
Ctx->getOriginalText(at(9, 3)).value());
}
TEST_F(MacroExpansionContextTest, ConcatenationMacros) {
@ -286,12 +285,12 @@ TEST_F(MacroExpansionContextTest, ConcatenationMacros) {
// };
EXPECT_EQ(R"({"quit",quit_command })",
Ctx->getExpandedText(at(4, 5)).getValue());
EXPECT_EQ("COMMAND(quit)", Ctx->getOriginalText(at(4, 5)).getValue());
Ctx->getExpandedText(at(4, 5)).value());
EXPECT_EQ("COMMAND(quit)", Ctx->getOriginalText(at(4, 5)).value());
EXPECT_EQ(R"({"help",help_command })",
Ctx->getExpandedText(at(5, 5)).getValue());
EXPECT_EQ("COMMAND(help)", Ctx->getOriginalText(at(5, 5)).getValue());
Ctx->getExpandedText(at(5, 5)).value());
EXPECT_EQ("COMMAND(help)", Ctx->getOriginalText(at(5, 5)).value());
}
TEST_F(MacroExpansionContextTest, StringizingMacros) {
@ -316,14 +315,14 @@ TEST_F(MacroExpansionContextTest, StringizingMacros) {
EXPECT_EQ(
R"(do {if (x ==0)fprintf (stderr ,"Warning: ""x == 0""\n");}while (0))",
Ctx->getExpandedText(at(6, 3)).getValue());
EXPECT_EQ("WARN_IF (x == 0)", Ctx->getOriginalText(at(6, 3)).getValue());
Ctx->getExpandedText(at(6, 3)).value());
EXPECT_EQ("WARN_IF (x == 0)", Ctx->getOriginalText(at(6, 3)).value());
EXPECT_EQ(R"("foo")", Ctx->getExpandedText(at(11, 3)).getValue());
EXPECT_EQ("str (foo)", Ctx->getOriginalText(at(11, 3)).getValue());
EXPECT_EQ(R"("foo")", Ctx->getExpandedText(at(11, 3)).value());
EXPECT_EQ("str (foo)", Ctx->getOriginalText(at(11, 3)).value());
EXPECT_EQ(R"("4")", Ctx->getExpandedText(at(12, 3)).getValue());
EXPECT_EQ("xstr (foo)", Ctx->getOriginalText(at(12, 3)).getValue());
EXPECT_EQ(R"("4")", Ctx->getExpandedText(at(12, 3)).value());
EXPECT_EQ("xstr (foo)", Ctx->getOriginalText(at(12, 3)).value());
}
TEST_F(MacroExpansionContextTest, StringizingVariadicMacros) {
@ -352,18 +351,18 @@ TEST_F(MacroExpansionContextTest, StringizingVariadicMacros) {
EXPECT_EQ("zz !apple !x *apple !x !**y (apple )zz !apple !x *apple !x !**y "
"(appleapple ))))",
Ctx->getExpandedText(at(11, 3)).getValue());
EXPECT_EQ("q(g)", Ctx->getOriginalText(at(11, 3)).getValue());
Ctx->getExpandedText(at(11, 3)).value());
EXPECT_EQ("q(g)", Ctx->getOriginalText(at(11, 3)).value());
EXPECT_EQ(R"res("apple"(apple )"apple"(appleapple )))))res",
Ctx->getExpandedText(at(12, 3)).getValue());
EXPECT_EQ("q(xstr)", Ctx->getOriginalText(at(12, 3)).getValue());
Ctx->getExpandedText(at(12, 3)).value());
EXPECT_EQ("q(xstr)", Ctx->getOriginalText(at(12, 3)).value());
EXPECT_EQ("zz !*)!x )!**y ", Ctx->getExpandedText(at(13, 3)).getValue());
EXPECT_EQ("g(RParen2x)", Ctx->getOriginalText(at(13, 3)).getValue());
EXPECT_EQ("zz !*)!x )!**y ", Ctx->getExpandedText(at(13, 3)).value());
EXPECT_EQ("g(RParen2x)", Ctx->getOriginalText(at(13, 3)).value());
EXPECT_EQ("!))*))", Ctx->getExpandedText(at(14, 3)).getValue());
EXPECT_EQ("f( RParen2x )", Ctx->getOriginalText(at(14, 3)).getValue());
EXPECT_EQ("!))*))", Ctx->getExpandedText(at(14, 3)).value());
EXPECT_EQ("f( RParen2x )", Ctx->getOriginalText(at(14, 3)).value());
}
TEST_F(MacroExpansionContextTest, RedefUndef) {
@ -381,11 +380,11 @@ TEST_F(MacroExpansionContextTest, RedefUndef) {
// Hi(Hi)
// FIXME: Extra space follows every identifier.
EXPECT_EQ("Welcome Adam ", Ctx->getExpandedText(at(3, 3)).getValue());
EXPECT_EQ("Hi(Adam)", Ctx->getOriginalText(at(3, 3)).getValue());
EXPECT_EQ("Welcome Adam ", Ctx->getExpandedText(at(3, 3)).value());
EXPECT_EQ("Hi(Adam)", Ctx->getOriginalText(at(3, 3)).value());
EXPECT_EQ("Willkommen ", Ctx->getExpandedText(at(5, 3)).getValue());
EXPECT_EQ("Hi", Ctx->getOriginalText(at(5, 3)).getValue());
EXPECT_EQ("Willkommen ", Ctx->getExpandedText(at(5, 3)).value());
EXPECT_EQ("Hi", Ctx->getOriginalText(at(5, 3)).value());
// There was no macro expansion at 7:3, we should expect None.
EXPECT_FALSE(Ctx->getExpandedText(at(7, 3)).has_value());
@ -411,12 +410,11 @@ TEST_F(MacroExpansionContextTest, UnbalacedParenthesis) {
// fun();
// int x = ((1, fun(), 1, fun(), 1 ));
EXPECT_EQ("fun ()", Ctx->getExpandedText(at(8, 3)).getValue());
EXPECT_EQ("applyInt )", Ctx->getOriginalText(at(8, 3)).getValue());
EXPECT_EQ("fun ()", Ctx->getExpandedText(at(8, 3)).value());
EXPECT_EQ("applyInt )", Ctx->getOriginalText(at(8, 3)).value());
EXPECT_EQ("((1,fun (),1,fun (),1",
Ctx->getExpandedText(at(13, 12)).getValue());
EXPECT_EQ("f(f(1))", Ctx->getOriginalText(at(13, 12)).getValue());
EXPECT_EQ("((1,fun (),1,fun (),1", Ctx->getExpandedText(at(13, 12)).value());
EXPECT_EQ("f(f(1))", Ctx->getOriginalText(at(13, 12)).value());
}
} // namespace

View File

@ -262,7 +262,7 @@ void checkEventualResultWithTimeout(VerifyingConsumer &TestConsumer) {
if (TestConsumer.result()) {
EXPECT_TRUE(*TestConsumer.result());
}
if ((TestConsumer.result() && !TestConsumer.result().getValue()) ||
if ((TestConsumer.result() && !TestConsumer.result().value()) ||
!TestConsumer.result())
TestConsumer.printUnmetExpectations(llvm::outs());
}

View File

@ -202,7 +202,7 @@ TEST_F(HeaderSearchTest, HeaderFrameworkLookup) {
EXPECT_TRUE(FoundFile.has_value());
EXPECT_TRUE(IsFrameworkFound);
auto &FE = FoundFile.getValue();
auto &FE = FoundFile.value();
auto FI = Search.getExistingFileInfo(FE);
EXPECT_TRUE(FI);
EXPECT_TRUE(FI->IsValid);
@ -271,7 +271,7 @@ TEST_F(HeaderSearchTest, HeaderMapFrameworkLookup) {
EXPECT_TRUE(FoundFile.has_value());
EXPECT_TRUE(IsMapped);
auto &FE = FoundFile.getValue();
auto &FE = FoundFile.value();
auto FI = Search.getExistingFileInfo(FE);
EXPECT_TRUE(FI);
EXPECT_TRUE(FI->IsValid);

View File

@ -228,7 +228,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
auto T = RVVType::computeType(BasicType::Int8, Log2LMUL,
PrototypeDescriptor::Mask);
if (T)
printType(T.getValue());
printType(T.value());
}
// Print RVV int/float types.
for (char I : StringRef("csil")) {
@ -236,13 +236,13 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
for (int Log2LMUL : Log2LMULs) {
auto T = RVVType::computeType(BT, Log2LMUL, PrototypeDescriptor::Vector);
if (T) {
printType(T.getValue());
printType(T.value());
auto UT = RVVType::computeType(
BT, Log2LMUL,
PrototypeDescriptor(BaseTypeModifier::Vector,
VectorTypeModifier::NoModifier,
TypeModifier::UnsignedInteger));
printType(UT.getValue());
printType(UT.value());
}
}
}
@ -251,7 +251,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
auto T = RVVType::computeType(BasicType::Float16, Log2LMUL,
PrototypeDescriptor::Vector);
if (T)
printType(T.getValue());
printType(T.value());
}
OS << "#endif\n";
@ -260,7 +260,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
auto T = RVVType::computeType(BasicType::Float32, Log2LMUL,
PrototypeDescriptor::Vector);
if (T)
printType(T.getValue());
printType(T.value());
}
OS << "#endif\n";
@ -269,7 +269,7 @@ void RVVEmitter::createHeader(raw_ostream &OS) {
auto T = RVVType::computeType(BasicType::Float64, Log2LMUL,
PrototypeDescriptor::Vector);
if (T)
printType(T.getValue());
printType(T.value());
}
OS << "#endif\n\n";