[AST] Store regular ValueDecl* in BindingDecl (NFC)

We were always storing a regular ValueDecl* as decomposition declaration
and haven't been using the opportunity to initialize it lazily.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D99455
This commit is contained in:
Aaron Puchert 2021-05-20 16:28:46 +02:00
parent 0ae3c1d4d7
commit a5c2ec96e5
2 changed files with 2 additions and 8 deletions

View File

@ -3827,7 +3827,7 @@ public:
/// DecompositionDecl of type 'int (&)[3]'.
class BindingDecl : public ValueDecl {
/// The declaration that this binding binds to part of.
LazyDeclPtr Decomp;
ValueDecl *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
@ -3853,7 +3853,7 @@ public:
/// Get the decomposition declaration that this binding represents a
/// decomposition of.
ValueDecl *getDecomposedDecl() const;
ValueDecl *getDecomposedDecl() const { return Decomp; }
/// Get the variable (if any) that holds the value of evaluating the binding.
/// Only present for user-defined bindings for tuple-like types.

View File

@ -3179,12 +3179,6 @@ BindingDecl *BindingDecl::CreateDeserialized(ASTContext &C, unsigned ID) {
return new (C, ID) BindingDecl(nullptr, SourceLocation(), nullptr);
}
ValueDecl *BindingDecl::getDecomposedDecl() const {
ExternalASTSource *Source =
Decomp.isOffset() ? getASTContext().getExternalSource() : nullptr;
return cast_or_null<ValueDecl>(Decomp.get(Source));
}
VarDecl *BindingDecl::getHoldingVar() const {
Expr *B = getBinding();
if (!B)