Lines Matching defs:scope

16 #include "flang/Semantics/scope.h"
73 SubprogramSymbolCollector(const Symbol &symbol, const Scope &scope)
74 : symbol_{symbol}, scope_{scope} {}
110 void ModFileWriter::WriteAll(const Scope &scope) {
111 for (const auto &child : scope.children()) {
116 void ModFileWriter::WriteOne(const Scope &scope) {
117 if (scope.kind() == Scope::Kind::Module) {
118 auto *symbol{scope.symbol()};
122 WriteAll(scope); // write out submodules
148 PutSymbols(DEREF(symbol.scope()),
155 PutSymbols(DEREF(ref->scope()), &additionalModules);
176 PutSymbols(DEREF(symbol.scope()), /*hermeticModules=*/nullptr);
225 SourceOrderedSymbolSet &set, const Symbol &symbol, const Scope &scope) {
244 if (symbol.scope()) {
245 HarvestSymbolsNeededFromOtherModules(set, *symbol.scope());
251 if (dtSym.scope()) {
252 HarvestSymbolsNeededFromOtherModules(set, *dtSym.scope());
260 if (IsNamedConstant(symbol) || scope.IsDerivedType()) {
268 if (proc->init() && *proc->init() && scope.IsDerivedType()) {
274 HarvestSymbolsNeededFromOtherModules(set, *dummy, scope);
278 HarvestSymbolsNeededFromOtherModules(set, subp->result(), scope);
284 SourceOrderedSymbolSet &set, const Scope &scope) {
285 for (const auto &[_, symbol] : scope) {
286 HarvestSymbolsNeededFromOtherModules(set, *symbol, scope);
290 void ModFileWriter::PrepareRenamings(const Scope &scope) {
291 // Identify use-associated symbols already in scope under some name
293 for (const auto &[name, symbolRef] : scope) {
304 HarvestSymbolsNeededFromOtherModules(symbolsNeeded, scope);
306 // to their names in this scope, creating those new names when needed.
313 if (!sMod || sMod == &scope) {
321 if (const Symbol * found{scope.FindSymbol(s->name())}) {
323 continue; // available in scope
335 rename = scope.context().SaveTempName(
340 // Symbol is used in this scope but not visible under its name
356 // Put out the visible symbols from scope.
358 const Scope &scope, UnorderedSymbolSet *hermeticModules) {
363 PrepareRenamings(scope);
365 CollectSymbols(scope, sorted, uses, modules);
390 for (const auto &set : scope.equivalenceSets()) {
408 const auto &scope{DEREF(typeSymbol.scope())};
412 SymbolVector symbols{scope.GetSymbols()};
422 auto iter{scope.find(name)};
423 if (iter != scope.end()) {
431 // Emit remaining symbols from the type's scope
438 CHECK(scope.IsDerivedType());
540 const Symbol &typeSymbol, const Scope *scope) {
543 PutDECStructure(typeSymbol, scope);
578 const Symbol &typeSymbol, const Scope *scope) {
582 if (!scope && context_.IsTempName(typeSymbol.name().ToString())) {
590 if (scope && scope->kind() == Scope::Kind::DerivedType) {
594 for (const auto &ref : scope->GetSymbols()) {
756 const Scope &scope{
757 details.entryScope() ? *details.entryScope() : DEREF(symbol.scope())};
758 SubprogramSymbolCollector collector{symbol, scope};
849 // Collect the symbols of this scope sorted by their original order, not name.
851 void CollectSymbols(const Scope &scope, SymbolVector &sorted,
854 auto symbols{scope.GetSymbols()};
855 std::size_t commonSize{scope.commonBlocks().size()};
892 for (const auto &pair : scope.commonBlocks()) {
1360 if (auto *scope{ancestor->FindSubmodule(name)}) {
1361 return scope;
1372 return it->second->scope();
1377 Scope *scope{it->second->scope()};
1378 if (scope->kind() == Scope::Kind::Module) {
1379 for (const Symbol *found{scope->symbol()}; found;) {
1384 return const_cast<Scope *>(found->scope());
1393 notAModule = scope->symbol();
1437 return it->second->scope();
1509 Scope *parentScope; // the scope this module/submodule goes into
1555 // their own nested scope that will be visible only to USE statements
1589 return moduleSymbol->scope();
1688 const auto &scope{symbol.owner()};
1689 if (scope != scope_ && !scope.IsDerivedType()) {
1690 if (scope != scope_.parent()) {
1736 if (!scope.IsDerivedType()) {
1765 for (const auto &pair : *typeSymbol.scope()) {