OSDN Git Service

Add CachedHashStringRef::data().
authorRui Ueyama <ruiu@google.com>
Tue, 10 Jul 2018 15:10:49 +0000 (15:10 +0000)
committerRui Ueyama <ruiu@google.com>
Tue, 10 Jul 2018 15:10:49 +0000 (15:10 +0000)
This accessor is useful and could be slightly more efficient than
Str.val().data() because you can avoid StringRef instantiation.

Differential Revision: https://reviews.llvm.org/D49133

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336683 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/CachedHashString.h

index a56a621..d8f0e7a 100644 (file)
@@ -43,6 +43,7 @@ public:
   }
 
   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; }
 };