[llvm] a5f4794 - [SmallString] Use data() instead of begin() (NFC)
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 21:04:50 PST 2020
Author: Jonas Devlieghere
Date: 2020-01-30T20:15:38-08:00
New Revision: a5f479473b228605c067128f884894f8bef48e48
URL: https://github.com/llvm/llvm-project/commit/a5f479473b228605c067128f884894f8bef48e48
DIFF: https://github.com/llvm/llvm-project/commit/a5f479473b228605c067128f884894f8bef48e48.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/ADT/SmallString.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/SmallString.h b/llvm/include/llvm/ADT/SmallString.h
index 667cb3b419af..cd6f2173d04f 100644
--- a/llvm/include/llvm/ADT/SmallString.h
+++ b/llvm/include/llvm/ADT/SmallString.h
@@ -263,7 +263,7 @@ class SmallString : public SmallVector<char, InternalLen> {
// Extra methods.
/// 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...
const char* c_str() {
@@ -276,7 +276,7 @@ class SmallString : public SmallVector<char, InternalLen> {
operator StringRef() const { return str(); }
explicit operator std::string() const {
- return std::string(this->begin(), this->size());
+ return std::string(this->data(), this->size());
}
// Extra operators.
More information about the llvm-commits
mailing list