@@ -68,7 +68,7 @@ def append_line_after(self, parent_line_num: int, line: Line):
68
68
self .lines .append (line )
69
69
return
70
70
71
- def add_pragma (self , file_mapping : Dict [int , str ], pragma : Pragma , parent_regions : List [int ], add_as_comment : bool = False ) -> bool :
71
+ def add_pragma (self , file_mapping : Dict [int , str ], pragma : Pragma , parent_regions : List [int ], add_as_comment : bool = False , skip_compilation_check : bool = False ) -> bool :
72
72
"""insert pragma into the maintained list of source code lines.
73
73
Returns True if the pragma resulted in a valid (resp. compilable) code transformation.
74
74
Returns False if compilation of the modified code was not possible.
@@ -132,7 +132,6 @@ def add_pragma(self, file_mapping: Dict[int, str], pragma: Pragma, parent_region
132
132
133
133
# append children to lines (mark as contained in region)
134
134
for child_pragma in pragma .children :
135
- #print("\tChild: ", child_pragma, file=sys.stderr)
136
135
# set skip_compilation_check to true since compiling children pragmas on their own might not be successful.
137
136
# As an example for that, '#pragma omp declare target' can be mentioned
138
137
successful = self .add_pragma (file_mapping , child_pragma , pragma_line .belongs_to_regions , add_as_comment = add_as_comment , skip_compilation_check = True )
@@ -145,6 +144,9 @@ def add_pragma(self, file_mapping: Dict[int, str], pragma: Pragma, parent_region
145
144
self .max_line_num = backup_max_line_num
146
145
return False
147
146
147
+ if skip_compilation_check :
148
+ return True
149
+
148
150
# check if the applied changes resulted in a compilable source code
149
151
# create a temporary file to store the modified file contents
150
152
if file_mapping [self .file_id ].endswith (".c" ):
0 commit comments