junaire added inline comments.

================
Comment at: clang/lib/Serialization/GlobalModuleIndex.cpp:130
     std::unique_ptr<llvm::MemoryBuffer> IndexBuffer,
-    llvm::BitstreamCursor Cursor)
+    llvm::BitstreamCursor &Cursor)
     : Buffer(std::move(IndexBuffer)), IdentifierIndex(), 
NumIdentifierLookups(),
----------------
RKSimon wrote:
> You're not passing this as a const, so the calling function's Cursor will be 
> updated - this doesn't sound generally safe to me - what about a move?
> You're not passing this as a const, so the calling function's Cursor will be 
> updated - this doesn't sound generally safe to me - what about a move?

IIUC, `GlobalModuleIndex::GlobalModuleIndex` is a private function that has 
only been called by `GlobalModuleIndex::readIndex`, and the `Cursor` object has 
only one consumer (`GlobalModuleIndex::readIndex`), so I guess there should not 
be any unsafe concern.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123436/new/

https://reviews.llvm.org/D123436

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

Reply via email to