[clang] dd1c99b - [TableGen] Fix a warning

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 7 13:12:47 PST 2024


Author: Kazu Hirata
Date: 2024-11-07T13:12:40-08:00
New Revision: dd1c99bac4dc1d5ceeadc79dd31fa12f3e615f18

URL: https://github.com/llvm/llvm-project/commit/dd1c99bac4dc1d5ceeadc79dd31fa12f3e615f18
DIFF: https://github.com/llvm/llvm-project/commit/dd1c99bac4dc1d5ceeadc79dd31fa12f3e615f18.diff

LOG: [TableGen] Fix a warning

This patch fixes:

  clang/utils/TableGen/ClangAttrEmitter.cpp:3869:51: error: captured
  structured bindings are a C++20 extension
  [-Werror,-Wc++20-extensions]

Added: 
    

Modified: 
    clang/utils/TableGen/ClangAttrEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 932cf25f6a7c26..b450989aeeddca 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -3864,9 +3864,10 @@ void EmitClangAttrSpellingListIndex(const RecordKeeper &Records,
       OS << "    if (";
       if (Names.size() > 1) {
         SmallVector<StringRef, 6> SameLenNames;
+        StringRef FSName = FS.name();
         llvm::copy_if(
             Names, std::back_inserter(SameLenNames),
-            [&](StringRef N) { return N.size() == FS.name().size(); });
+            [&](StringRef N) { return N.size() == FSName.size(); });
 
         if (SameLenNames.size() == 1) {
           OS << "Name.size() == " << FS.name().size() << " && ";


        


More information about the cfe-commits mailing list