diff --git a/src/clang_convert/ast_object/ast_code_creator.py b/src/clang_convert/ast_object/ast_code_creator.py index 477365e2a..13dbfdd36 100755 --- a/src/clang_convert/ast_object/ast_code_creator.py +++ b/src/clang_convert/ast_object/ast_code_creator.py @@ -14,6 +14,8 @@ class AstCodeCreator: self._global_function_body = [] self._parse_args = [ + #"-std=c11", + #"-v", #"-fparse-all-comments", #"-fdebug-macro", #"-fmacro-backtrace-limit=0", @@ -104,6 +106,12 @@ class AstCodeCreator: unsaved_files=None, 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.parse_root() diff --git a/src/clang_convert/ast_object/ast_parser.py b/src/clang_convert/ast_object/ast_parser.py index 111e3b483..8cf09f8cf 100755 --- a/src/clang_convert/ast_object/ast_parser.py +++ b/src/clang_convert/ast_object/ast_parser.py @@ -595,6 +595,12 @@ class AstParser: 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 = { clang.cindex.CursorKind.FUNCTION_DECL: parse_FUNCTION_DECL, 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.TYPE_ALIAS_DECL: parse_node_not_implemented, clang.cindex.CursorKind.UNEXPOSED_DECL: parse_UNEXPOSED_DECL, + clang.cindex.CursorKind.STATIC_ASSERT: parse_STATIC_ASSERT, } def parse_DECL_node(self, node): diff --git a/src/clang_convert/convert.py b/src/clang_convert/convert.py index 105df9117..bcdc3c8bc 100755 --- a/src/clang_convert/convert.py +++ b/src/clang_convert/convert.py @@ -18,7 +18,7 @@ parser = argparse.ArgumentParser() parser.add_argument("--type", default="") parser.add_argument("--target", default="cpp/converted") 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="+") ARGS = parser.parse_args()