push more ASTContext goodness out through interfaces that use
TranslationUnit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67913 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/SerializationTest.cpp b/tools/clang-cc/SerializationTest.cpp
index d12a0af..a39811f 100644
--- a/tools/clang-cc/SerializationTest.cpp
+++ b/tools/clang-cc/SerializationTest.cpp
@@ -81,7 +81,7 @@
std::vector<unsigned char> Buffer;
Buffer.reserve(256*1024);
- EmitASTBitcodeBuffer(Ctx, Buffer);
+ Ctx.EmitASTBitcodeBuffer(Buffer);
// Write the bits to disk.
if (FILE* fp = fopen(Filename.c_str(),"wb")) {
@@ -97,7 +97,7 @@
llvm::sys::Path& FNameDeclPrint) {
// Deserialize the translation unit.
- TranslationUnit* NewTU;
+ ASTContext *NewCtx;
{
// Create the memory buffer that contains the contents of the file.
@@ -107,10 +107,10 @@
if (!MBuffer)
return false;
- NewTU = ReadASTBitcodeBuffer(*MBuffer, FMgr);
+ NewCtx = ASTContext::ReadASTBitcodeBuffer(*MBuffer, FMgr);
}
- if (!NewTU)
+ if (!NewCtx)
return false;
{
@@ -120,11 +120,13 @@
assert (Err.empty() && "Could not open file for printing out decls.");
llvm::OwningPtr<ASTConsumer> FilePrinter(CreateASTPrinter(&DeclPP));
- for (TranslationUnit::iterator I=NewTU->begin(), E=NewTU->end(); I!=E; ++I)
+ TranslationUnitDecl *TUD = NewCtx->getTranslationUnitDecl();
+ for (DeclContext::decl_iterator I = TUD->decls_begin(), E = TUD->decls_end();
+ I != E; ++I)
FilePrinter->HandleTopLevelDecl(*I);
}
- delete NewTU;
+ delete NewCtx;
return true;
}