#include "clang/Frontend/PrecompiledPreamble.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangStandard.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/FrontendOptions.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Serialization/ASTWriter.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/VirtualFileSystem.h"
#include <limits>
#include <mutex>
#include <utility>
usingnamespaceclang;
namespace {
StringRef getInMemoryPreamblePath() { … }
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
createVFSOverlayForPreamblePCH(StringRef PCHFilename,
std::unique_ptr<llvm::MemoryBuffer> PCHBuffer,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS) { … }
class PreambleDependencyCollector : public DependencyCollector { … };
class MissingFileCollector : public PPCallbacks { … };
class TemporaryFiles { … };
TemporaryFiles &TemporaryFiles::getInstance() { … }
TemporaryFiles::~TemporaryFiles() { … }
void TemporaryFiles::addFile(StringRef File) { … }
void TemporaryFiles::removeFile(StringRef File) { … }
class TempPCHFile { … };
class PrecompilePreambleAction : public ASTFrontendAction { … };
class PrecompilePreambleConsumer : public PCHGenerator { … };
std::unique_ptr<ASTConsumer>
PrecompilePreambleAction::CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) { … }
template <class T> bool moveOnNoError(llvm::ErrorOr<T> Val, T &Output) { … }
}
PreambleBounds clang::ComputePreambleBounds(const LangOptions &LangOpts,
const llvm::MemoryBufferRef &Buffer,
unsigned MaxLines) { … }
class PrecompiledPreamble::PCHStorage { … };
PrecompiledPreamble::~PrecompiledPreamble() = default;
PrecompiledPreamble::PrecompiledPreamble(PrecompiledPreamble &&) = default;
PrecompiledPreamble &
PrecompiledPreamble::operator=(PrecompiledPreamble &&) = default;
llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
const CompilerInvocation &Invocation,
const llvm::MemoryBuffer *MainFileBuffer, PreambleBounds Bounds,
DiagnosticsEngine &Diagnostics,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
std::shared_ptr<PCHContainerOperations> PCHContainerOps, bool StoreInMemory,
StringRef StoragePath, PreambleCallbacks &Callbacks) { … }
PreambleBounds PrecompiledPreamble::getBounds() const { … }
std::size_t PrecompiledPreamble::getSize() const { … }
bool PrecompiledPreamble::CanReuse(const CompilerInvocation &Invocation,
const llvm::MemoryBufferRef &MainFileBuffer,
PreambleBounds Bounds,
llvm::vfs::FileSystem &VFS) const { … }
void PrecompiledPreamble::AddImplicitPreamble(
CompilerInvocation &CI, IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS,
llvm::MemoryBuffer *MainFileBuffer) const { … }
void PrecompiledPreamble::OverridePreamble(
CompilerInvocation &CI, IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS,
llvm::MemoryBuffer *MainFileBuffer) const { … }
PrecompiledPreamble::PrecompiledPreamble(
std::unique_ptr<PCHStorage> Storage, std::vector<char> PreambleBytes,
bool PreambleEndsAtStartOfLine,
llvm::StringMap<PreambleFileHash> FilesInPreamble,
llvm::StringSet<> MissingFiles)
: … { … }
PrecompiledPreamble::PreambleFileHash
PrecompiledPreamble::PreambleFileHash::createForFile(off_t Size,
time_t ModTime) { … }
PrecompiledPreamble::PreambleFileHash
PrecompiledPreamble::PreambleFileHash::createForMemoryBuffer(
const llvm::MemoryBufferRef &Buffer) { … }
void PrecompiledPreamble::configurePreamble(
PreambleBounds Bounds, CompilerInvocation &CI,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS,
llvm::MemoryBuffer *MainFileBuffer) const { … }
void PrecompiledPreamble::setupPreambleStorage(
const PCHStorage &Storage, PreprocessorOptions &PreprocessorOpts,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> &VFS) { … }
void PreambleCallbacks::BeforeExecute(CompilerInstance &CI) { … }
void PreambleCallbacks::AfterExecute(CompilerInstance &CI) { … }
void PreambleCallbacks::AfterPCHEmitted(ASTWriter &Writer) { … }
void PreambleCallbacks::HandleTopLevelDecl(DeclGroupRef DG) { … }
std::unique_ptr<PPCallbacks> PreambleCallbacks::createPPCallbacks() { … }
CommentHandler *PreambleCallbacks::getCommentHandler() { … }
static llvm::ManagedStatic<BuildPreambleErrorCategory> BuildPreambleErrCategory;
std::error_code clang::make_error_code(BuildPreambleError Error) { … }
const char *BuildPreambleErrorCategory::name() const noexcept { … }
std::string BuildPreambleErrorCategory::message(int condition) const { … }