diff options
author | Renato Golin <renato.golin@linaro.org> | 2017-03-18 12:31:32 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2017-03-18 12:31:32 +0000 |
commit | f1966cf6467e60c60d1c3fe6fa8b669d79ecf8e9 (patch) | |
tree | b2ada42a7d0c7f06002a987e9e75d0c0ec4ec64f /clang/lib/Frontend/ASTUnit.cpp | |
parent | e6ff30b696739aca2e86484750c68dce113712a1 (diff) | |
download | bcm5719-llvm-f1966cf6467e60c60d1c3fe6fa8b669d79ecf8e9.tar.gz bcm5719-llvm-f1966cf6467e60c60d1c3fe6fa8b669d79ecf8e9.zip |
Revert "Modules: Cache PCMs in memory and avoid a use-after-free"
This reverts commit r298165, as it broke the ARM builds.
llvm-svn: 298185
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 952992a9e8b..ac5c7ca3be3 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -18,7 +18,6 @@ #include "clang/AST/StmtVisitor.h" #include "clang/AST/TypeOrdering.h" #include "clang/Basic/Diagnostic.h" -#include "clang/Basic/MemoryBufferCache.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetOptions.h" #include "clang/Basic/VirtualFileSystem.h" @@ -186,8 +185,7 @@ struct ASTUnit::ASTWriterData { llvm::BitstreamWriter Stream; ASTWriter Writer; - ASTWriterData(MemoryBufferCache &PCMCache) - : Stream(Buffer), Writer(Stream, Buffer, PCMCache, {}) {} + ASTWriterData() : Stream(Buffer), Writer(Stream, Buffer, {}) {} }; void ASTUnit::clearFileLevelDecls() { @@ -683,7 +681,6 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( AST->SourceMgr = new SourceManager(AST->getDiagnostics(), AST->getFileManager(), UserFilesAreVolatile); - AST->PCMCache = new MemoryBufferCache; AST->HSOpts = std::make_shared<HeaderSearchOptions>(); AST->HSOpts->ModuleFormat = PCHContainerRdr.getFormat(); AST->HeaderInfo.reset(new HeaderSearch(AST->HSOpts, @@ -704,7 +701,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile( AST->PP = std::make_shared<Preprocessor>( std::move(PPOpts), AST->getDiagnostics(), AST->ASTFileLangOpts, - AST->getSourceManager(), *AST->PCMCache, HeaderInfo, *AST, + AST->getSourceManager(), HeaderInfo, *AST, /*IILookup=*/nullptr, /*OwnsHeaderSearch=*/false); Preprocessor &PP = *AST->PP; @@ -1730,7 +1727,6 @@ ASTUnit::create(std::shared_ptr<CompilerInvocation> CI, AST->UserFilesAreVolatile = UserFilesAreVolatile; AST->SourceMgr = new SourceManager(AST->getDiagnostics(), *AST->FileMgr, UserFilesAreVolatile); - AST->PCMCache = new MemoryBufferCache; return AST; } @@ -2001,7 +1997,6 @@ ASTUnit *ASTUnit::LoadFromCommandLine( if (!VFS) return nullptr; AST->FileMgr = new FileManager(AST->FileSystemOpts, VFS); - AST->PCMCache = new MemoryBufferCache; AST->OnlyLocalDecls = OnlyLocalDecls; AST->CaptureDiagnostics = CaptureDiagnostics; AST->TUKind = TUKind; @@ -2013,7 +2008,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( AST->StoredDiagnostics.swap(StoredDiagnostics); AST->Invocation = CI; if (ForSerialization) - AST->WriterData.reset(new ASTWriterData(*AST->PCMCache)); + AST->WriterData.reset(new ASTWriterData()); // Zero out now to ease cleanup during crash recovery. CI = nullptr; Diags = nullptr; @@ -2528,8 +2523,7 @@ bool ASTUnit::serialize(raw_ostream &OS) { SmallString<128> Buffer; llvm::BitstreamWriter Stream(Buffer); - MemoryBufferCache PCMCache; - ASTWriter Writer(Stream, Buffer, PCMCache, {}); + ASTWriter Writer(Stream, Buffer, {}); return serializeUnit(Writer, Buffer, getSema(), hasErrors, OS); } |