[clang-tools-extra] [NFC] Fix potential underflow constant. (PR #118528)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 4 11:04:52 PST 2024
================
@@ -58,10 +58,10 @@ getDerivedParameter(const ClassTemplateSpecializationDecl *CRTP,
Arg.getAsType()->getAsCXXRecordDecl() == Derived;
});
- return AnyOf ? CRTP->getSpecializedTemplate()
- ->getTemplateParameters()
- ->getParam(Idx - 1)
- : nullptr;
+ return AnyOf && Idx > 0 ? CRTP->getSpecializedTemplate()
----------------
AaronBallman wrote:
If the range is empty, then `Idx` is not incremented, but `AnyOf` will be false.
https://github.com/llvm/llvm-project/pull/118528
More information about the cfe-commits
mailing list