diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-02-05 17:54:00 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2011-02-05 17:54:00 +0000 |
commit | 265e6b2d17ae348ce73961866979f574c65b56f4 (patch) | |
tree | 84310e05844fe9f3f29de817b74343361c38226e /bindings/python/tests | |
parent | 88f9c6ca6eb0d4c48687dfed4d94292209c5a919 (diff) |
python bindings: Add support for translationUnit.reparse().
This is the first step to make the clang_complete vim plugin work with
libclang. Reparsing improves parsing time from 0.8 to 0.25 secs for
one of my LLVM .cpp files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/tests')
-rw-r--r-- | bindings/python/tests/cindex/test_translation_unit.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bindings/python/tests/cindex/test_translation_unit.py b/bindings/python/tests/cindex/test_translation_unit.py index c83c4972ed..f130db6aeb 100644 --- a/bindings/python/tests/cindex/test_translation_unit.py +++ b/bindings/python/tests/cindex/test_translation_unit.py @@ -25,6 +25,15 @@ def test_parse_arguments(): assert spellings[-2] == 'hello' assert spellings[-1] == 'hi' +def test_reparse_arguments(): + path = os.path.join(kInputsDir, 'parse_arguments.c') + index = Index.create() + tu = index.parse(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi']) + tu.reparse() + spellings = [c.spelling for c in tu.cursor.get_children()] + assert spellings[-2] == 'hello' + assert spellings[-1] == 'hi' + def test_unsaved_files(): index = Index.create() tu = index.parse('fake.c', ['-I./'], unsaved_files = [ |