r278448 - Remove unused and undesirable reference from BindingDecl to DecompositionDecl.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 17:53:41 PDT 2016
Author: rsmith
Date: Thu Aug 11 19:53:41 2016
New Revision: 278448
URL: http://llvm.org/viewvc/llvm-project?rev=278448&view=rev
Log:
Remove unused and undesirable reference from BindingDecl to DecompositionDecl.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=278448&r1=278447&r2=278448&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Aug 11 19:53:41 2016
@@ -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.
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=278448&r1=278447&r2=278448&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Aug 11 19:53:41 2016
@@ -2309,13 +2309,12 @@ StaticAssertDecl *StaticAssertDecl::Crea
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() {}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=278448&r1=278447&r2=278448&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Aug 11 19:53:41 2016
@@ -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);
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=278448&r1=278447&r2=278448&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Aug 11 19:53:41 2016
@@ -791,7 +791,7 @@ Sema::ActOnDecompositionDeclarator(Scope
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);
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=278448&r1=278447&r2=278448&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Aug 11 19:53:41 2016
@@ -599,13 +599,7 @@ TemplateDeclInstantiator::VisitTypeAlias
}
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());
}
More information about the cfe-commits
mailing list