forked from OSchip/llvm-project
[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:
parent
0ae3c1d4d7
commit
a5c2ec96e5
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue