[all-commits] [llvm/llvm-project] 0e9124: [LLDB] Add an llvm::Optional version of GetRegiste...
David Spickett via All-commits
all-commits at lists.llvm.org
Mon Sep 26 03:54:52 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0e912417c67db2dc32d32c98213dba42b9b607a6
https://github.com/llvm/llvm-project/commit/0e912417c67db2dc32d32c98213dba42b9b607a6
Author: David Spickett <david.spickett at linaro.org>
Date: 2022-09-26 (Mon, 26 Sep 2022)
Changed paths:
M lldb/include/lldb/Core/EmulateInstruction.h
M lldb/source/Core/EmulateInstruction.cpp
M lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
M lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
M lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
M lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
M lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp
M lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h
M lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp
M lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h
M lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp
M lldb/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.h
M lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
M lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h
Log Message:
-----------
[LLDB] Add an llvm::Optional version of GetRegisterInfo
We have some 500 ish uses of the bool plus ref version
so changing them all at once isn't a great idea.
This adds an overload that doesn't take a RegisterInfo&
and returns an optional.
Once I'm done switching all the existing callers I'll
remove the original function.
Benefits of optional over bool plus ref:
* The intent of the function is clear from the prototype.
* It's harder to forget to check if the return is valid,
and if you do you'll get an assert.
* You don't hide ununsed variables, which happens because
passing by ref marks a variable used.
* You can't forget to reset the RegisterInfo in between
calls.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D134536
More information about the All-commits
mailing list