diff options
| author | John McCall <rjmccall@apple.com> | 2011-05-13 23:58:45 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2011-05-13 23:58:45 +0000 |
| commit | 8a2548f6e03b198ece8e862720d9757cf4f5b6e2 (patch) | |
| tree | c0a79a6c831c8ee96a3c879d1062d2e03c73f26d /llvm/include | |
| parent | c8134cee012f738ef8964fc198a3a169a38c33c1 (diff) | |
| download | bcm5719-llvm-8a2548f6e03b198ece8e862720d9757cf4f5b6e2.tar.gz bcm5719-llvm-8a2548f6e03b198ece8e862720d9757cf4f5b6e2.zip | |
Add an operator+= for appending StringRefs onto std::strings.
Previously this pattern would be compiled using an implicit conversion
to std::string.
llvm-svn: 131325
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/ADT/StringRef.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h index 1766d2b9f2d..dcc6aa2897c 100644 --- a/llvm/include/llvm/ADT/StringRef.h +++ b/llvm/include/llvm/ADT/StringRef.h @@ -447,6 +447,10 @@ namespace llvm { return LHS.compare(RHS) != -1; } + inline std::string &operator+=(std::string &buffer, llvm::StringRef string) { + return buffer.append(string.data(), string.size()); + } + /// @} // StringRefs can be treated like a POD type. |

