Author: Nathan Ridge Date: 2020-04-05T23:32:03-04:00 New Revision: 8b3b7556e9ab6084e9fd337d64dac1c165867d32
URL: https://github.com/llvm/llvm-project/commit/8b3b7556e9ab6084e9fd337d64dac1c165867d32 DIFF: https://github.com/llvm/llvm-project/commit/8b3b7556e9ab6084e9fd337d64dac1c165867d32.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 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 e9f91c685ee4..486799eb81ba 100644 --- a/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -2911,6 +2911,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) { @@ -2926,6 +2927,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"; } @@ -2952,6 +2954,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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits