10#include "llvm/Support/MemoryBuffer.h"
19 if (I->second.IsFinal)
26 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
27 auto Insertion = PCMs.insert(std::make_pair(
Filename, std::move(Buffer)));
28 assert(Insertion.second &&
"Already has a PCM");
29 return *Insertion.first->second.Buffer;
34 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
36 assert(!PCM.IsFinal &&
"Trying to override finalized PCM?");
37 assert(!PCM.Buffer &&
"Trying to override tentative PCM?");
38 PCM.Buffer = std::move(Buffer);
48 return I->second.Buffer.get();
61 assert(I != PCMs.end() &&
"PCM to remove is unknown...");
63 auto &PCM = I->second;
64 assert(PCM.Buffer &&
"PCM to remove is scheduled to be built...");
75 assert(I != PCMs.end() &&
"PCM to finalize is unknown...");
77 auto &PCM = I->second;
78 assert(PCM.Buffer &&
"Trying to finalize a dropped PCM...");
State getPCMState(llvm::StringRef Filename) const
Get the state of the PCM.
State
There are four states for a PCM.
llvm::MemoryBuffer & addBuiltPCM(llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Store a just-built PCM under the Filename.
llvm::MemoryBuffer * lookupPCM(llvm::StringRef Filename) const
Get a pointer to the pCM if it exists; else nullptr.
bool isPCMFinal(llvm::StringRef Filename) const
Check whether the PCM is final and has been shown to work.
llvm::MemoryBuffer & addPCM(llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Store the PCM under the Filename.
void finalizePCM(llvm::StringRef Filename)
Mark a PCM as final.
bool tryToDropPCM(llvm::StringRef Filename)
Try to remove a buffer from the cache.
bool shouldBuildPCM(llvm::StringRef Filename) const
Check whether the PCM is waiting to be built.
The JSON file list parser is used to communicate input to InstallAPI.