[PATCH] D51393: Provide a method for generating deterministic IDs for pointers allocated in BumpPtrAllocator

Adrian Prantl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 08:39:47 PDT 2018


aprantl added inline comments.


================
Comment at: llvm/include/llvm/Support/Allocator.h:292
+    const char *P = reinterpret_cast<const char *>(Ptr);
+    for (size_t Idx=0; Idx < Slabs.size(); Idx++) {
+      const char *S = reinterpret_cast<const char *>(Slabs[Idx]);
----------------
clang-format?


================
Comment at: llvm/include/llvm/Support/Allocator.h:295
+      if (P >= S && P < S + computeSlabSize(Idx))
+        return std::make_pair(Idx, P - S);
+    }
----------------
`return {Idx, P - S};`


https://reviews.llvm.org/D51393





More information about the cfe-commits mailing list