use new llvm::Optional API

`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
This commit is contained in:
Erik Eckstein
2022-11-15 15:08:30 +01:00
parent 567b68aa6f
commit ab1b343dad
328 changed files with 1537 additions and 1536 deletions

View File

@@ -436,7 +436,7 @@ static Optional<SymbolicValue> collectConstants(FoldState &foldState) {
// diagnosed and reported. If so, abort evaluation. Otherwise, continue
// evaluation if possible as this error could be due to an instruction that
// doesn't affect the OSLogMessage value.
if (errorInfo && detectAndDiagnoseErrors(errorInfo.getValue(), currInst)) {
if (errorInfo && detectAndDiagnoseErrors(errorInfo.value(), currInst)) {
return errorInfo;
}
@@ -448,7 +448,7 @@ static Optional<SymbolicValue> collectConstants(FoldState &foldState) {
}
// Set the next instruction to continue evaluation from.
currI = nextI.getValue();
currI = nextI.value();
// If the instruction results are foldable and if we found a constant value
// for the results, record it.
@@ -458,7 +458,7 @@ static Optional<SymbolicValue> collectConstants(FoldState &foldState) {
Optional<SymbolicValue> constantVal =
constantEvaluator.lookupConstValue(instructionResult);
if (constantVal.hasValue()) {
if (constantVal.has_value()) {
foldState.addConstantSILValue(instructionResult);
}
}
@@ -751,7 +751,7 @@ static SILValue emitCodeForSymbolicValue(SymbolicValue symVal,
SILType operandType = captureOperand->getType();
SILType captureType = operandType.subst(module, callSubstMap);
SILValue captureSILVal = emitCodeForSymbolicValue(
captureSymVal.getValue(), captureType.getASTType(), builder, loc,
captureSymVal.value(), captureType.getASTType(), builder, loc,
stringInfo);
capturedSILVals.push_back(captureSILVal);
}
@@ -935,7 +935,7 @@ static void substituteConstants(FoldState &foldState) {
for (SILValue constantSILValue : foldState.getConstantSILValues()) {
SymbolicValue constantSymbolicVal =
evaluator.lookupConstValue(constantSILValue).getValue();
evaluator.lookupConstValue(constantSILValue).value();
// Make sure that the symbolic value tracked in the foldState is a constant.
// In the case of ArraySymbolicValue, the array storage could be a non-constant
// if some instruction in the array initialization sequence was not evaluated