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
3 changes: 3 additions & 0 deletions compiledb/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def __init__(self, name="gcc"):
},
}

if name == "clang" or name == "nvcc" or name == "clang++":
self._languages["c++"]["extensions"].append("cu")

# Keep a list of macros for each language since, for example, gcc can be used both for C and C++ sources.
self._predefined_macros = {
# language: ["-DMACRO1", "-DMACRO2=1"]
Expand Down
3 changes: 2 additions & 1 deletion compiledb/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# 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.]*$")
file_regex = re.compile(r"^.+\.c$|^.+\.cc$|^.+\.cpp$|^.+\.cxx$|^.+\.s$", re.IGNORECASE)
file_regex = re.compile(r"^.+\.c$|^.+\.cc$|^.+\.cpp$|^.+\.cxx$|^.+\.cu$|^.+\.s$", re.IGNORECASE)
compiler_wrappers = {"ccache", "icecc", "sccache"}

# Leverage `make --print-directory` option
Expand Down Expand Up @@ -171,6 +171,7 @@ def skip_line(cmd, reason):
class SubstCommandVisitor(bashlex.ast.nodevisitor):
"""Uses bashlex to parse and process sh/bash substitution commands.
May result in a parsing exception for invalid commands."""

def __init__(self):
self.substs = []

Expand Down