From 690b2f7746ffd37ee507618a5bc17a5799671417 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 20 Feb 2015 22:12:19 +0000 Subject: Revert "Wrap clang module files in a Mach-O, ELF, or COFF container." This reverts commit r230067. Investigating another batch of problems found by the bots. llvm-svn: 230073 --- clang/lib/Frontend/ChainedIncludesSource.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'clang/lib/Frontend/ChainedIncludesSource.cpp') diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp index 1ecc0bfc6b4..cb260b4f4c6 100644 --- a/clang/lib/Frontend/ChainedIncludesSource.cpp +++ b/clang/lib/Frontend/ChainedIncludesSource.cpp @@ -156,13 +156,11 @@ IntrusiveRefCntPtr clang::createChainedIncludesSource( &Clang->getPreprocessor()); Clang->createASTContext(); - auto consumer = llvm::make_unique(Clang->getPreprocessor(), - "-", nullptr, /*isysroot=*/""); - SmallVectorImpl *serialAST; - consumer->RegisterSerializationFinishedCallback( - [&](SmallVectorImpl *Buf){ - serialAST = Buf; - }); + SmallVector serialAST; + llvm::raw_svector_ostream OS(serialAST); + auto consumer = + llvm::make_unique(Clang->getPreprocessor(), "-", nullptr, + /*isysroot=*/"", &OS); Clang->getASTContext().setASTMutationListener( consumer->GetASTMutationListener()); Clang->setASTConsumer(std::move(consumer)); @@ -199,9 +197,7 @@ IntrusiveRefCntPtr clang::createChainedIncludesSource( ParseAST(Clang->getSema()); Clang->getDiagnosticClient().EndSourceFile(); - SerialBufs.push_back(llvm::MemoryBuffer:: - getMemBufferCopy(StringRef(serialAST->data(), serialAST->size()))); - serialAST->clear(); + SerialBufs.push_back(llvm::MemoryBuffer::getMemBufferCopy(OS.str())); source->CIs.push_back(Clang.release()); } -- cgit v1.2.3