From a910f47654217d378047d9abbc5780a29ab04872 Mon Sep 17 00:00:00 2001 From: "Arnaud A. de Grandmaison" Date: Tue, 10 Jul 2012 00:00:05 +0000 Subject: [PATCH] [cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.directory and the rest of the python binding MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by David Röthlisberger git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159970 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/python/clang/cindex.py | 4 +++- bindings/python/tests/cindex/test_cdb.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index 0aea4669e8..5bee974fb2 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -2132,7 +2132,7 @@ class CompileCommand(object): @property def directory(self): """Get the working directory for this CompileCommand""" - return CompileCommand_getDirectory(self.cmd).spelling + return CompileCommand_getDirectory(self.cmd) @property def arguments(self): @@ -2603,6 +2603,7 @@ CompileCommands_getCommand.restype = c_object_p CompileCommand_getDirectory = lib.clang_CompileCommand_getDirectory CompileCommand_getDirectory.argtypes = [c_object_p] CompileCommand_getDirectory.restype = _CXString +CompileCommand_getDirectory.errcheck = _CXString.from_result CompileCommand_getNumArgs = lib.clang_CompileCommand_getNumArgs CompileCommand_getNumArgs.argtypes = [c_object_p] @@ -2611,6 +2612,7 @@ CompileCommand_getNumArgs.restype = c_uint CompileCommand_getArg = lib.clang_CompileCommand_getArg CompileCommand_getArg.argtypes = [c_object_p, c_uint] CompileCommand_getArg.restype = _CXString +CompileCommand_getArg.errcheck = _CXString.from_result __all__ = [ 'CodeCompletionResults', diff --git a/bindings/python/tests/cindex/test_cdb.py b/bindings/python/tests/cindex/test_cdb.py index 374f99bcbf..d0f580ea9f 100644 --- a/bindings/python/tests/cindex/test_cdb.py +++ b/bindings/python/tests/cindex/test_cdb.py @@ -41,7 +41,7 @@ def test_1_compilecommand(): expected = [ 'clang++', '-o', 'project.o', '-c', '/home/john.doe/MyProject/project.cpp'] for arg, exp in zip(cmds[0].arguments, expected): - assert arg.spelling == exp + assert arg == exp def test_2_compilecommand(): """Check file with 2 compile commands""" @@ -59,7 +59,7 @@ def test_2_compilecommand(): for i in range(len(cmds)): assert cmds[i].directory == expected[i]['wd'] for arg, exp in zip(cmds[i].arguments, expected[i]['line']): - assert arg.spelling == exp + assert arg == exp def test_compilecommand_iterator_stops(): """Check that iterator stops after the correct number of elements""" -- 2.40.0