summaryrefslogtreecommitdiff
path: root/include/clang/Frontend/PrecompiledPreamble.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/PrecompiledPreamble.h')
-rw-r--r--include/clang/Frontend/PrecompiledPreamble.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/include/clang/Frontend/PrecompiledPreamble.h b/include/clang/Frontend/PrecompiledPreamble.h
index 130fe60704a74..6abdbe3a1e1b1 100644
--- a/include/clang/Frontend/PrecompiledPreamble.h
+++ b/include/clang/Frontend/PrecompiledPreamble.h
@@ -38,7 +38,7 @@ class CompilerInvocation;
class DeclGroupRef;
class PCHContainerOperations;
-/// \brief Runs lexer to compute suggested preamble bounds.
+/// Runs lexer to compute suggested preamble bounds.
PreambleBounds ComputePreambleBounds(const LangOptions &LangOpts,
llvm::MemoryBuffer *Buffer,
unsigned MaxLines);
@@ -53,7 +53,7 @@ class PrecompiledPreamble {
struct PreambleFileHash;
public:
- /// \brief Try to build PrecompiledPreamble for \p Invocation. See
+ /// Try to build PrecompiledPreamble for \p Invocation. See
/// BuildPreambleError for possible error codes.
///
/// \param Invocation Original CompilerInvocation with options to compile the
@@ -104,14 +104,22 @@ public:
/// Changes options inside \p CI to use PCH from this preamble. Also remaps
/// main file to \p MainFileBuffer and updates \p VFS to ensure the preamble
/// is accessible.
- /// For in-memory preambles, PrecompiledPreamble instance continues to own
- /// the MemoryBuffer with the Preamble after this method returns. The caller
- /// is reponsible for making sure the PrecompiledPreamble instance outlives
- /// the compiler run and the AST that will be using the PCH.
+ /// Requires that CanReuse() is true.
+ /// For in-memory preambles, PrecompiledPreamble instance continues to own the
+ /// MemoryBuffer with the Preamble after this method returns. The caller is
+ /// responsible for making sure the PrecompiledPreamble instance outlives the
+ /// compiler run and the AST that will be using the PCH.
void AddImplicitPreamble(CompilerInvocation &CI,
IntrusiveRefCntPtr<vfs::FileSystem> &VFS,
llvm::MemoryBuffer *MainFileBuffer) const;
+ /// Configure \p CI to use this preamble.
+ /// Like AddImplicitPreamble, but doesn't assume CanReuse() is true.
+ /// If this preamble does not match the file, it may parse differently.
+ void OverridePreamble(CompilerInvocation &CI,
+ IntrusiveRefCntPtr<vfs::FileSystem> &VFS,
+ llvm::MemoryBuffer *MainFileBuffer) const;
+
private:
PrecompiledPreamble(PCHStorage Storage, std::vector<char> PreambleBytes,
bool PreambleEndsAtStartOfLine,
@@ -222,6 +230,12 @@ private:
}
};
+ /// Helper function to set up PCH for the preamble into \p CI and \p VFS to
+ /// with the specified \p Bounds.
+ void configurePreamble(PreambleBounds Bounds, CompilerInvocation &CI,
+ IntrusiveRefCntPtr<vfs::FileSystem> &VFS,
+ llvm::MemoryBuffer *MainFileBuffer) const;
+
/// Sets up the PreprocessorOptions and changes VFS, so that PCH stored in \p
/// Storage is accessible to clang. This method is an implementation detail of
/// AddImplicitPreamble.
@@ -275,7 +289,6 @@ enum class BuildPreambleError {
PreambleIsEmpty = 1,
CouldntCreateTempFile,
CouldntCreateTargetInfo,
- CouldntCreateVFSOverlay,
BeginSourceFileFailed,
CouldntEmitPCH
};