From b34dde72e39905e528872596b5b23d21e209b78b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 24 Jan 2010 04:09:51 +0000 Subject: [PATCH] Simplify. llvm-svn: 94356 --- clang/bindings/python/clang/cindex.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 2545c45ac87c..9af4e4c64c8a 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -266,8 +266,6 @@ class Index(ClangObject): primarily by providing an interface for reading and parsing translation units. """ - def __init__(self, obj): - ClangObject.__init__(self, obj) @staticmethod def create(excludeDecls=False, displayDiags=False): @@ -300,13 +298,9 @@ class TranslationUnit(ClangObject): The TranslationUnit class represents a source code translation unit and provides read-only access to its top-level declarations. """ - def __init__(self, obj, free=False): - ClangObject.__init__(self, obj) - self.free = free def __del__(self): - if self.free and self.obj: - TranslationUnit_dispose(self) + TranslationUnit_dispose(self) @property def cursor(self): @@ -322,7 +316,7 @@ class TranslationUnit(ClangObject): def read(ix, path): """Create a translation unit from the given AST file.""" ptr = TranslationUnit_read(ix, path) - return TranslationUnit(ptr, True) if ptr else None + return TranslationUnit(ptr) if ptr else None @staticmethod def parse(ix, path, args = []): @@ -333,7 +327,7 @@ class TranslationUnit(ClangObject): # TODO: Support unsaved files. argc, argv = len(args), create_string_vector(args) ptr = TranslationUnit_parse(ix, path, argc, byref(argv), 0, 0) - return TranslationUnit(ptr, True) if ptr else None + return TranslationUnit(ptr) if ptr else None class File(ClangObject): """