Lines Matching refs:tu
32 def save_tu(tu): argument
38 tu.save(t.name)
43 def save_tu_pathlike(tu): argument
49 tu.save(str_to_path(t.name))
56 tu = TranslationUnit.from_source(path)
57 self.assertEqual(tu.spelling, path)
61 tu = get_tu(path)
62 c = tu.cursor
68 tu = TranslationUnit.from_source(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi'])
69 spellings = [c.spelling for c in tu.cursor.get_children()]
75 tu = TranslationUnit.from_source(path, ['-DDECL_ONE=hello', '-DDECL_TWO=hi'])
76 tu.reparse()
77 spellings = [c.spelling for c in tu.cursor.get_children()]
82 tu = TranslationUnit.from_source('fake.c', ['-I./'], unsaved_files = [
92 spellings = [c.spelling for c in tu.cursor.get_children()]
101 tu = TranslationUnit.from_source('fake.c', unsaved_files = [
103 spellings = [c.spelling for c in tu.cursor.get_children()]
108 tu = TranslationUnit.from_source(str_to_path('fake.c'), ['-Iincludes'], unsaved_files = [
118 spellings = [c.spelling for c in tu.cursor.get_children()]
143 tu = TranslationUnit.from_source(src)
144 for i in zip(inc, tu.get_includes()):
154 … tu = TranslationUnit.from_source(src, options=TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD)
155 …inclusion_directive_files = [c.get_included_file().name for c in tu.cursor.get_children() if c.kin…
162 tu = get_tu('int foo();')
164 with save_tu(tu) as path:
172 tu = get_tu('int foo();')
174 with save_tu_pathlike(tu) as path:
181 tu = get_tu('int foo();')
187 tu.save(path)
195 tu = get_tu('int foo();')
196 self.assertEqual(len(tu.diagnostics), 0)
197 with save_tu(tu) as path:
214 tu = get_tu('int foo();')
215 self.assertEqual(len(tu.diagnostics), 0)
216 with save_tu(tu) as path:
229 tu = index.parse(path)
230 self.assertIsInstance(tu, TranslationUnit)
235 tu = get_tu('int foo();')
237 f = tu.get_file('t.c')
242 f = tu.get_file('foobar.cpp')
248 tu = get_tu('int foo();')
250 f = tu.get_file(str_to_path('t.c'))
255 f = tu.get_file(str_to_path('foobar.cpp'))
260 tu = get_tu('int foo();')
262 location = tu.get_location('t.c', 2)
267 location = tu.get_location('t.c', (1, 3))
276 tu = get_tu('int foo();')
278 r = tu.get_extent('t.c', (1,4))
285 r = tu.get_extent('t.c', ((1,2), (1,3)))
294 start = tu.get_location('t.c', 0)
295 end = tu.get_location('t.c', 5)
297 r = tu.get_extent('t.c', (start, end))
307 tu = get_tu('int foo();')
308 r = tu.get_extent('t.c', (0, 10))
309 tokens = list(tu.get_tokens(extent=r))
327 tu = TranslationUnit.from_source(path)
329 tu = None
330 self.assertEqual(tu, None)
335 tu = TranslationUnit.from_ast_file(path)
337 tu = None
338 self.assertEqual(tu, None)