[PATCH] D123436: [Clang] Pass llvm::BitstreamCursor by reference. NFC

Jun Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 8 19:45:56 PDT 2022


junaire created this revision.
junaire added reviewers: aaron.ballman, RKSimon, dblaikie.
Herald added a subscriber: arphaman.
Herald added a project: All.
junaire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

BitstreamCursors are heavy-weight objects that should not be passed by value.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123436

Files:
  clang/include/clang/Serialization/GlobalModuleIndex.h
  clang/lib/Serialization/GlobalModuleIndex.cpp


Index: clang/lib/Serialization/GlobalModuleIndex.cpp
===================================================================
--- clang/lib/Serialization/GlobalModuleIndex.cpp
+++ clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -127,7 +127,7 @@
 
 GlobalModuleIndex::GlobalModuleIndex(
     std::unique_ptr<llvm::MemoryBuffer> IndexBuffer,
-    llvm::BitstreamCursor Cursor)
+    llvm::BitstreamCursor &Cursor)
     : Buffer(std::move(IndexBuffer)), IdentifierIndex(), NumIdentifierLookups(),
       NumIdentifierLookupHits() {
   auto Fail = [&](llvm::Error &&Err) {
Index: clang/include/clang/Serialization/GlobalModuleIndex.h
===================================================================
--- clang/include/clang/Serialization/GlobalModuleIndex.h
+++ clang/include/clang/Serialization/GlobalModuleIndex.h
@@ -113,7 +113,7 @@
 
   /// Internal constructor. Use \c readIndex() to read an index.
   explicit GlobalModuleIndex(std::unique_ptr<llvm::MemoryBuffer> Buffer,
-                             llvm::BitstreamCursor Cursor);
+                             llvm::BitstreamCursor &Cursor);
 
   GlobalModuleIndex(const GlobalModuleIndex &) = delete;
   GlobalModuleIndex &operator=(const GlobalModuleIndex &) = delete;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123436.421672.patch
Type: text/x-patch
Size: 1223 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220409/9e38e2ed/attachment.bin>


More information about the cfe-commits mailing list