Home | History | Annotate | Download | only in cindex

Lines Matching refs:tu

19     tu = TranslationUnit.from_source(path)
20 assert tu.spelling == path
24 tu = get_tu(path)
25 c = tu.cursor
31 tu = TranslationUnit.from_source(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi'])
32 spellings = [c.spelling for c in tu.cursor.get_children()]
38 tu = TranslationUnit.from_source(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi'])
39 tu.reparse()
40 spellings = [c.spelling for c in tu.cursor.get_children()]
45 tu = TranslationUnit.from_source('fake.c', ['-I./'], unsaved_files = [
55 spellings = [c.spelling for c in tu.cursor.get_children()]
61 tu = TranslationUnit.from_source('fake.c', unsaved_files = [
63 spellings = [c.spelling for c in tu.cursor.get_children()]
86 tu = TranslationUnit.from_source(src)
87 for i in zip(inc, tu.get_includes()):
90 def save_tu(tu):
104 tu.save(path)
111 tu = get_tu('int foo();')
113 path = save_tu(tu)
121 tu = get_tu('int foo();')
127 tu.save(path)
136 tu = get_tu('int foo();')
137 assert len(tu.diagnostics) == 0
138 path = save_tu(tu)
157 tu = index.parse(path)
158 assert isinstance(tu, TranslationUnit)
161 """Ensure tu.get_file() works appropriately."""
163 tu = get_tu('int foo();')
165 f = tu.get_file('t.c')
170 f = tu.get_file('foobar.cpp')
177 """Ensure tu.get_source_location() works."""
179 tu = get_tu('int foo();')
181 location = tu.get_location('t.c', 2)
186 location = tu.get_location('t.c', (1, 3))
193 """Ensure tu.get_source_range() works."""
195 tu = get_tu('int foo();')
197 r = tu.get_extent('t.c', (1,4))
204 r = tu.get_extent('t.c', ((1,2), (1,3)))
213 start = tu.get_location('t.c', 0)
214 end = tu.get_location('t.c', 5)
216 r = tu.get_extent('t.c', (start, end))
226 tu = get_tu('int foo();')
227 r = tu.get_extent('t.c', (0, 10))
228 tokens = list(tu.get_tokens(extent=r))