Skip to content

Conversation

Keenuts
Copy link
Contributor

@Keenuts Keenuts commented Sep 11, 2025

Follow up to #157841, replacing the C-array with std::array so iterators can be used.

Follow up to llvm#157841, replacing the C-array with std::array
so iterators can be used.
@Keenuts Keenuts requested a review from erichkeane September 11, 2025 11:50
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Sep 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 11, 2025

@llvm/pr-subscribers-clang

Author: Nathan Gauër (Keenuts)

Changes

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 --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; });
   }
 };
 

@Keenuts Keenuts merged commit 64d5e6c into llvm:main Sep 15, 2025
9 checks passed
@Keenuts Keenuts deleted the replace-array branch September 15, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants