mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'convertion-inherit' into convertion-inherit-run
This commit is contained in:
commit
f7d5ce96d7
|
@ -14,6 +14,8 @@ class AstCodeCreator:
|
||||||
self._global_function_body = []
|
self._global_function_body = []
|
||||||
|
|
||||||
self._parse_args = [
|
self._parse_args = [
|
||||||
|
#"-std=c11",
|
||||||
|
#"-v",
|
||||||
#"-fparse-all-comments",
|
#"-fparse-all-comments",
|
||||||
#"-fdebug-macro",
|
#"-fdebug-macro",
|
||||||
#"-fmacro-backtrace-limit=0",
|
#"-fmacro-backtrace-limit=0",
|
||||||
|
@ -104,6 +106,12 @@ class AstCodeCreator:
|
||||||
unsaved_files=None,
|
unsaved_files=None,
|
||||||
options=parse_options)
|
options=parse_options)
|
||||||
|
|
||||||
|
# Diagnostics:
|
||||||
|
for diag in self._translation_unit.diagnostics:
|
||||||
|
debug.line("DIAGNOSTICS", f"Severity: {diag.severity}")
|
||||||
|
debug.line("DIAGNOSTICS", f"Location: {diag.location}")
|
||||||
|
debug.line("DIAGNOSTICS", f"Message: {diag.spelling}")
|
||||||
|
|
||||||
self._ast_code = ast_code.AstCode(self._cfilename)
|
self._ast_code = ast_code.AstCode(self._cfilename)
|
||||||
|
|
||||||
self.parse_root()
|
self.parse_root()
|
||||||
|
|
|
@ -595,6 +595,12 @@ class AstParser:
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def parse_STATIC_ASSERT(self, node):
|
||||||
|
# static_assert isn't detected on some systems, so until this can be resolved we'll
|
||||||
|
# just return the tokens as a literal string...
|
||||||
|
debug.line("parse_STATIC_ASSERT", f"***WARNING*** Proper conversion not yet supported for static_assert - using the raw tokens...")
|
||||||
|
return literal.Literal(f"{' '.join(t.spelling for t in node.get_tokens())}")
|
||||||
|
|
||||||
parse_DECL_funcs = {
|
parse_DECL_funcs = {
|
||||||
clang.cindex.CursorKind.FUNCTION_DECL: parse_FUNCTION_DECL,
|
clang.cindex.CursorKind.FUNCTION_DECL: parse_FUNCTION_DECL,
|
||||||
clang.cindex.CursorKind.FUNCTION_TEMPLATE: parse_FUNCTION_TEMPLATE,
|
clang.cindex.CursorKind.FUNCTION_TEMPLATE: parse_FUNCTION_TEMPLATE,
|
||||||
|
@ -606,6 +612,7 @@ class AstParser:
|
||||||
clang.cindex.CursorKind.TYPEDEF_DECL: parse_TYPEDEF_DECL,
|
clang.cindex.CursorKind.TYPEDEF_DECL: parse_TYPEDEF_DECL,
|
||||||
clang.cindex.CursorKind.TYPE_ALIAS_DECL: parse_node_not_implemented,
|
clang.cindex.CursorKind.TYPE_ALIAS_DECL: parse_node_not_implemented,
|
||||||
clang.cindex.CursorKind.UNEXPOSED_DECL: parse_UNEXPOSED_DECL,
|
clang.cindex.CursorKind.UNEXPOSED_DECL: parse_UNEXPOSED_DECL,
|
||||||
|
clang.cindex.CursorKind.STATIC_ASSERT: parse_STATIC_ASSERT,
|
||||||
}
|
}
|
||||||
|
|
||||||
def parse_DECL_node(self, node):
|
def parse_DECL_node(self, node):
|
||||||
|
|
|
@ -18,7 +18,7 @@ parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--type", default="")
|
parser.add_argument("--type", default="")
|
||||||
parser.add_argument("--target", default="cpp/converted")
|
parser.add_argument("--target", default="cpp/converted")
|
||||||
parser.add_argument("--debug", action="store_true")
|
parser.add_argument("--debug", action="store_true")
|
||||||
parser.add_argument("--libclang", default="/usr/lib/llvm-16/lib/libclang.so")
|
parser.add_argument("--libclang", default="/usr/lib/llvm-17/lib/libclang.so")
|
||||||
parser.add_argument("path", nargs="+")
|
parser.add_argument("path", nargs="+")
|
||||||
|
|
||||||
ARGS = parser.parse_args()
|
ARGS = parser.parse_args()
|
||||||
|
|
Loading…
Reference in New Issue