@@ -34,6 +34,19 @@ def process_actor_groups(process_args):
34
34
p .close ()
35
35
p .join ()
36
36
37
+ def check_diagnostics_and_print (unit ):
38
+ if unit .diagnostics :
39
+ parse_success = False
40
+ for diag in unit .diagnostics :
41
+ if diag .severity > clang .cindex .Diagnostic .Warning :
42
+ print (f"Error: { diag .spelling } " )
43
+ print (f" File: { diag .location .file .name } " )
44
+ print (f" Line: { diag .location .line } " )
45
+ print (f" Column: { diag .location .column } " )
46
+ print (f" Severity: { diag .severity } " )
47
+ else :
48
+ parse_success = True
49
+ return parse_success
37
50
38
51
def process_one_actor_group (arg : ActorGroupProcessArgument ):
39
52
include_path = os .path .relpath (arg .filepath , arg .source_dir )
@@ -42,6 +55,9 @@ def process_one_actor_group(arg: ActorGroupProcessArgument):
42
55
index = clang .cindex .Index .create ()
43
56
unit = index .parse (arg .filepath , ['-nostdinc++' , '-x' , 'c++' , '-std=gnu++17' ] + arg .include_list )
44
57
58
+ if not check_diagnostics_and_print (unit ):
59
+ raise Exception ("Failed to parse %s" % arg .filepath )
60
+
45
61
actg_list = []
46
62
ns_list = []
47
63
traverse_actor_group_types (unit .cursor , arg .filepath , actg_list , ns_list )
@@ -81,6 +97,9 @@ def process_one_actor(arg: ActorProcessArgument):
81
97
index = clang .cindex .Index .create ()
82
98
unit = index .parse (arg .filepath , ['-nostdinc++' , '-x' , 'c++' , '-std=gnu++17' ] + arg .include_list )
83
99
100
+ if not check_diagnostics_and_print (unit ):
101
+ raise Exception ("Failed to parse %s" % arg .filepath )
102
+
84
103
act_list = []
85
104
ns_list = []
86
105
traverse_actor_types (unit .cursor , arg .filepath , act_list , ns_list )
0 commit comments