Lines Matching full:semantics
14 #include "flang/Semantics/semantics.h"
15 #include "flang/Semantics/tools.h"
68 void dumpScope(const semantics::Scope *scope, int depth = -1);
76 PFTBuilder(const semantics::SemanticsContext &semanticsContext)
143 const Fortran::semantics::Symbol &procSym = callName->symbol->GetUltimate();
146 const Fortran::semantics::Symbol &modSym = *procSym.owner().symbol();
147 if (!modSym.attrs().test(Fortran::semantics::Attr::INTRINSIC))
369 const semantics::SemanticsContext &semanticsContext) {
511 const semantics::Symbol *sym =
513 if (auto *details = sym->detailsIf<semantics::GenericDetails>())
515 assert(sym->has<semantics::SubprogramDetails>() &&
663 if (semantics::ExprHasTypeCategory(*semantics::GetExpr(*expr),
1100 unit->getSubprogramSymbol().get<semantics::SubprogramDetails>();
1102 const semantics::Symbol *resultSym = &details.result();
1114 const semantics::SemanticsContext &semanticsContext;
1132 void dumpScope(const semantics::Scope *scope, int depth) {
1154 if (scope->kind() == Fortran::semantics::Scope::Kind::BlockConstruct)
1164 common::Reference<semantics::Symbol> sym = iter->second;
1408 static const semantics::Symbol *getSymbol(A &beginStmt) {
1411 -> const semantics::Symbol * { return stmt.statement.v.symbol; },
1413 -> const semantics::Symbol * {
1417 -> const semantics::Symbol * {
1421 -> const semantics::Symbol * { return stmt.statement.v.symbol; },
1423 -> const semantics::Symbol * { return stmt.statement.v.symbol; },
1425 -> const semantics::Symbol * {
1428 [](const auto &) -> const semantics::Symbol * {
1457 bool Fortran::lower::definedInCommonBlock(const semantics::Symbol &sym) {
1458 return semantics::FindCommonBlockContaining(sym);
1462 bool Fortran::lower::symbolIsGlobal(const semantics::Symbol &sym) {
1463 return semantics::IsSaved(sym) || lower::definedInCommonBlock(sym) ||
1464 semantics::IsNamedConstant(sym);
1473 explicit SymbolDependenceAnalysis(const semantics::Scope &scope) {
1479 explicit SymbolDependenceAnalysis(const semantics::Symbol &symbol) {
1493 void analyzeEquivalenceSets(const semantics::Scope &scope) {
1503 if (scp->kind() == Fortran::semantics::Scope::Kind::Module)
1507 const semantics::Symbol &ultimate = iter.second.get().GetUltimate();
1520 void analyzeLocalEquivalenceSets(const semantics::Scope &scope) {
1527 std::list<std::list<semantics::SymbolRef>> aggregates =
1528 Fortran::semantics::GetStorageAssociations(scope);
1529 for (std::list<semantics::SymbolRef> aggregate : aggregates) {
1530 const Fortran::semantics::Symbol *aggregateSym = nullptr;
1532 const semantics::Symbol &first = *aggregate.front();
1539 const Fortran::semantics::Symbol *namingSym = nullptr;
1540 for (semantics::SymbolRef symRef : aggregate) {
1541 const semantics::Symbol &sym = *symRef;
1543 if (sym.test(Fortran::semantics::Symbol::Flag::CompilerCreated)) {
1566 int analyze(const semantics::Symbol &sym) {
1572 const semantics::Symbol &ultimate = sym.GetUltimate();
1573 if (const auto *details = ultimate.detailsIf<semantics::GenericDetails>()) {
1576 if (const semantics::Symbol *specific = details->specific())
1581 semantics::IsProcedurePointer(sym) ||
1582 (semantics::IsProcedure(sym) && IsDummy(sym));
1586 if (semantics::IsProcedure(sym) && !isProcedurePointerOrDummy)
1597 ultimate.detailsIf<semantics::NamelistDetails>()) {
1599 for (const semantics::SymbolRef &s : details->objects())
1603 if (!ultimate.has<semantics::ObjectEntityDetails>() &&
1607 if (sym.has<semantics::DerivedTypeDetails>())
1617 if (const auto *details = sym.detailsIf<semantics::ObjectEntityDetails>()) {
1618 const semantics::DeclTypeSpec *symTy = sym.GetType();
1621 if (symTy->category() == semantics::DeclTypeSpec::Character)
1628 semantics::SomeExpr e{*bound.GetExplicit()};
1634 for (const semantics::ShapeSpec &subs : details->shape()) {
1639 for (const semantics::ShapeSpec &subs : details->coshape()) {
1646 if (!s->has<semantics::DerivedTypeDetails>())
1651 if (ultimate.test(Fortran::semantics::Symbol::Flag::CrayPointee))
1653 analyze(Fortran::semantics::GetCrayPointer(ultimate)) + 1, depth);
1657 if (semantics::IsAllocatable(sym))
1659 if (semantics::IsPointer(sym))
1661 if (ultimate.attrs().test(semantics::Attr::TARGET))
1672 bool skipSymbol(const semantics::Symbol &sym) {
1676 return !sym.has<semantics::ObjectEntityDetails>() ||
1688 const semantics::Symbol &ultimate = sym.GetUltimate();
1689 const semantics::Scope &scope = ultimate.owner();
1733 llvm::SmallSet<const semantics::Symbol *, 32> seen;
1735 llvm::SmallSet<const semantics::Symbol *, 32> aliasSyms;
1737 llvm::SmallSet<const semantics::Scope *, 4> analyzedScopes;
1748 const semantics::SemanticsContext &semanticsContext)
1755 const semantics::Symbol *symbol = getSymbol(*beginStmt);
1766 const semantics::SemanticsContext &)
1770 const semantics::Symbol *symbol = getSymbol(*beginStmt);
1777 const semantics::SemanticsContext &)
1781 const semantics::Symbol *symbol = getSymbol(*beginStmt);
1788 const lower::pft::PftNode &parent, const semantics::SemanticsContext &)
1792 const semantics::Symbol *symbol = getSymbol(*beginStmt);
1842 const Fortran::semantics::Scope &
1844 const Fortran::semantics::Symbol *symbol = getSymbol(beginStmt);
1856 const semantics::SemanticsContext &semanticsContext)
1868 // semantics::BuildRuntimeDerivedTypeTables(). Scope cannot be used since the
1871 // semantics::RuntimeDerivedTypeTables and to check if the symbol names
1873 using Flags = Fortran::semantics::Symbol::Flag;
1885 const semantics::SemanticsContext &semanticsContext) {
1958 lower::pft::getScopeVariableList(const semantics::Scope &scope,
1974 lower::pft::getScopeVariableList(const semantics::Scope &scope) {
1985 lower::pft::getDependentVariableList(const semantics::Symbol &symbol) {
2000 // Some parse tree Expr may legitimately be un-analyzed after semantics
2002 if (const auto *expr = Fortran::semantics::GetExpr(nullptr, x))
2008 if (const semantics::Symbol *symbol = name.symbol)
2015 for (const semantics::Symbol &symbol :
2020 void visitSymbol(const Fortran::semantics::Symbol &symbol) {
2026 symbol.detailsIf<Fortran::semantics::SubprogramDetails>()) {
2032 const Fortran::semantics::Symbol &result =
2035 result.detailsIf<Fortran::semantics::ObjectEntityDetails>())
2037 for (const Fortran::semantics::ShapeSpec &shapeSpec :
2045 if (Fortran::semantics::IsProcedure(symbol)) {
2053 } else if (const Fortran::semantics::DerivedTypeSpec *derivedTypeSpec =
2056 if (const Fortran::semantics::MaybeIntExpr &expr =
2064 Fortran::semantics::Symbol::Flag::CrayPointee))
2065 visitSymbol(Fortran::semantics::GetCrayPointer(symbol));
2071 const std::function<void(const Fortran::semantics::Symbol &)> &callBack;
2077 const std::function<void(const Fortran::semantics::Symbol &)> callBack) {
2086 const std::function<void(const Fortran::semantics::Symbol &)> callBack) {