[llvm] [MC] Use MCRegister::id() to avoid implicit casts. NFC (PR #168233)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 15 12:05:11 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/include/llvm/MC/MCRegisterInfo.h llvm/lib/MC/MCInst.cpp llvm/lib/MC/MCRegisterInfo.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/MC/MCRegisterInfo.cpp b/llvm/lib/MC/MCRegisterInfo.cpp
index d839302cf..77fb73326 100644
--- a/llvm/lib/MC/MCRegisterInfo.cpp
+++ b/llvm/lib/MC/MCRegisterInfo.cpp
@@ -149,7 +149,7 @@ int64_t MCRegisterInfo::getDwarfRegNum(MCRegister Reg, bool isEH) const {
return -1;
DwarfLLVMRegPair Key = {Reg.id(), 0};
const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
- if (I == M+Size || I->FromReg != Reg)
+ if (I == M + Size || I->FromReg != Reg)
return -1;
// Consumers need to be able to detect -1 and -2, but at various points
// the numbers move between unsigned and signed representations, as well as
@@ -203,9 +203,9 @@ int MCRegisterInfo::getCodeViewRegNum(MCRegister Reg) const {
report_fatal_error("target does not implement codeview register mapping");
const DenseMap<MCRegister, int>::const_iterator I = L2CVRegs.find(Reg);
if (I == L2CVRegs.end())
- report_fatal_error(
- "unknown codeview register " +
- (Reg.id() < getNumRegs() ? getName(Reg) : Twine(Reg.id())));
+ report_fatal_error("unknown codeview register " + (Reg.id() < getNumRegs()
+ ? getName(Reg)
+ : Twine(Reg.id())));
return I->second;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/168233
More information about the llvm-commits
mailing list