This repository was archived by the owner on Nov 1, 2021. It is now read-only.
File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ class PrecompiledPreamble {
98
98
// / Changes options inside \p CI to use PCH from this preamble. Also remaps
99
99
// / main file to \p MainFileBuffer and updates \p VFS to ensure the preamble
100
100
// / is accessible.
101
+ // / For in-memory preambles, PrecompiledPreamble instance continues to own
102
+ // / the MemoryBuffer with the Preamble after this method returns. The caller
103
+ // / is reponsible for making sure the PrecompiledPreamble instance outlives
104
+ // / the compiler run and the AST that will be using the PCH.
101
105
void AddImplicitPreamble (CompilerInvocation &CI,
102
106
IntrusiveRefCntPtr<vfs::FileSystem> &VFS,
103
107
llvm::MemoryBuffer *MainFileBuffer) const ;
Original file line number Diff line number Diff line change @@ -699,9 +699,7 @@ void PrecompiledPreamble::setupPreambleStorage(
699
699
StringRef PCHPath = getInMemoryPreamblePath ();
700
700
PreprocessorOpts.ImplicitPCHInclude = PCHPath;
701
701
702
- // FIMXE(ibiryukov): Preambles can be large. We should allow shared access
703
- // to the preamble data instead of copying it here.
704
- auto Buf = llvm::MemoryBuffer::getMemBufferCopy (Storage.asMemory ().Data );
702
+ auto Buf = llvm::MemoryBuffer::getMemBuffer (Storage.asMemory ().Data );
705
703
VFS = createVFSOverlayForPreamblePCH (PCHPath, std::move (Buf), VFS);
706
704
}
707
705
}
You can’t perform that action at this time.
0 commit comments