Author: Aaron Puchert Date: 2021-05-20T16:28:58+02:00 New Revision: a5c2ec96e5f9f14b31b705e40bcb267257612316
URL: https://github.com/llvm/llvm-project/commit/a5c2ec96e5f9f14b31b705e40bcb267257612316 DIFF: https://github.com/llvm/llvm-project/commit/a5c2ec96e5f9f14b31b705e40bcb267257612316.diff LOG: [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 Added: Modified: clang/include/clang/AST/DeclCXX.h clang/lib/AST/DeclCXX.cpp Removed: ################################################################################ diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index c3c326b50397..07c4eb261aac 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -3827,7 +3827,7 @@ class StaticAssertDecl : public Decl { /// 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 @@ class BindingDecl : public ValueDecl { /// 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. diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index 3d1faee0ab11..2bb7acc21a93 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -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) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits