Skip to content

Commit 64bea42

Browse files
committed
[cmake_frontend.py] change parameter optionality; return type
of function `get_compilation_arguments`
1 parent 6a5933d commit 64bea42

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

Diff for: clang_bind/cmake_frontend.py

+10-19
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,19 @@ def __init__(self, build_dir):
1515
buildDir=build_dir
1616
)
1717

18-
def get_compilation_arguments(self, filename=None):
19-
"""Returns the compilation commands extracted from the compilation database
18+
def get_compilation_arguments(self, filename):
19+
"""Returns the compilation commands extracted from the compilation database.
2020
21-
:param filename: Get compilation arguments of the file, defaults to None: get for all files
22-
:type filename: str, optional
23-
:return: ilenames and their compiler arguments: {filename: compiler arguments}
24-
:rtype: dict
21+
:param filename: Get compilation arguments of the file.
22+
:type filename: str
23+
:return: Compiler arguments.
24+
:rtype: list
2525
"""
2626

27-
if filename:
28-
# Get compilation commands from the compilation database for the given file
29-
compilation_commands = self.compilation_database.getCompileCommands(
30-
filename=filename
31-
)
32-
else:
33-
# Get all compilation commands from the compilation database
34-
compilation_commands = self.compilation_database.getAllCompileCommands()
35-
36-
return {
37-
command.filename: list(command.arguments)[1:-1]
38-
for command in compilation_commands
39-
}
27+
compilation_arguments = []
28+
for command in self.compilation_database.getCompileCommands(filename=filename):
29+
compilation_arguments += list(command.arguments)[1:-1]
30+
return compilation_arguments
4031

4132

4233
class Target:

0 commit comments

Comments
 (0)