diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-12 00:53:41 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-12 00:53:41 +0000 |
| commit | 32cb8c9b61858cdcdb91f9acdb267e2ce5d0f3f5 (patch) | |
| tree | 97ba871782805e18f044f8003d1048e55eaa63b9 | |
| parent | dca60b495822a869c08b9973e4c485a83e8b6c0e (diff) | |
| download | bcm5719-llvm-32cb8c9b61858cdcdb91f9acdb267e2ce5d0f3f5.tar.gz bcm5719-llvm-32cb8c9b61858cdcdb91f9acdb267e2ce5d0f3f5.zip | |
Remove unused and undesirable reference from BindingDecl to DecompositionDecl.
llvm-svn: 278448
| -rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 14 | ||||
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 8 |
5 files changed, 10 insertions, 28 deletions
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index baeafe6667a..48ada29bb6d 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -3385,28 +3385,20 @@ public: class BindingDecl : public ValueDecl { void anchor() override; - DecompositionDecl *Decomp; - /// The binding represented by this declaration. References to this /// declaration are effectively equivalent to this expression (except /// that it is only evaluated once at the point of declaration of the /// binding). Expr *Binding; - BindingDecl(DeclContext *DC, DecompositionDecl *Decomp, SourceLocation IdLoc, - IdentifierInfo *Id) - : ValueDecl(Decl::Binding, DC, IdLoc, Id, QualType()), Decomp(Decomp), - Binding(nullptr) {} + BindingDecl(DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id) + : ValueDecl(Decl::Binding, DC, IdLoc, Id, QualType()), Binding(nullptr) {} public: static BindingDecl *Create(ASTContext &C, DeclContext *DC, - DecompositionDecl *Decomp, SourceLocation IdLoc, - IdentifierInfo *Id); + SourceLocation IdLoc, IdentifierInfo *Id); static BindingDecl *CreateDeserialized(ASTContext &C, unsigned ID); - void setDecompositionDecl(DecompositionDecl *DD) { Decomp = DD; } - DecompositionDecl *getDecompositionDecl() const { return Decomp; } - /// Get the expression to which this declaration is bound. This may be null /// in two different cases: while parsing the initializer for the /// decomposition declaration, and when the initializer is type-dependent. diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 772ce10661e..14df382697e 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -2309,13 +2309,12 @@ StaticAssertDecl *StaticAssertDecl::CreateDeserialized(ASTContext &C, void BindingDecl::anchor() {} BindingDecl *BindingDecl::Create(ASTContext &C, DeclContext *DC, - DecompositionDecl *Decomp, SourceLocation IdLoc, IdentifierInfo *Id) { - return new (C, DC) BindingDecl(DC, Decomp, IdLoc, Id); + return new (C, DC) BindingDecl(DC, IdLoc, Id); } BindingDecl *BindingDecl::CreateDeserialized(ASTContext &C, unsigned ID) { - return new (C, ID) BindingDecl(nullptr, nullptr, SourceLocation(), nullptr); + return new (C, ID) BindingDecl(nullptr, SourceLocation(), nullptr); } void DecompositionDecl::anchor() {} diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 6445dac7db0..4a68d60a1e2 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -6107,12 +6107,9 @@ NamedDecl *Sema::ActOnVariableDeclarator( NewVD = cast<VarDecl>(Res.get()); AddToScope = false; } else if (D.isDecompositionDeclarator()) { - auto *NewDD = DecompositionDecl::Create(Context, DC, D.getLocStart(), - D.getIdentifierLoc(), R, TInfo, - SC, Bindings); - for (auto *B : Bindings) - B->setDecompositionDecl(NewDD); - NewVD = NewDD; + NewVD = DecompositionDecl::Create(Context, DC, D.getLocStart(), + D.getIdentifierLoc(), R, TInfo, SC, + Bindings); } else NewVD = VarDecl::Create(Context, DC, D.getLocStart(), D.getIdentifierLoc(), II, R, TInfo, SC); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index cecbee13eef..a1ef6b408fc 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -791,7 +791,7 @@ Sema::ActOnDecompositionDeclarator(Scope *S, Declarator &D, Diag(Old->getLocation(), diag::note_previous_definition); } - auto *BD = BindingDecl::Create(Context, DC, nullptr, B.NameLoc, B.Name); + auto *BD = BindingDecl::Create(Context, DC, B.NameLoc, B.Name); PushOnScopeChains(BD, S, true); Bindings.push_back(BD); ParsingInitForAutoVars.insert(BD); diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 5c8aa7287ea..208afa6de60 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -599,13 +599,7 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { } Decl *TemplateDeclInstantiator::VisitBindingDecl(BindingDecl *D) { - auto *NewDD = - dyn_cast_or_null<DecompositionDecl>(SemaRef.FindInstantiatedDecl( - D->getLocation(), D->getDecompositionDecl(), TemplateArgs)); - if (!NewDD) - return nullptr; - - return BindingDecl::Create(SemaRef.Context, Owner, NewDD, D->getLocation(), + return BindingDecl::Create(SemaRef.Context, Owner, D->getLocation(), D->getIdentifier()); } |

