diff options
| author | Craig Topper <craig.topper@sifive.com> | 2022-04-06 14:50:49 -0700 |
|---|---|---|
| committer | Craig Topper <craig.topper@sifive.com> | 2022-04-06 15:09:18 -0700 |
| commit | 1235aaefbd4fe249430732253f30403849232d8e (patch) | |
| tree | 972010db9c1335ec5212a89a696ce4a911b5e22b /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | |
| parent | 815fa5bf44c459cf5e72b35da4311d6681952e1b (diff) | |
[AArch64][AMDGPU][WebAssembly] Use static_cast instead of a reinterpret_cast to downcast in parseMachineFunctionInfo. NFC
static_cast is a little safer here since the compiler will
ensure we're casting to a class derived from
yaml::MachineFunctionInfo.
I believe this first appeared on AMDGPU and was copied to the
other two targets.
Spotted when it was being copied to RISCV in D123178.
Differential Revision: https://reviews.llvm.org/D123260
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index cd3b06b1eda6..6d66ce44fb21 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -594,8 +594,7 @@ yaml::MachineFunctionInfo *WebAssemblyTargetMachine::convertFuncInfoToYAML( bool WebAssemblyTargetMachine::parseMachineFunctionInfo( const yaml::MachineFunctionInfo &MFI, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const { - const auto &YamlMFI = - reinterpret_cast<const yaml::WebAssemblyFunctionInfo &>(MFI); + const auto &YamlMFI = static_cast<const yaml::WebAssemblyFunctionInfo &>(MFI); MachineFunction &MF = PFS.MF; MF.getInfo<WebAssemblyFunctionInfo>()->initializeBaseYamlFields(YamlMFI); return false; |
