[clang.py] TranslationUnit API improvements

* TranslationUnit reading and parsing now implemented as
  TranslationUnit.from_ast() and TranslationUnit.from_source().
* Index.parse() and Index.read() implemented through above.
* Index.parse() and Index.read() now raise a TanslationUnitLoadException
  instead of returning None if a TranslationUnit could not be
  instantiated. This is backwards incompatible.
* Ability to save TranslationUnits via TranslationUnit.save().
* TranslationUnit now holds onto Index instance that created. This means
  the Index can't be GC'd until the TranslationUnit is itself GC'd,
  making memory management thoughtless.
* Don't use [] as a default argument value, as the initial value used is
  reused for the duration of the program.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156372 91177308-0d34-0410-b5e6-96231b3b80d8
3 files changed