[cfe-commits] r159970 - in /cfe/trunk/bindings/python: clang/cindex.py tests/cindex/test_cdb.py

Arnaud A. de Grandmaison arnaud.adegm at gmail.com
Mon Jul 9 17:00:05 PDT 2012


Author: aadg
Date: Mon Jul  9 19:00:05 2012
New Revision: 159970

URL: http://llvm.org/viewvc/llvm-project?rev=159970&view=rev
Log:
[cindex.py] Make CompileCommand.arguments usage consistent with CompileCommand.directory and the rest of the python binding

Patch by David Röthlisberger

Modified:
    cfe/trunk/bindings/python/clang/cindex.py
    cfe/trunk/bindings/python/tests/cindex/test_cdb.py

Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=159970&r1=159969&r2=159970&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Mon Jul  9 19:00:05 2012
@@ -2132,7 +2132,7 @@
     @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 @@
 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_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',

Modified: cfe/trunk/bindings/python/tests/cindex/test_cdb.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/cindex/test_cdb.py?rev=159970&r1=159969&r2=159970&view=diff
==============================================================================
--- cfe/trunk/bindings/python/tests/cindex/test_cdb.py (original)
+++ cfe/trunk/bindings/python/tests/cindex/test_cdb.py Mon Jul  9 19:00:05 2012
@@ -41,7 +41,7 @@
     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 @@
     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"""





More information about the cfe-commits mailing list