Skip to content

Commit

Permalink
Merge pull request #108 from bwrsandman/clang-on-windows
Browse files Browse the repository at this point in the history
Fix line filter on for clang compiler on windows
  • Loading branch information
ZedThree authored Jan 18, 2024
2 parents 27e8178 + 30c15cb commit 5d848bc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions post/clang_tidy_review/clang_tidy_review/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,14 @@ def get_line_ranges(diff, files):

line_filter_json = []
for name, lines in lines_by_file.items():
# On windows, unidiff has forward slashes but clang-tidy expects backslashes
name = os.path.join(*name.split("/"))
line_filter_json.append({"name": name, "lines": lines})
# On windows, unidiff has forward slashes but cl.exe expects backslashes.
# However, clang.exe on windows expects forward slashes.
# Adding a copy of the line filters with backslashes allows for both cl.exe and clang.exe to work.
if os.path.sep == "\\":
# Converts name to backslashes for the cl.exe line filter.
name = os.path.join(*name.split("/"))
line_filter_json.append({"name": name, "lines": lines})
return json.dumps(line_filter_json, separators=(",", ":"))


Expand Down

0 comments on commit 5d848bc

Please sign in to comment.