[clang-tools-extra] [clang-tidy] Use std::binary_search (NFC) (PR #140263)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 07:58:04 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tidy
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/140263.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp (+3-6)
``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
index 97c20cf200fa2..f8fd5e91d90d1 100644
--- a/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/MagicNumbersCheck.cpp
@@ -202,8 +202,7 @@ bool MagicNumbersCheck::isIgnoredValue(const IntegerLiteral *Literal) const {
if (IgnorePowersOf2IntegerValues && IntValue.isPowerOf2())
return true;
- return std::binary_search(IgnoredIntegerValues.begin(),
- IgnoredIntegerValues.end(), Value);
+ return llvm::binary_search(IgnoredIntegerValues, Value);
}
bool MagicNumbersCheck::isIgnoredValue(const FloatingLiteral *Literal) const {
@@ -213,14 +212,12 @@ bool MagicNumbersCheck::isIgnoredValue(const FloatingLiteral *Literal) const {
if (&FloatValue.getSemantics() == &llvm::APFloat::IEEEsingle()) {
const float Value = FloatValue.convertToFloat();
- return std::binary_search(IgnoredFloatingPointValues.begin(),
- IgnoredFloatingPointValues.end(), Value);
+ return llvm::binary_search(IgnoredFloatingPointValues, Value);
}
if (&FloatValue.getSemantics() == &llvm::APFloat::IEEEdouble()) {
const double Value = FloatValue.convertToDouble();
- return std::binary_search(IgnoredDoublePointValues.begin(),
- IgnoredDoublePointValues.end(), Value);
+ return llvm::binary_search(IgnoredDoublePointValues, Value);
}
return false;
``````````
</details>
https://github.com/llvm/llvm-project/pull/140263
More information about the cfe-commits
mailing list