forked from OSchip/llvm-project
[SmallString] Use data() instead of begin() (NFC)
Both begin() and data() do the same thing for the SmallString case, but the std::string and llvm::StringRef constructors that are being called are defined as taking a pointer and size. Addresses Craig Topper's feedback in https://reviews.llvm.org/D73640
This commit is contained in:
parent
cfebd77742
commit
a5f479473b
|
@ -263,7 +263,7 @@ public:
|
||||||
// Extra methods.
|
// Extra methods.
|
||||||
|
|
||||||
/// Explicit conversion to StringRef.
|
/// Explicit conversion to StringRef.
|
||||||
StringRef str() const { return StringRef(this->begin(), this->size()); }
|
StringRef str() const { return StringRef(this->data(), this->size()); }
|
||||||
|
|
||||||
// TODO: Make this const, if it's safe...
|
// TODO: Make this const, if it's safe...
|
||||||
const char* c_str() {
|
const char* c_str() {
|
||||||
|
@ -276,7 +276,7 @@ public:
|
||||||
operator StringRef() const { return str(); }
|
operator StringRef() const { return str(); }
|
||||||
|
|
||||||
explicit operator std::string() const {
|
explicit operator std::string() const {
|
||||||
return std::string(this->begin(), this->size());
|
return std::string(this->data(), this->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra operators.
|
// Extra operators.
|
||||||
|
|
Loading…
Reference in New Issue