Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions compiledb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ def __init__(self, msg):
def __str__(self):
return "Error: {}".format(self.msg)

def preprocess_build_log(build_log):
new_build_log = []
inline_file_pattern = '@"(.*?)"'

for line in build_log:
result = re.search(inline_file_pattern, line)
while result is not None:
inline_file_path = result.group(1)
with open(inline_file_path, "r") as file:
inlined_text = file.read()
line = re.sub(pattern=inline_file_pattern, repl=inlined_text, string=line)
result = re.search(inline_file_pattern, line)
new_build_log += line.splitlines()

return new_build_log


def parse_build_log(build_log, proj_dir, exclude_files, command_style=False, add_predefined_macros=False,
use_full_path=False, extra_wrappers=[]):
Expand All @@ -81,6 +97,8 @@ def skip_line(cmd, reason):
working_dir = proj_dir
lineno = 0

build_log = preprocess_build_log(build_log)

# Process build log
for line in build_log:
lineno += 1
Expand Down