summaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTWriterDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-08-12 02:21:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-08-12 02:21:25 +0000
commitbcd0b9f9023b35616284426cc1e049c0a1232460 (patch)
treedbc18855aaf0f5fa3334dbdc12ea6e4744032a1a /lib/Serialization/ASTWriterDecl.cpp
parenteb66e2ffe787658976e133ab9a69d0e9a9cf3ac5 (diff)
downloadclang-bcd0b9f9023b35616284426cc1e049c0a1232460.tar.gz
P0217R3: serialization/deserialization support for c++17 decomposition declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278460 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r--lib/Serialization/ASTWriterDecl.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp
index 8205d60ca7..158123b1c0 100644
--- a/lib/Serialization/ASTWriterDecl.cpp
+++ b/lib/Serialization/ASTWriterDecl.cpp
@@ -96,6 +96,8 @@ namespace clang {
void VisitVarDecl(VarDecl *D);
void VisitImplicitParamDecl(ImplicitParamDecl *D);
void VisitParmVarDecl(ParmVarDecl *D);
+ void VisitDecompositionDecl(DecompositionDecl *D);
+ void VisitBindingDecl(BindingDecl *D);
void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D);
void VisitTemplateDecl(TemplateDecl *D);
void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D);
@@ -941,8 +943,7 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
D->getFirstDecl() == D->getMostRecentDecl() &&
D->getInitStyle() == VarDecl::CInit &&
D->getInit() == nullptr &&
- !isa<ParmVarDecl>(D) &&
- !isa<VarTemplateSpecializationDecl>(D) &&
+ D->getKind() == Decl::Var &&
!D->isInline() &&
!D->isConstexpr() &&
!D->isInitCapture() &&
@@ -1005,6 +1006,22 @@ void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
"PARM_VAR_DECL can't be static data member");
}
+void ASTDeclWriter::VisitDecompositionDecl(DecompositionDecl *D) {
+ // Record the number of bindings first to simplify deserialization.
+ Record.push_back(D->bindings().size());
+
+ VisitVarDecl(D);
+ for (auto *B : D->bindings())
+ Record.AddDeclRef(B);
+ Code = serialization::DECL_DECOMPOSITION;
+}
+
+void ASTDeclWriter::VisitBindingDecl(BindingDecl *D) {
+ VisitValueDecl(D);
+ Record.AddStmt(D->getBinding());
+ Code = serialization::DECL_BINDING;
+}
+
void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
VisitDecl(D);
Record.AddStmt(D->getAsmString());