Skip to content
Snippets Groups Projects
Commit a0990a9e authored by Frederik Hennig's avatar Frederik Hennig
Browse files

More helpful error messages

parent 72f50343
1 merge request!421Refactor Field Modelling
Pipeline #69871 passed with stages
in 2 minutes and 15 seconds
...@@ -320,7 +320,7 @@ class PsPragma(PsLeafMixIn, PsEmptyLeafMixIn, PsAstNode): ...@@ -320,7 +320,7 @@ class PsPragma(PsLeafMixIn, PsEmptyLeafMixIn, PsAstNode):
Example usage: ``PsPragma("omp parallel for")`` translates to ``#pragma omp parallel for``. Example usage: ``PsPragma("omp parallel for")`` translates to ``#pragma omp parallel for``.
Args: Args:
text: The pragmas text, without the ``#pragma``. text: The pragma's text, without the ``#pragma``.
""" """
__match_args__ = ("text",) __match_args__ = ("text",)
......
...@@ -50,11 +50,13 @@ from .ast.expressions import ( ...@@ -50,11 +50,13 @@ from .ast.expressions import (
PsLt, PsLt,
PsGe, PsGe,
PsLe, PsLe,
PsSubscript PsSubscript,
PsBufferAcc,
) )
from .extensions.foreign_ast import PsForeignExpression from .extensions.foreign_ast import PsForeignExpression
from .exceptions import PsInternalCompilerError
from .memory import PsSymbol from .memory import PsSymbol
from ..types import PsScalarType, PsArrayType from ..types import PsScalarType, PsArrayType
...@@ -386,6 +388,12 @@ class CAstPrinter: ...@@ -386,6 +388,12 @@ class CAstPrinter:
foreign_code = node.get_code(self.visit(c, pc) for c in children) foreign_code = node.get_code(self.visit(c, pc) for c in children)
pc.pop_op() pc.pop_op()
return foreign_code return foreign_code
case PsBufferAcc():
raise PsInternalCompilerError(
f"Unable to print C code for buffer access {node}.\n"
f"Buffer accesses must be lowered using the `LowerToC` pass before emission."
)
case _: case _:
raise NotImplementedError(f"Don't know how to print {node}") raise NotImplementedError(f"Don't know how to print {node}")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment