[cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.directory and the rest of the python binding
Patch by David Röthlisberger llvm-svn: 159970
This commit is contained in:
@@ -2132,7 +2132,7 @@ class CompileCommand(object):
|
|||||||
@property
|
@property
|
||||||
def directory(self):
|
def directory(self):
|
||||||
"""Get the working directory for this CompileCommand"""
|
"""Get the working directory for this CompileCommand"""
|
||||||
return CompileCommand_getDirectory(self.cmd).spelling
|
return CompileCommand_getDirectory(self.cmd)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def arguments(self):
|
def arguments(self):
|
||||||
@@ -2603,6 +2603,7 @@ CompileCommands_getCommand.restype = c_object_p
|
|||||||
CompileCommand_getDirectory = lib.clang_CompileCommand_getDirectory
|
CompileCommand_getDirectory = lib.clang_CompileCommand_getDirectory
|
||||||
CompileCommand_getDirectory.argtypes = [c_object_p]
|
CompileCommand_getDirectory.argtypes = [c_object_p]
|
||||||
CompileCommand_getDirectory.restype = _CXString
|
CompileCommand_getDirectory.restype = _CXString
|
||||||
|
CompileCommand_getDirectory.errcheck = _CXString.from_result
|
||||||
|
|
||||||
CompileCommand_getNumArgs = lib.clang_CompileCommand_getNumArgs
|
CompileCommand_getNumArgs = lib.clang_CompileCommand_getNumArgs
|
||||||
CompileCommand_getNumArgs.argtypes = [c_object_p]
|
CompileCommand_getNumArgs.argtypes = [c_object_p]
|
||||||
@@ -2611,6 +2612,7 @@ CompileCommand_getNumArgs.restype = c_uint
|
|||||||
CompileCommand_getArg = lib.clang_CompileCommand_getArg
|
CompileCommand_getArg = lib.clang_CompileCommand_getArg
|
||||||
CompileCommand_getArg.argtypes = [c_object_p, c_uint]
|
CompileCommand_getArg.argtypes = [c_object_p, c_uint]
|
||||||
CompileCommand_getArg.restype = _CXString
|
CompileCommand_getArg.restype = _CXString
|
||||||
|
CompileCommand_getArg.errcheck = _CXString.from_result
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'CodeCompletionResults',
|
'CodeCompletionResults',
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ def test_1_compilecommand():
|
|||||||
expected = [ 'clang++', '-o', 'project.o', '-c',
|
expected = [ 'clang++', '-o', 'project.o', '-c',
|
||||||
'/home/john.doe/MyProject/project.cpp']
|
'/home/john.doe/MyProject/project.cpp']
|
||||||
for arg, exp in zip(cmds[0].arguments, expected):
|
for arg, exp in zip(cmds[0].arguments, expected):
|
||||||
assert arg.spelling == exp
|
assert arg == exp
|
||||||
|
|
||||||
def test_2_compilecommand():
|
def test_2_compilecommand():
|
||||||
"""Check file with 2 compile commands"""
|
"""Check file with 2 compile commands"""
|
||||||
@@ -59,7 +59,7 @@ def test_2_compilecommand():
|
|||||||
for i in range(len(cmds)):
|
for i in range(len(cmds)):
|
||||||
assert cmds[i].directory == expected[i]['wd']
|
assert cmds[i].directory == expected[i]['wd']
|
||||||
for arg, exp in zip(cmds[i].arguments, expected[i]['line']):
|
for arg, exp in zip(cmds[i].arguments, expected[i]['line']):
|
||||||
assert arg.spelling == exp
|
assert arg == exp
|
||||||
|
|
||||||
def test_compilecommand_iterator_stops():
|
def test_compilecommand_iterator_stops():
|
||||||
"""Check that iterator stops after the correct number of elements"""
|
"""Check that iterator stops after the correct number of elements"""
|
||||||
|
|||||||
Reference in New Issue
Block a user