diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-15 01:33:41 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-15 01:33:41 +0000 |
commit | da383637848d8583f8fcf3c7ab6323cd32edb4d1 (patch) | |
tree | 4d885c0a704da0aa65c224977143657e01329285 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 5ec9c58f1394e1232972604d765238594d48fce1 (diff) | |
download | bcm5719-llvm-da383637848d8583f8fcf3c7ab6323cd32edb4d1.tar.gz bcm5719-llvm-da383637848d8583f8fcf3c7ab6323cd32edb4d1.zip |
P0217R3: code generation support for decomposition declarations.
llvm-svn: 278642
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index e0cb07b98dd..037b1351c0f 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -87,6 +87,7 @@ void CodeGenFunction::EmitDecl(const Decl &D) { case Decl::UsingShadow: case Decl::ConstructorUsingShadow: case Decl::ObjCTypeParam: + case Decl::Binding: llvm_unreachable("Declaration should not be in declstmts!"); case Decl::Function: // void X(); case Decl::Record: // struct/union/class X; @@ -119,10 +120,13 @@ void CodeGenFunction::EmitDecl(const Decl &D) { const VarDecl &VD = cast<VarDecl>(D); assert(VD.isLocalVarDecl() && "Should not see file-scope variables inside a function!"); - return EmitVarDecl(VD); + EmitVarDecl(VD); + if (auto *DD = dyn_cast<DecompositionDecl>(&VD)) + for (auto *B : DD->bindings()) + if (auto *HD = B->getHoldingVar()) + EmitVarDecl(*HD); + return; } - case Decl::Binding: - return CGM.ErrorUnsupported(&D, "structured binding"); case Decl::OMPDeclareReduction: return CGM.EmitOMPDeclareReduction(cast<OMPDeclareReductionDecl>(&D), this); |