[PATCH] D49133: Add CachedHashStringRef::data().

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 07:14:09 PDT 2018


ruiu created this revision.
ruiu added a reviewer: grimar.
Herald added a subscriber: dexonsmith.

This accessor is useful and could be slightly more efficient than
Str.val().data() because you can avoid StringRef instantiation.


https://reviews.llvm.org/D49133

Files:
  llvm/include/llvm/ADT/CachedHashString.h


Index: llvm/include/llvm/ADT/CachedHashString.h
===================================================================
--- llvm/include/llvm/ADT/CachedHashString.h
+++ llvm/include/llvm/ADT/CachedHashString.h
@@ -43,6 +43,7 @@
   }
 
   StringRef val() const { return StringRef(P, Size); }
+  const char *data() const { return P; }
   uint32_t size() const { return Size; }
   uint32_t hash() const { return Hash; }
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49133.154799.patch
Type: text/x-patch
Size: 417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180710/f0827550/attachment.bin>


More information about the llvm-commits mailing list