clang-tools
8.0.0
|
An LRU cache of idle ASTs. More...
Public Types | |
using | Key = const ASTWorker * |
Public Member Functions | |
ASTCache (unsigned MaxRetainedASTs) | |
std::size_t | getUsedBytes (Key K) |
Returns result of getUsedBytes() for the AST cached by K . More... | |
void | put (Key K, std::unique_ptr< ParsedAST > V) |
Store the value in the pool, possibly removing the last used AST. More... | |
llvm::Optional< std::unique_ptr< ParsedAST > > | take (Key K) |
Returns the cached value for K , or llvm::None if the value is not in the cache anymore. More... | |
An LRU cache of idle ASTs.
Because we want to limit the overall number of these we retain, the cache owns ASTs (and may evict them) while their workers are idle. Workers borrow ASTs when active, and return them when done.
Definition at line 79 of file TUScheduler.cpp.
using clang::clangd::TUScheduler::ASTCache::Key = const ASTWorker * |
Definition at line 81 of file TUScheduler.cpp.
|
inline |
Definition at line 83 of file TUScheduler.cpp.
|
inline |
Returns result of getUsedBytes() for the AST cached by K
.
If no AST is cached, 0 is returned.
Definition at line 87 of file TUScheduler.cpp.
Store the value in the pool, possibly removing the last used AST.
The value should not be in the pool when this function is called.
Definition at line 97 of file TUScheduler.cpp.
|
inline |
Returns the cached value for K
, or llvm::None if the value is not in the cache anymore.
If nullptr was cached for K
, this function will return a null unique_ptr wrapped into an optional.
Definition at line 115 of file TUScheduler.cpp.
References FileName, and clang::clangd::None.