Index: include/llvm/ADT/StringRef.h =================================================================== --- include/llvm/ADT/StringRef.h +++ include/llvm/ADT/StringRef.h @@ -40,6 +40,7 @@ class StringRef { public: typedef const char *iterator; + typedef const unsigned char *uiterator; typedef const char *const_iterator; static const size_t npos = ~size_t(0); typedef size_t size_type; @@ -88,8 +89,10 @@ /// @{ iterator begin() const { return Data; } + uiterator ubegin() const { return reinterpret_cast(begin()); } iterator end() const { return Data + Length; } + uiterator uend() const { return reinterpret_cast(end()); } /// @} /// @name String Operations Index: include/llvm/IR/Metadata.h =================================================================== --- include/llvm/IR/Metadata.h +++ include/llvm/IR/Metadata.h @@ -55,12 +55,15 @@ unsigned getLength() const { return (unsigned)getName().size(); } typedef StringRef::iterator iterator; + typedef StringRef::uiterator uiterator; /// \brief Pointer to the first byte of the string. iterator begin() const { return getName().begin(); } + uiterator ubegin() const { return getName().ubegin(); } /// \brief Pointer to one byte past the end of the string. iterator end() const { return getName().end(); } + uiterator uend() const { return getName().uend(); } /// \brief Methods for support type inquiry through isa, cast, and dyn_cast. static bool classof(const Value *V) {