v.g.vassilev added a comment.

We have this pattern:

  FileID FID;
  const clang::FileEntry* FE
    = SM.getFileManager().getVirtualFile(source_name.str(), InputSize,
                                         0 /* mod time*/);
  SM.overrideFileContents(FE, std::move(MB)); // MB is a llvm::MemoryBuffer
  FID = SM.createFileID(FE, NewLoc, SrcMgr::C_User);
  
  ...
  
  PP.EnterSourceFile(FID, /*DirLookup*/0, NewLoc); // PP is a 
clang::Preprocessor

If the memory buffer contains eg. '//expected-error: ...' this forces the 
ContentCache to compute some source location information IIRC. This leads in 
hitting the disk, ignoring the fact that this is a virtual file with an 
overridden content.

I will try to come up with a test but I may need to land some interpreter 
infrastructure first...


https://reviews.llvm.org/D33275



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to