[PATCH] D77194: [clang] Persist Attr::IsPackExpansion into the serialized AST
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77194/new/ https://reviews.llvm.org/D77194 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D77194: [clang] Persist Attr::IsPackExpansion into the serialized AST
kadircet accepted this revision. kadircet added a comment. This revision is now accepted and ready to land. thanks LGTM! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77194/new/ https://reviews.llvm.org/D77194 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D77194: [clang] Persist Attr::IsPackExpansion into the serialized AST
nridge updated this revision to Diff 254712. nridge added a comment. Add test Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77194/new/ https://reviews.llvm.org/D77194 Files: clang/test/PCH/cxx-attrs-packexpansion.cpp clang/utils/TableGen/ClangAttrEmitter.cpp Index: clang/utils/TableGen/ClangAttrEmitter.cpp === --- clang/utils/TableGen/ClangAttrEmitter.cpp +++ clang/utils/TableGen/ClangAttrEmitter.cpp @@ -2911,6 +2911,7 @@ if (R.isSubClassOf(InhClass)) OS << "bool isInherited = Record.readInt();\n"; OS << "bool isImplicit = Record.readInt();\n"; +OS << "bool isPackExpansion = Record.readInt();\n"; ArgRecords = R.getValueAsListOfDefs("Args"); Args.clear(); for (const auto *Arg : ArgRecords) { @@ -2926,6 +2927,7 @@ if (R.isSubClassOf(InhClass)) OS << "cast(New)->setInherited(isInherited);\n"; OS << "New->setImplicit(isImplicit);\n"; +OS << "New->setPackExpansion(isPackExpansion);\n"; OS << "break;\n"; OS << " }\n"; } @@ -2952,6 +2954,7 @@ if (R.isSubClassOf(InhClass)) OS << "Record.push_back(SA->isInherited());\n"; OS << "Record.push_back(A->isImplicit());\n"; +OS << "Record.push_back(A->isPackExpansion());\n"; for (const auto *Arg : Args) createArgument(*Arg, R.getName())->writePCHWrite(OS); Index: clang/test/PCH/cxx-attrs-packexpansion.cpp === --- /dev/null +++ clang/test/PCH/cxx-attrs-packexpansion.cpp @@ -0,0 +1,25 @@ +// Test this without pch. +// RUN: %clang_cc1 -include %s -emit-llvm -o - %s + +// Test with pch. +// RUN: %clang_cc1 -emit-pch -o %t %s +// RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s + +#ifndef HEADER +#define HEADER + +template +struct static_variant { +alignas(Types...) T storage[10]; +}; + +#else + +struct A { +static_variant a; +}; +struct B { +static_variant _b; +}; + +#endif Index: clang/utils/TableGen/ClangAttrEmitter.cpp === --- clang/utils/TableGen/ClangAttrEmitter.cpp +++ clang/utils/TableGen/ClangAttrEmitter.cpp @@ -2911,6 +2911,7 @@ if (R.isSubClassOf(InhClass)) OS << "bool isInherited = Record.readInt();\n"; OS << "bool isImplicit = Record.readInt();\n"; +OS << "bool isPackExpansion = Record.readInt();\n"; ArgRecords = R.getValueAsListOfDefs("Args"); Args.clear(); for (const auto *Arg : ArgRecords) { @@ -2926,6 +2927,7 @@ if (R.isSubClassOf(InhClass)) OS << "cast(New)->setInherited(isInherited);\n"; OS << "New->setImplicit(isImplicit);\n"; +OS << "New->setPackExpansion(isPackExpansion);\n"; OS << "break;\n"; OS << " }\n"; } @@ -2952,6 +2954,7 @@ if (R.isSubClassOf(InhClass)) OS << "Record.push_back(SA->isInherited());\n"; OS << "Record.push_back(A->isImplicit());\n"; +OS << "Record.push_back(A->isPackExpansion());\n"; for (const auto *Arg : Args) createArgument(*Arg, R.getName())->writePCHWrite(OS); Index: clang/test/PCH/cxx-attrs-packexpansion.cpp === --- /dev/null +++ clang/test/PCH/cxx-attrs-packexpansion.cpp @@ -0,0 +1,25 @@ +// Test this without pch. +// RUN: %clang_cc1 -include %s -emit-llvm -o - %s + +// Test with pch. +// RUN: %clang_cc1 -emit-pch -o %t %s +// RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s + +#ifndef HEADER +#define HEADER + +template +struct static_variant { +alignas(Types...) T storage[10]; +}; + +#else + +struct A { +static_variant a; +}; +struct B { +static_variant _b; +}; + +#endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D77194: [clang] Persist Attr::IsPackExpansion into the serialized AST
kadircet added a comment. oh wow! thanks for looking into this. Looking at the history, it seems like an oversight. The patch that introduced packexpansion bit: https://github.com/llvm/llvm-project/commit/44c247f0f009eec70a193335c8a353d6f8602bfd. it didn't add that field to pchattr serialization code unfortunately. (another example on isimplicit, which adds attr to record https://github.com/llvm/llvm-project/commit/36a5350e51a6dcfae424332aaa266a1e5bfb8c4f) Could you add tests though ? Something similar to clang/test/PCH/attrs-PR8406.c should be enough. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77194/new/ https://reviews.llvm.org/D77194 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D77194: [clang] Persist Attr::IsPackExpansion into the serialized AST
kadircet added a comment. also please update the commit message to mention "PCH" rather than "serialized ast". Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77194/new/ https://reviews.llvm.org/D77194 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D77194: [clang] Persist Attr::IsPackExpansion into the serialized AST
nridge created this revision. Herald added subscribers: cfe-commits, usaxena95, kadircet, ilya-biryukov. Herald added a project: clang. Fixes https://github.com/clangd/clangd/issues/309 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D77194 Files: clang/utils/TableGen/ClangAttrEmitter.cpp Index: clang/utils/TableGen/ClangAttrEmitter.cpp === --- clang/utils/TableGen/ClangAttrEmitter.cpp +++ clang/utils/TableGen/ClangAttrEmitter.cpp @@ -2911,6 +2911,7 @@ if (R.isSubClassOf(InhClass)) OS << "bool isInherited = Record.readInt();\n"; OS << "bool isImplicit = Record.readInt();\n"; +OS << "bool isPackExpansion = Record.readInt();\n"; ArgRecords = R.getValueAsListOfDefs("Args"); Args.clear(); for (const auto *Arg : ArgRecords) { @@ -2926,6 +2927,7 @@ if (R.isSubClassOf(InhClass)) OS << "cast(New)->setInherited(isInherited);\n"; OS << "New->setImplicit(isImplicit);\n"; +OS << "New->setPackExpansion(isPackExpansion);\n"; OS << "break;\n"; OS << " }\n"; } @@ -2952,6 +2954,7 @@ if (R.isSubClassOf(InhClass)) OS << "Record.push_back(SA->isInherited());\n"; OS << "Record.push_back(A->isImplicit());\n"; +OS << "Record.push_back(A->isPackExpansion());\n"; for (const auto *Arg : Args) createArgument(*Arg, R.getName())->writePCHWrite(OS); Index: clang/utils/TableGen/ClangAttrEmitter.cpp === --- clang/utils/TableGen/ClangAttrEmitter.cpp +++ clang/utils/TableGen/ClangAttrEmitter.cpp @@ -2911,6 +2911,7 @@ if (R.isSubClassOf(InhClass)) OS << "bool isInherited = Record.readInt();\n"; OS << "bool isImplicit = Record.readInt();\n"; +OS << "bool isPackExpansion = Record.readInt();\n"; ArgRecords = R.getValueAsListOfDefs("Args"); Args.clear(); for (const auto *Arg : ArgRecords) { @@ -2926,6 +2927,7 @@ if (R.isSubClassOf(InhClass)) OS << "cast(New)->setInherited(isInherited);\n"; OS << "New->setImplicit(isImplicit);\n"; +OS << "New->setPackExpansion(isPackExpansion);\n"; OS << "break;\n"; OS << " }\n"; } @@ -2952,6 +2954,7 @@ if (R.isSubClassOf(InhClass)) OS << "Record.push_back(SA->isInherited());\n"; OS << "Record.push_back(A->isImplicit());\n"; +OS << "Record.push_back(A->isPackExpansion());\n"; for (const auto *Arg : Args) createArgument(*Arg, R.getName())->writePCHWrite(OS); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits