[llvm-branch-commits] [clang] cbc9b92 - [clang] Persist Attr::IsPackExpansion into the PCH
Haojian Wu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 10 02:39:37 PDT 2020
Author: Nathan Ridge
Date: 2020-06-10T11:34:30+02:00
New Revision: cbc9b92df4582617314b08d1ecef41d355733874
URL: https://github.com/llvm/llvm-project/commit/cbc9b92df4582617314b08d1ecef41d355733874
DIFF: https://github.com/llvm/llvm-project/commit/cbc9b92df4582617314b08d1ecef41d355733874.diff
LOG: [clang] Persist Attr::IsPackExpansion into the PCH
Summary: Fixes https://github.com/clangd/clangd/issues/309
Subscribers: ilya-biryukov, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D77194
(cherry picked from commit 8b3b7556e9ab6084e9fd337d64dac1c165867d32)
Added:
clang/test/PCH/cxx-attrs-packexpansion.cpp
Modified:
clang/utils/TableGen/ClangAttrEmitter.cpp
Removed:
################################################################################
diff --git a/clang/test/PCH/cxx-attrs-packexpansion.cpp b/clang/test/PCH/cxx-attrs-packexpansion.cpp
new file mode 100644
index 000000000000..6d292ec1e3e0
--- /dev/null
+++ b/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<typename T, typename... Types>
+struct static_variant {
+ alignas(Types...) T storage[10];
+};
+
+#else
+
+struct A {
+ static_variant<int> a;
+};
+struct B {
+ static_variant<A> _b;
+};
+
+#endif
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 4c3742c8e339..2fce9d428137 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2825,6 +2825,7 @@ void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
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) {
@@ -2840,6 +2841,7 @@ void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
if (R.isSubClassOf(InhClass))
OS << " cast<InheritableAttr>(New)->setInherited(isInherited);\n";
OS << " New->setImplicit(isImplicit);\n";
+ OS << " New->setPackExpansion(isPackExpansion);\n";
OS << " break;\n";
OS << " }\n";
}
@@ -2866,6 +2868,7 @@ void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
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);
More information about the llvm-branch-commits
mailing list