Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
TranslationUnit object instead of an ASTContext. By default it calls
Initialize(ASTConstext& Context) (to match with the current interface used by
most ASTConsumers).
Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit
to not free its Decls. This is a workaround for: <rdar://problem/5966749>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51825 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index ba9fc90..9ab6157 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -877,9 +877,8 @@
virtual ~ASTSerializer() { delete TU; }
- virtual void Initialize(ASTContext &Context) {
- if (!TU) TU = new TranslationUnit(Context, lang);
- TU->SetOwnsDecls(false);
+ virtual void InitializeTU(TranslationUnit &TU) {
+ TU.SetOwnsDecls(false);
}
virtual void HandleTopLevelDecl(Decl *D) {