Commit ee10fd3e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Added clean --llvm option

parent 4da1a918
...@@ -1764,15 +1764,13 @@ def opengeode(): ...@@ -1764,15 +1764,13 @@ def opengeode():
help='SDL file(s)') help='SDL file(s)')
options = parser.parse_args() options = parser.parse_args()
ret = 0 ret = 0
if options.debug: level = logging.DEBUG if options.debug else logging.INFO
level = logging.DEBUG
else:
level = logging.INFO
# Set log level for all libraries # Set log level for all libraries
LOG.setLevel(level) LOG.setLevel(level)
for module in (sdlSymbols, genericSymbols, ogAST, ogParser, Lander, for module in (sdlSymbols, genericSymbols, ogAST, ogParser, Lander,
AdaGenerator, undoCommands, Renderer, Clipboard, Statechart): AdaGenerator, undoCommands, Renderer, Clipboard, Statechart,
Helper, LlvmGenerator):
module.LOG.addHandler(handler_console) module.LOG.addHandler(handler_console)
module.LOG.setLevel(level) module.LOG.setLevel(level)
...@@ -1803,22 +1801,26 @@ def opengeode(): ...@@ -1803,22 +1801,26 @@ def opengeode():
LOG.warning(warning[0]) LOG.warning(warning[0])
for error in errors: for error in errors:
LOG.error(error[0]) LOG.error(error[0])
if len(errors) > 0: if errors:
ret = -1 ret = -1
if options.toAda: if options.toAda or options.llvm:
if len(errors) > 0: LOG.error('Too many errors, cannot generate code')
LOG.error('Too many errors, cannot generate Ada code') if options.toAda and not errors:
else:
LOG.info('Generating Ada code') LOG.info('Generating Ada code')
try: try:
AdaGenerator.generate(process) AdaGenerator.generate(process)
if options.llvm:
# Experimental: generate LLVM IR code
LlvmGenerator.generate(process)
except (TypeError, ValueError, NameError) as err: except (TypeError, ValueError, NameError) as err:
LOG.error(str(err)) LOG.error(str(err))
#print(str(traceback.format_exc())) LOG.debug(str(traceback.format_exc()))
LOG.error('Code generation failed') LOG.error('Code generation failed')
if options.llvm and not errors:
LOG.info('Generating LLVM code')
try:
LlvmGenerator.generate(process)
except (TypeError, ValueError, NameError) as err:
LOG.error(str(err))
LOG.debug(str(traceback.format_exc()))
LOG.error('LLVM Code generation failed')
export_fmt = [] export_fmt = []
if options.png: if options.png:
export_fmt.append('png') export_fmt.append('png')
......
Supports Markdown
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