Skip to content

Commit

Permalink
[M68k] Fix MSVC llvm::Optional<> deprecation warnings
Browse files Browse the repository at this point in the history
Use has_value()/value() instead of hasValue()/getValue()
  • Loading branch information
RKSimon committed Aug 14, 2022
1 parent 1cf8127 commit cc6d3f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Target/M68k/M68kMCInstLower.cpp
Expand Up @@ -150,8 +150,8 @@ void M68kMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const {
const MachineOperand &MO = MI->getOperand(i);
Optional<MCOperand> MCOp = LowerOperand(MI, MO);

if (MCOp.hasValue() && MCOp.getValue().isValid())
OutMI.addOperand(MCOp.getValue());
if (MCOp.has_value() && MCOp.value().isValid())
OutMI.addOperand(MCOp.value());
}

// TAILJMPj, TAILJMPq - Lower to the correct jump instructions.
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Target/M68k/M68kTargetMachine.cpp
Expand Up @@ -72,9 +72,8 @@ std::string computeDataLayout(const Triple &TT, StringRef CPU,
Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
// If not defined we default to static
if (!RM.hasValue()) {
if (!RM.has_value())
return Reloc::Static;
}

return *RM;
}
Expand All @@ -88,7 +87,7 @@ CodeModel::Model getEffectiveCodeModel(Optional<CodeModel::Model> CM,
} else if (CM == CodeModel::Kernel) {
llvm_unreachable("Kernel code model is not implemented yet");
}
return CM.getValue();
return CM.value();
}
} // end anonymous namespace

Expand Down

0 comments on commit cc6d3f0

Please sign in to comment.