Skip to content

Commit

Permalink
ProgramUnit: Only apply source sanitisation for FP frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
mlange05 committed Jan 9, 2025
1 parent dcbdaeb commit fbfd5af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions loki/program_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ def from_source(cls, source, definitions=None, preprocess=False,
includes = omni_includes
source = preprocess_cpp(source=source, includes=includes, defines=defines)

# Preprocess using internal frontend-specific PP rules
# to sanitize input and work around known frontend problems.
if frontend != Frontend.OMNI:
source, pp_info = sanitize_input(source=source, frontend=frontend)

if frontend == Frontend.REGEX:
return cls.from_regex(raw_source=source, parser_classes=parser_classes, parent=parent)

Expand All @@ -164,6 +159,10 @@ def from_source(cls, source, definitions=None, preprocess=False,
type_map=type_map, parent=parent)

if frontend == Frontend.FP:
# Preprocess using internal frontend-specific PP rules
# to sanitize input and work around known frontend problems.
source, pp_info = sanitize_input(source=source, frontend=frontend)

ast = parse_fparser_source(source)
return cls.from_fparser(ast=ast, raw_source=source, definitions=definitions,
pp_info=pp_info, parent=parent)
Expand Down

0 comments on commit fbfd5af

Please sign in to comment.