cindex.py: Handle NULL pointers when parsing translation units
authorTobias Grosser <grosser@fim.uni-passau.de>
Tue, 19 Mar 2013 15:30:48 +0000 (15:30 +0000)
committerTobias Grosser <grosser@fim.uni-passau.de>
Tue, 19 Mar 2013 15:30:48 +0000 (15:30 +0000)
commit14a2d7b9f0df50ff9874a7f721821d28e8323988
treea1d27a5166ffa20a5ca839d9207c0b65033f0745
parent9a8f0f55d5973fb90e216b0c78fba2f84373faca
cindex.py: Handle NULL pointers when parsing translation units

The code inside cindex.py was comparing NULL pointer returned by
clang_parseTranslationUnit and clang_createTranslationUnit with None.
However, as illustrated by the two tests I've added, those conditions
were ineffective which resulted in assert triggering later on.

Instead, a pointer is now treated as a boolean value, a NULL pointer being
False.

Contributed-by: Xavier Deguillard <deguilx@gmail.com>
llvm-svn: 177408
clang/bindings/python/clang/cindex.py
clang/bindings/python/tests/cindex/test_translation_unit.py