[clang] [NFC][clang] replace a C-array with std::array (PR #158047)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 11 04:51:19 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Nathan Gauër (Keenuts)
<details>
<summary>Changes</summary>
Follow up to #<!-- -->157841, replacing the C-array with std::array so iterators can be used.
---
Full diff: https://github.com/llvm/llvm-project/pull/158047.diff
1 Files Affected:
- (modified) clang/utils/TableGen/ClangAttrEmitter.cpp (+2-6)
``````````diff
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 2e2f32a7a1cb1..cc558722ed6e9 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -5163,7 +5163,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 {
@@ -5211,11 +5211,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.size() != 0; });
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/158047
More information about the cfe-commits
mailing list