[clang] 64d5e6c - [NFC][clang] replace a C-array with std::array (#158047)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 15 06:52:31 PDT 2025
Author: Nathan Gauër
Date: 2025-09-15T15:52:27+02:00
New Revision: 64d5e6c4b35be1840bfffe57a24db2b9d18d65fe
URL: https://github.com/llvm/llvm-project/commit/64d5e6c4b35be1840bfffe57a24db2b9d18d65fe
DIFF: https://github.com/llvm/llvm-project/commit/64d5e6c4b35be1840bfffe57a24db2b9d18d65fe.diff
LOG: [NFC][clang] replace a C-array with std::array (#158047)
Follow up to #157841, replacing the C-array with std::array so iterators
can be used.
---------
Co-authored-by: Nikolas Klauser <nikolasklauser at berlin.de>
Added:
Modified:
clang/utils/TableGen/ClangAttrEmitter.cpp
Removed:
################################################################################
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index a4e4de32ba53f..1342e1a6ffb5b 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -5169,7 +5169,7 @@ enum class SpellingKind : size_t {
static const size_t NumSpellingKinds = (size_t)SpellingKind::NumSpellingKinds;
class SpellingList {
- std::vector<std::string> Spellings[NumSpellingKinds];
+ std::array<std::vector<std::string>, NumSpellingKinds> Spellings;
public:
ArrayRef<std::string> operator[](SpellingKind K) const {
@@ -5217,11 +5217,7 @@ class SpellingList {
}
bool hasSpelling() const {
- for (size_t Kind = 0; Kind < NumSpellingKinds; ++Kind) {
- if (Spellings[Kind].size() > 0)
- return true;
- }
- return false;
+ return llvm::any_of(Spellings, [](const auto &L) { return !L.empty(); });
}
};
More information about the cfe-commits
mailing list