[PATCH] D39842: Allow to store precompiled preambles in memory.

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 10 07:30:24 PST 2017

klimek added inline comments.

Comment at: include/clang/Frontend/PrecompiledPreamble.h:99
   /// Changes options inside \p CI to use PCH from this preamble. Also remaps
-  /// main file to \p MainFileBuffer.
+  /// main file to \p MainFileBuffer and updates \p VFS to ensure preamble is
+  /// accessible.
...ensure *the* preamble...

Comment at: lib/Frontend/ASTUnit.cpp:1028
+    IntrusiveRefCntPtr<vfs::FileSystem> OldVFS = VFS;
+    Preamble->AddImplicitPreamble(*CCInvocation, /*ref*/ VFS,
+                                  OverrideMainBuffer.get());
Since when are we using the /*ref*/ annotation?

Comment at: lib/Frontend/PrecompiledPreamble.cpp:206
+  std::unique_ptr<std::string> Storage;
+  if (InMemStorage) {
+    OS = llvm::make_unique<llvm::raw_string_ostream>(*InMemStorage);
It looks like we should pass in the output stream, not the storage?

Comment at: lib/Frontend/PrecompiledPreamble.cpp:490
   PreprocessorOpts.DisablePCHValidation = true;
+  if (Storage.getKind() == PCHStorage::Kind::TempFile) {
+    const TempPCHFile &PCHFile = Storage.asFile();
This looks a bit like we should push it into the PCHStorage.


More information about the cfe-commits mailing list