Use value instead of getValue (NFC)

This commit is contained in:
Kazu Hirata 2022-07-19 21:18:26 -07:00
parent d946fb8d95
commit 0387da6f4f
8 changed files with 28 additions and 28 deletions

View File

@ -217,7 +217,7 @@ SarifDocumentWriter::createPhysicalLocation(const CharSourceRange &R) {
}
assert(I != CurrentArtifacts.end() && "Failed to insert new artifact");
const SarifArtifactLocation &Location = I->second.Location;
uint32_t Idx = Location.Index.getValue();
uint32_t Idx = Location.Index.value();
return json::Object{{{"artifactLocation", json::Object{{{"index", Idx}}}},
{"region", createTextRegion(SourceMgr, R)}}};
}
@ -271,12 +271,12 @@ void SarifDocumentWriter::endRun() {
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.getValue());
Loc["index"] = static_cast<int64_t>(A.Location.Index.value());
}
json::Object Artifact;
Artifact["location"] = std::move(Loc);
if (A.Length.has_value())
Artifact["length"] = static_cast<int64_t>(A.Length.getValue());
Artifact["length"] = static_cast<int64_t>(A.Length.value());
if (!A.Roles.empty())
Artifact["roles"] = json::Array(A.Roles);
if (!A.MimeType.empty())

View File

@ -121,9 +121,9 @@ TEST_F(SarifDocumentWriterTest, canCreateDocumentWithOneRun) {
ASSERT_TRUE(driver->getString("fullName").has_value());
ASSERT_TRUE(driver->getString("language").has_value());
EXPECT_EQ(driver->getString("name").getValue(), ShortName);
EXPECT_EQ(driver->getString("fullName").getValue(), LongName);
EXPECT_EQ(driver->getString("language").getValue(), "en-US");
EXPECT_EQ(driver->getString("name").value(), ShortName);
EXPECT_EQ(driver->getString("fullName").value(), LongName);
EXPECT_EQ(driver->getString("language").value(), "en-US");
}
TEST_F(SarifDocumentWriterTest, addingResultsWillCrashIfThereIsNoRun) {
@ -189,8 +189,8 @@ TEST_F(SarifDocumentWriterTest, addingResultWithValidRuleAndRunIsOk) {
ASSERT_TRUE(Driver->getString("name").has_value());
ASSERT_TRUE(Driver->getString("fullName").has_value());
EXPECT_EQ(Driver->getString("name").getValue(), "sarif test");
EXPECT_EQ(Driver->getString("fullName").getValue(), "sarif test runner");
EXPECT_EQ(Driver->getString("name").value(), "sarif test");
EXPECT_EQ(Driver->getString("fullName").value(), "sarif test runner");
// The results are as expected
EXPECT_EQ(Results->size(), 1UL);

View File

@ -420,7 +420,7 @@ CachingVPExpander::expandPredicationInMemoryIntrinsic(IRBuilder<> &Builder,
StoreInst *NewStore =
Builder.CreateStore(DataParam, PtrParam, /*IsVolatile*/ false);
if (AlignOpt.has_value())
NewStore->setAlignment(AlignOpt.getValue());
NewStore->setAlignment(AlignOpt.value());
NewMemoryInst = NewStore;
} else
NewMemoryInst = Builder.CreateMaskedStore(
@ -432,7 +432,7 @@ CachingVPExpander::expandPredicationInMemoryIntrinsic(IRBuilder<> &Builder,
LoadInst *NewLoad =
Builder.CreateLoad(VPI.getType(), PtrParam, /*IsVolatile*/ false);
if (AlignOpt.has_value())
NewLoad->setAlignment(AlignOpt.getValue());
NewLoad->setAlignment(AlignOpt.value());
NewMemoryInst = NewLoad;
} else
NewMemoryInst = Builder.CreateMaskedLoad(

View File

@ -816,7 +816,7 @@ bool AMDGPUCallLowering::passSpecialInputs(MachineIRBuilder &MIRBuilder,
Optional<uint32_t> Id =
AMDGPUMachineFunction::getLDSKernelIdMetadata(MF.getFunction());
if (Id.has_value()) {
MIRBuilder.buildConstant(InputReg, Id.getValue());
MIRBuilder.buildConstant(InputReg, Id.value());
} else {
MIRBuilder.buildUndef(InputReg);
}

View File

@ -4204,7 +4204,7 @@ bool AMDGPULegalizerInfo::getLDSKernelId(Register DstReg,
Optional<uint32_t> KnownSize =
AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
if (KnownSize.has_value())
B.buildConstant(DstReg, KnownSize.getValue());
B.buildConstant(DstReg, KnownSize.value());
return false;
}

View File

@ -1671,7 +1671,7 @@ SDValue SITargetLowering::getLDSKernelId(SelectionDAG &DAG,
Optional<uint32_t> KnownSize =
AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
if (KnownSize.has_value())
return DAG.getConstant(KnownSize.getValue(), SL, MVT::i32);
return DAG.getConstant(KnownSize.value(), SL, MVT::i32);
return SDValue();
}
@ -2822,7 +2822,7 @@ void SITargetLowering::passSpecialInputs(
} else if (InputID == AMDGPUFunctionArgInfo::LDS_KERNEL_ID) {
Optional<uint32_t> Id = AMDGPUMachineFunction::getLDSKernelIdMetadata(F);
if (Id.has_value()) {
InputReg = DAG.getConstant(Id.getValue(), DL, ArgVT);
InputReg = DAG.getConstant(Id.value(), DL, ArgVT);
} else {
InputReg = DAG.getUNDEF(ArgVT);
}

View File

@ -1111,7 +1111,7 @@ bool Attributor::getAssumedSimplifiedValues(
Optional<Value *> CBResult = CB(IRP, AA, UsedAssumedInformation);
if (!CBResult.has_value())
continue;
Value *V = CBResult.getValue();
Value *V = CBResult.value();
if (!V)
return false;
if ((S & AA::ValueScope::Interprocedural) ||

View File

@ -9763,7 +9763,7 @@ askForAssumedConstant(Attributor &A, const AbstractAttribute &QueryingAA,
A.recordDependence(AA, QueryingAA, DepClassTy::OPTIONAL);
return llvm::None;
}
if (auto *C = COpt.getValue()) {
if (auto *C = COpt.value()) {
A.recordDependence(AA, QueryingAA, DepClassTy::OPTIONAL);
return C;
}
@ -9777,12 +9777,12 @@ Value *AAPotentialValues::getSingleValue(
Optional<Value *> V;
for (auto &It : Values) {
V = AA::combineOptionalValuesInAAValueLatice(V, It.getValue(), &Ty);
if (V.has_value() && !V.getValue())
if (V.has_value() && !V.value())
break;
}
if (!V.has_value())
return UndefValue::get(&Ty);
return V.getValue();
return V.value();
}
namespace {
@ -9825,7 +9825,7 @@ struct AAPotentialValuesImpl : AAPotentialValues {
Optional<Constant *> C = askForAssumedConstant<AAType>(A, AA, IRP, Ty);
if (!C)
return llvm::None;
if (C.getValue())
if (C.value())
if (auto *CC = AA::getWithType(**C, Ty))
return CC;
return nullptr;
@ -9850,7 +9850,7 @@ struct AAPotentialValuesImpl : AAPotentialValues {
Type &Ty = *getAssociatedType();
Optional<Value *> SimpleV =
askOtherAA<AAValueConstantRange>(A, *this, ValIRP, Ty);
if (SimpleV.has_value() && !SimpleV.getValue()) {
if (SimpleV.has_value() && !SimpleV.value()) {
auto &PotentialConstantsAA = A.getAAFor<AAPotentialConstantValues>(
*this, ValIRP, DepClassTy::OPTIONAL);
if (PotentialConstantsAA.isValidState()) {
@ -9865,8 +9865,8 @@ struct AAPotentialValuesImpl : AAPotentialValues {
if (!SimpleV.has_value())
return;
if (SimpleV.getValue())
VPtr = SimpleV.getValue();
if (SimpleV.value())
VPtr = SimpleV.value();
}
if (isa<ConstantInt>(VPtr))
@ -10005,7 +10005,7 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
UsedAssumedInformation, AA::Intraprocedural);
if (!SimplifiedLHS.has_value())
return true;
if (!SimplifiedLHS.getValue())
if (!SimplifiedLHS.value())
return false;
LHS = *SimplifiedLHS;
@ -10014,7 +10014,7 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
UsedAssumedInformation, AA::Intraprocedural);
if (!SimplifiedRHS.has_value())
return true;
if (!SimplifiedRHS.getValue())
if (!SimplifiedRHS.value())
return false;
RHS = *SimplifiedRHS;
@ -10195,8 +10195,8 @@ struct AAPotentialValuesFloating : AAPotentialValuesImpl {
if (!SimplifiedOp.has_value())
return true;
if (SimplifiedOp.getValue())
NewOps[Idx] = SimplifiedOp.getValue();
if (SimplifiedOp.value())
NewOps[Idx] = SimplifiedOp.value();
else
NewOps[Idx] = Op;
@ -10497,10 +10497,10 @@ struct AAPotentialValuesCallSiteReturned : AAPotentialValuesImpl {
// Nothing to do as long as no value was determined.
continue;
}
V = CallerV.getValue() ? CallerV.getValue() : V;
V = CallerV.value() ? CallerV.value() : V;
if (AA::isDynamicallyUnique(A, *this, *V) &&
AA::isValidInScope(*V, Caller)) {
if (CallerV.getValue()) {
if (CallerV.value()) {
SmallVector<AA::ValueAndContext> ArgValues;
IRPosition IRP = IRPosition::value(*V);
if (auto *Arg = dyn_cast<Argument>(V))