Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions compiledb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
from compiledb.utils import run_cmd

# Internal variables used to parse build log entries
cc_compile_regex = re.compile(r"^.*-?g?cc-?[0-9.]*$|^.*-?clang-?[0-9.]*$")
cpp_compile_regex = re.compile(r"^.*-?[gc]\+\+-?[0-9.]*$|^.*-?clang\+\+-?[0-9.]*$")
cc_compile_regex = re.compile(r"^.*-?g?cc-?[0-9.]*(?:.exe)?$|^.*-?clang-?[0-9.]*(?:.exe)?$")
cpp_compile_regex = re.compile(r"^.*-?[gc]\+\+-?[0-9.]*(?:.exe)?$|^.*-?clang\+\+-?[0-9.]*(?:.exe)?$")
file_regex = re.compile(r"^.+\.c$|^.+\.cc$|^.+\.cpp$|^.+\.cxx$|^.+\.s$", re.IGNORECASE)
compiler_wrappers = {"ccache", "icecc", "sccache"}

Expand Down
18 changes: 18 additions & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ def test_trivial_build_command():
}


def test_trivial_build_command_windows():
pwd = getcwd()
build_log = ['gcc.exe -o hello.o -c hello.c']
result = parse_build_log(
build_log,
proj_dir=pwd,
exclude_files=[])

assert result.count == 1
assert result.skipped == 0
assert len(result.compdb) == 1
assert result.compdb[0] == {
'directory': pwd,
'file': 'hello.c',
'arguments': ['gcc.exe', '-o', 'hello.o', '-c', 'hello.c']
}


def test_build_commands_with_version():
pwd = getcwd()
build_log = ['clang-5.0 -o hello.o -c hello.c']
Expand Down