summaryrefslogtreecommitdiffstats
path: root/lib/Frontend/ChainedIncludesSource.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-02-20 20:00:27 +0000
committerAdrian Prantl <aprantl@apple.com>2015-02-20 20:00:27 +0000
commit01ec5f25641bc4a985138e068cf4b739531cc298 (patch)
tree5257ce4526ef1c36e6606b285b2418af87acf596 /lib/Frontend/ChainedIncludesSource.cpp
parente998e97b36d9f6dc9c3c503d05838df3bc2ad0e8 (diff)
Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
This reverts commit r230044 while dealing with buildbot breakage. Conflicts: test/Modules/module_container.m git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ChainedIncludesSource.cpp')
-rw-r--r--lib/Frontend/ChainedIncludesSource.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp
index 1ecc0bfc6b..cb260b4f4c 100644
--- a/lib/Frontend/ChainedIncludesSource.cpp
+++ b/lib/Frontend/ChainedIncludesSource.cpp
@@ -156,13 +156,11 @@ IntrusiveRefCntPtr<ExternalSemaSource> clang::createChainedIncludesSource(
&Clang->getPreprocessor());
Clang->createASTContext();
- auto consumer = llvm::make_unique<PCHGenerator>(Clang->getPreprocessor(),
- "-", nullptr, /*isysroot=*/"");
- SmallVectorImpl<char> *serialAST;
- consumer->RegisterSerializationFinishedCallback(
- [&](SmallVectorImpl<char> *Buf){
- serialAST = Buf;
- });
+ SmallVector<char, 256> serialAST;
+ llvm::raw_svector_ostream OS(serialAST);
+ auto consumer =
+ llvm::make_unique<PCHGenerator>(Clang->getPreprocessor(), "-", nullptr,
+ /*isysroot=*/"", &OS);
Clang->getASTContext().setASTMutationListener(
consumer->GetASTMutationListener());
Clang->setASTConsumer(std::move(consumer));
@@ -199,9 +197,7 @@ IntrusiveRefCntPtr<ExternalSemaSource> 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());
}