diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-28 04:27:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-28 04:27:18 +0000 |
commit | 557c5b1717bc8919b1b40cf2064b51491ec53a44 (patch) | |
tree | a04e5fd895bcb02ab9f2c183d68653effe9a56a7 /tools/clang-cc/SerializationTest.cpp | |
parent | 14734f7d2a69f9076e8a06954f06d3313063e7f9 (diff) |
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
Diffstat (limited to 'tools/clang-cc/SerializationTest.cpp')
-rw-r--r-- | tools/clang-cc/SerializationTest.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/clang-cc/SerializationTest.cpp b/tools/clang-cc/SerializationTest.cpp index d12a0af306..a39811fd90 100644 --- a/tools/clang-cc/SerializationTest.cpp +++ b/tools/clang-cc/SerializationTest.cpp @@ -81,7 +81,7 @@ bool SerializationTest::Serialize(llvm::sys::Path& Filename, 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 @@ bool SerializationTest::Deserialize(llvm::sys::Path& Filename, 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 @@ bool SerializationTest::Deserialize(llvm::sys::Path& Filename, if (!MBuffer) return false; - NewTU = ReadASTBitcodeBuffer(*MBuffer, FMgr); + NewCtx = ASTContext::ReadASTBitcodeBuffer(*MBuffer, FMgr); } - if (!NewTU) + if (!NewCtx) return false; { @@ -120,11 +120,13 @@ bool SerializationTest::Deserialize(llvm::sys::Path& Filename, 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; } |