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/Basic | |
| 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/Basic')
| -rw-r--r-- | clang/lib/Basic/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | clang/lib/Basic/MemoryBufferCache.cpp | 48 |
2 files changed, 0 insertions, 49 deletions
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt index 23242ba3f60..8929ec30ff7 100644 --- a/clang/lib/Basic/CMakeLists.txt +++ b/clang/lib/Basic/CMakeLists.txt @@ -74,7 +74,6 @@ add_clang_library(clangBasic FileSystemStatCache.cpp IdentifierTable.cpp LangOptions.cpp - MemoryBufferCache.cpp Module.cpp ObjCRuntime.cpp OpenMPKinds.cpp diff --git a/clang/lib/Basic/MemoryBufferCache.cpp b/clang/lib/Basic/MemoryBufferCache.cpp deleted file mode 100644 index c1fc571ec9b..00000000000 --- a/clang/lib/Basic/MemoryBufferCache.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===- MemoryBufferCache.cpp - Cache for loaded memory buffers ------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "clang/Basic/MemoryBufferCache.h" -#include "llvm/Support/MemoryBuffer.h" - -using namespace clang; - -llvm::MemoryBuffer & -MemoryBufferCache::addBuffer(llvm::StringRef Filename, - std::unique_ptr<llvm::MemoryBuffer> Buffer) { - auto Insertion = - Buffers.insert({Filename, BufferEntry{std::move(Buffer), NextIndex++}}); - assert(Insertion.second && "Already has a buffer"); - return *Insertion.first->second.Buffer; -} - -llvm::MemoryBuffer *MemoryBufferCache::lookupBuffer(llvm::StringRef Filename) { - auto I = Buffers.find(Filename); - if (I == Buffers.end()) - return nullptr; - return I->second.Buffer.get(); -} - -bool MemoryBufferCache::isBufferFinal(llvm::StringRef Filename) { - auto I = Buffers.find(Filename); - if (I == Buffers.end()) - return false; - return I->second.Index < FirstRemovableIndex; -} - -bool MemoryBufferCache::tryToRemoveBuffer(llvm::StringRef Filename) { - auto I = Buffers.find(Filename); - assert(I != Buffers.end() && "No buffer to remove..."); - if (I->second.Index < FirstRemovableIndex) - return true; - - Buffers.erase(I); - return false; -} - -void MemoryBufferCache::finalizeCurrentBuffers() { FirstRemovableIndex = NextIndex; } |

