Skip to content

Commit ff3a710

Browse files
fix: Library: Code Generator: skip compilability check
1 parent 04fcfad commit ff3a710

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

discopop_library/CodeGenerator/classes/ContentBuffer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def append_line_after(self, parent_line_num: int, line: Line):
6868
self.lines.append(line)
6969
return
7070

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:
7272
"""insert pragma into the maintained list of source code lines.
7373
Returns True if the pragma resulted in a valid (resp. compilable) code transformation.
7474
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
132132

133133
# append children to lines (mark as contained in region)
134134
for child_pragma in pragma.children:
135-
#print("\tChild: ", child_pragma, file=sys.stderr)
136135
# set skip_compilation_check to true since compiling children pragmas on their own might not be successful.
137136
# As an example for that, '#pragma omp declare target' can be mentioned
138137
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
145144
self.max_line_num = backup_max_line_num
146145
return False
147146

147+
if skip_compilation_check:
148+
return True
149+
148150
# check if the applied changes resulted in a compilable source code
149151
# create a temporary file to store the modified file contents
150152
if file_mapping[self.file_id].endswith(".c"):

0 commit comments

Comments
 (0)