Skip to content

Commit

Permalink
Subroutine: Ensure up-to-date call.name symbols after enrichment
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange05 committed Nov 1, 2024
1 parent a7d6592 commit 76f1360
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions loki/subroutine.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,10 @@ def enrich(self, definitions, recurse=False):
definitions_map = CaseInsensitiveDict((r.name, r) for r in as_tuple(definitions))
with pragmas_attached(self, ir.CallStatement, attach_pragma_post=False):
for call in FindNodes(ir.CallStatement).visit(self.body):
# Calls marked as 'reference' are inactive and thus skipped
not_active = is_loki_pragma(call.pragma, starts_with='reference')
if call.not_active is not not_active:
call._update(not_active=not_active)

symbol = call.name
# Clone symbol to ensure Deferred symbols are
# recognised ProcedureSymbols
symbol = call.name.clone()
routine = definitions_map.get(symbol.name)

if not routine and symbol.parent:
Expand All @@ -472,6 +470,9 @@ def enrich(self, definitions, recurse=False):
symbol.type.dtype.procedure is not routine # ProcedureType not linked
)

# Always update the call symbol to ensure it is up-to-date
call._update(name=symbol)

# Skip already enriched symbols and routines without definitions
if not (routine and is_not_enriched):
debug('Cannot enrich call to %s', symbol)
Expand Down

0 comments on commit 76f1360

Please sign in to comment.