Lines Matching +full:allocator +full:-
2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
38 // CC-OFFNXT(G.PRE.09) code gen
39 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
40 #define DECLARE_CLASSES(type, className) class className; // CC-OFF(G.PRE.02) name part
61 // NOLINTBEGIN(misc-non-private-member-variables-in-classes)
67 // NOLINTEND(misc-non-private-member-variables-in-classes)
84 // CC-OFFNXT(G.PRE.06) solid logic
85 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
89 /* CC-OFFNXT(G.PRE.05) The macro is used to generate a function. Return is needed*/ \
90 return Type() == ScopeType::scopeType; /* CC-OFF(G.PRE.02) name part */ \
92 /* CC-OFFNXT(G.PRE.02) name part */ \
96 /* CC-OFFNXT(G.PRE.05) The macro is used to generate a function. Return is needed*/ \
97 return reinterpret_cast<className *>(this); /* CC-OFF(G.PRE.02) name part */ \
102 /* CC-OFFNXT(G.PRE.05) The macro is used to generate a function. Return is needed */ \
224 …Variable *AddDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extensio… in AddDecl() argument
227 auto options = decl->IsTypeAliasDecl() ? varbinder::ResolveBindingOptions::TYPE_ALIASES in AddDecl()
229 return AddBinding(allocator, FindLocal(decl->Name(), options), decl, extension); in AddDecl()
232 …Variable *AddTsDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extens… in AddTsDecl() argument
235 …return AddBinding(allocator, FindLocal(decl->Name(), ResolveBindingOptions::ALL), decl, extension); in AddTsDecl()
239 T *NewDecl(ArenaAllocator *allocator, Args &&...args);
242 VariableType *AddDecl(ArenaAllocator *allocator, util::StringView name, VariableFlags flags);
245 …static VariableType *CreateVar(ArenaAllocator *allocator, util::StringView name, VariableFlags fla…
249 Variable *PropagateBinding(ArenaAllocator *allocator, util::StringView name, Args &&...args);
261 ArenaMap<util::StringView, Variable *> OrderedBindings(ArenaAllocator *allocator) const in OrderedBindings() argument
263 ArenaMap<util::StringView, Variable *> result(allocator->Adapter()); in OrderedBindings()
268 … virtual Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
289 explicit Scope(ArenaAllocator *allocator, Scope *parent) in Scope() argument
290 : parent_(parent), decls_(allocator->Adapter()), bindings_(allocator->Adapter()) in Scope()
294 explicit Scope(ArenaAllocator *allocator, Scope *parent, ScopeFlags flags) in Scope() argument
295 … : parent_(parent), decls_(allocator->Adapter()), bindings_(allocator->Adapter()), flags_(flags) in Scope()
300 * @return true - if the variable is shadowed
301 * false - otherwise
306 * @return true - if the variable is shadowed
307 * false - otherwise
311 Variable *AddLocal(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
314 Variable *AddLocalVar(ArenaAllocator *allocator, Decl *newDecl);
327 // iter will be the EXACT type of scope with cv-qualifiers in FindImpl()
330 if (iter->IsFunctionParamScope()) { in FindImpl()
331 auto *const v = iter->FindLocal(name, options); in FindImpl()
338 const auto *const funcVariableScope = iter->AsFunctionParamScope()->GetFunctionScope(); in FindImpl()
340 if (funcVariableScope != nullptr && funcVariableScope->NeedLexEnv()) { in FindImpl()
344 iter = iter->Parent(); in FindImpl()
348 auto *const v = iter->FindLocal(name, options); in FindImpl()
354 if (iter->IsVariableScope()) { in FindImpl()
357 if (iter->AsVariableScope()->NeedLexEnv()) { in FindImpl()
362 iter = iter->Parent(); in FindImpl()
406 explicit VariableScope(ArenaAllocator *allocator, Scope *parent) : Scope(allocator, parent) {} in VariableScope() argument
409 Variable *AddVar(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
412 Variable *AddFunction(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
416 …Variable *AddTSBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, Variab…
419 Variable *AddLexical(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
421 // NOLINTBEGIN(misc-non-private-member-variables-in-classes)
424 // NOLINTEND(misc-non-private-member-variables-in-classes)
444 …std::tuple<ParameterDecl *, ir::AstNode *, Variable *> AddParamDecl(ArenaAllocator *allocator, ir:…
447 explicit ParamScope(ArenaAllocator *allocator, Scope *parent) in ParamScope() argument
448 : Scope(allocator, parent), params_(allocator->Adapter()) in ParamScope()
452 …Variable *AddParam(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, VariableFl…
454 // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
462 …explicit FunctionParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, pare… in FunctionParamScope() argument
479 void BindName(ArenaAllocator *allocator, util::StringView name);
486 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
501 …explicit ScopeWithParamScope(ArenaAllocator *allocator, Scope *parent) : E(allocator, parent), par… in ScopeWithParamScope() argument
508 this->MergeBindings(paramScope->Bindings()); in BindParamScope()
513 ASSERT(this->Parent() == paramScope); in AssignParamScope()
528 // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes)
534 explicit LocalScope(ArenaAllocator *allocator, Scope *parent) : Scope(allocator, parent) {} in LocalScope() argument
535 …explicit LocalScope(ArenaAllocator *allocator, Scope *parent, ScopeFlags flags) : Scope(allocator,… in LocalScope() argument
542 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
548 explicit LocalScopeWithTypeAlias(ArenaAllocator *allocator, Scope *parent) in LocalScopeWithTypeAlias() argument
549 : LocalScope(allocator, parent), in LocalScopeWithTypeAlias()
550 typeAliasScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::TYPE_ALIAS)) in LocalScopeWithTypeAlias()
553 explicit LocalScopeWithTypeAlias(ArenaAllocator *allocator, Scope *parent, ScopeFlags flags) in LocalScopeWithTypeAlias() argument
554 : LocalScope(allocator, parent, flags), in LocalScopeWithTypeAlias()
555 typeAliasScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::TYPE_ALIAS)) in LocalScopeWithTypeAlias()
561 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
580 explicit FunctionScope(ArenaAllocator *allocator, Scope *parent) in FunctionScope() argument
581 : ScopeWithParamScope(allocator, parent), in FunctionScope()
582 typeAliasScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::TYPE_ALIAS)) in FunctionScope()
618 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
629 explicit ClassScope(ArenaAllocator *allocator, Scope *parent) in ClassScope() argument
630 : LocalScopeWithTypeAlias(allocator, parent), in ClassScope()
631 … staticDeclScope_(allocator->New<LocalScope>(allocator, this, ScopeFlags::STATIC_DECL_SCOPE)), in ClassScope()
632 …staticFieldScope_(allocator->New<LocalScope>(allocator, staticDeclScope_, ScopeFlags::STATIC_FIELD… in ClassScope()
633 …staticMethodScope_(allocator->New<LocalScope>(allocator, staticFieldScope_, ScopeFlags::STATIC_MET… in ClassScope()
634 …instanceDeclScope_(allocator->New<LocalScope>(allocator, staticMethodScope_, ScopeFlags::DECL_SCOP… in ClassScope()
635 …instanceFieldScope_(allocator->New<LocalScope>(allocator, instanceDeclScope_, ScopeFlags::FIELD_SC… in ClassScope()
636 …instanceMethodScope_(allocator->New<LocalScope>(allocator, instanceFieldScope_, ScopeFlags::METHOD… in ClassScope()
712 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
762 …explicit AnnotationScope(ArenaAllocator *allocator, Scope *parent) : ClassScope(allocator, parent)… in AnnotationScope() argument
772 …explicit AnnotationParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, pa… in AnnotationParamScope() argument
779 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
785 …explicit CatchParamScope(ArenaAllocator *allocator, Scope *parent) : ParamScope(allocator, parent)… in CatchParamScope() argument
792 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
800 …explicit CatchScope(ArenaAllocator *allocator, Scope *parent) : ScopeWithParamScope(allocator, par… in CatchScope() argument
807 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
815 …explicit LoopDeclarationScope(ArenaAllocator *allocator, Scope *parent) : VariableScope(allocator,… in LoopDeclarationScope() argument
822 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, in AddBinding() argument
825 return AddLocal(allocator, currentVariable, newDecl, extension); in AddBinding()
837 void ConvertToVariableScope(ArenaAllocator *allocator);
848 explicit LoopScope(ArenaAllocator *allocator, Scope *parent) : VariableScope(allocator, parent) in LoopScope() argument
864 declScope_->loopScope_ = this; in BindDecls()
872 void ConvertToVariableScope(ArenaAllocator *allocator);
874 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl, in AddBinding() argument
877 return AddLocal(allocator, currentVariable, newDecl, extension); in AddBinding()
881 // NOLINTBEGIN(misc-non-private-member-variables-in-classes)
884 // NOLINTEND(misc-non-private-member-variables-in-classes)
889 explicit GlobalScope(ArenaAllocator *allocator) in GlobalScope() argument
890 : FunctionScope(allocator, nullptr), foreignBindings_(allocator->Adapter()) in GlobalScope()
892 auto *paramScope = allocator->New<FunctionParamScope>(allocator, this); in GlobalScope()
894 paramScope_->BindFunctionScope(this); in GlobalScope()
902 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
929 explicit ModuleScope(ArenaAllocator *allocator) in ModuleScope() argument
930 : GlobalScope(allocator), in ModuleScope()
931 allocator_(allocator), in ModuleScope()
932 imports_(allocator_->Adapter()), in ModuleScope()
933 exports_(allocator_->Adapter()), in ModuleScope()
934 localExports_(allocator_->Adapter()) in ModuleScope()
964 Variable *AddBinding(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl,
970 Variable *AddImport(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl);
979 Variable *VariableScope::AddVar(ArenaAllocator *allocator, Variable *currentVariable, Decl *newDecl) in AddVar() argument
982 …return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, VariableFlags::HOIST_VAR)).first-… in AddVar()
985 switch (currentVariable->Declaration()->Type()) { in AddVar()
987 currentVariable->Reset(newDecl, VariableFlags::HOIST_VAR); in AddVar()
1001 Variable *VariableScope::AddFunction(ArenaAllocator *allocator, Variable *currentVariable, Decl *ne… in AddFunction() argument
1007 return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, flags)).first->second; in AddFunction()
1014 switch (currentVariable->Declaration()->Type()) { in AddFunction()
1017 currentVariable->Reset(newDecl, VariableFlags::HOIST_VAR); in AddFunction()
1027 Variable *VariableScope::AddTSBinding(ArenaAllocator *allocator, [[maybe_unused]] Variable *current… in AddTSBinding() argument
1031 return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, flags)).first->second; in AddTSBinding()
1035 Variable *VariableScope::AddLexical(ArenaAllocator *allocator, Variable *currentVariable, Decl *new… in AddLexical() argument
1041 …return InsertBinding(newDecl->Name(), allocator->New<T>(newDecl, VariableFlags::NONE)).first->seco… in AddLexical()
1045 T *Scope::NewDecl(ArenaAllocator *allocator, Args &&...args) in NewDecl() argument
1047 T *decl = allocator->New<T>(std::forward<Args>(args)...); in NewDecl()
1054 VariableType *Scope::AddDecl(ArenaAllocator *allocator, util::StringView name, VariableFlags flags) in AddDecl() argument
1060 auto *decl = allocator->New<DeclType>(name); in AddDecl()
1061 auto *variable = allocator->New<VariableType>(decl, flags); in AddDecl()
1064 bindings_.insert({decl->Name(), variable}); in AddDecl()
1065 variable->SetScope(this); in AddDecl()
1071 VariableType *Scope::CreateVar(ArenaAllocator *allocator, util::StringView name, VariableFlags flag… in CreateVar() argument
1073 auto *decl = allocator->New<DeclType>(name); in CreateVar()
1074 auto *variable = allocator->New<VariableType>(decl, flags); in CreateVar()
1075 decl->BindNode(node); in CreateVar()
1080 Variable *Scope::PropagateBinding(ArenaAllocator *allocator, util::StringView name, Args &&...args) in PropagateBinding() argument
1084 … return bindings_.insert({name, allocator->New<T>(std::forward<Args>(args)...)}).first->second; in PropagateBinding()
1087 res->second->Reset(std::forward<Args>(args)...); in PropagateBinding()
1088 return res->second; in PropagateBinding()