summaryrefslogtreecommitdiffstats
path: root/clang/tools/clang-cc/SerializationTest.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-28 04:27:18 +0000
committerChris Lattner <sabre@nondot.org>2009-03-28 04:27:18 +0000
commita5adead17bb94f8517cd85f28aad57de785feaa1 (patch)
treee571e82231ded04af224d354792c264ad0d89d94 /clang/tools/clang-cc/SerializationTest.cpp
parent72f307a26e85109dacc68887807734a1b72ad6a7 (diff)
downloadbcm5719-llvm-a5adead17bb94f8517cd85f28aad57de785feaa1.tar.gz
bcm5719-llvm-a5adead17bb94f8517cd85f28aad57de785feaa1.zip
push more ASTContext goodness out through interfaces that use
TranslationUnit llvm-svn: 67913
Diffstat (limited to 'clang/tools/clang-cc/SerializationTest.cpp')
-rw-r--r--clang/tools/clang-cc/SerializationTest.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/tools/clang-cc/SerializationTest.cpp b/clang/tools/clang-cc/SerializationTest.cpp
index d12a0af306b..a39811fd90e 100644
--- a/clang/tools/clang-cc/SerializationTest.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud