[llvm] 32de467 - [ObjectYAML] Use llvm::all_of (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 20 00:14:55 PST 2021
Author: Kazu Hirata
Date: 2021-12-20T00:14:48-08:00
New Revision: 32de467f85fcf8cd46bf9dc4c62681f81a33802e
URL: https://github.com/llvm/llvm-project/commit/32de467f85fcf8cd46bf9dc4c62681f81a33802e
DIFF: https://github.com/llvm/llvm-project/commit/32de467f85fcf8cd46bf9dc4c62681f81a33802e.diff
LOG: [ObjectYAML] Use llvm::all_of (NFC)
Added:
Modified:
llvm/lib/ObjectYAML/YAML.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ObjectYAML/YAML.cpp b/llvm/lib/ObjectYAML/YAML.cpp
index 5dcb113d3395b..54e8c627d5a12 100644
--- a/llvm/lib/ObjectYAML/YAML.cpp
+++ b/llvm/lib/ObjectYAML/YAML.cpp
@@ -30,9 +30,8 @@ StringRef yaml::ScalarTraits<yaml::BinaryRef>::input(StringRef Scalar, void *,
return "BinaryRef hex string must contain an even number of nybbles.";
// TODO: Can we improve YAMLIO to permit a more accurate diagnostic here?
// (e.g. a caret pointing to the offending character).
- for (unsigned I = 0, N = Scalar.size(); I != N; ++I)
- if (!llvm::isHexDigit(Scalar[I]))
- return "BinaryRef hex string must contain only hex digits.";
+ if (!llvm::all_of(Scalar, llvm::isHexDigit))
+ return "BinaryRef hex string must contain only hex digits.";
Val = yaml::BinaryRef(Scalar);
return {};
}
More information about the llvm-commits
mailing list