@@ -285,7 +285,7 @@ class Twine {
285285 }
286286
287287 // / Construct from a StringRef.
288- /* implicit*/ Twine(StringRef Str) : LHSKind(PtrAndLengthKind) {
288+ /* implicit*/ Twine(const StringRef & Str) : LHSKind(PtrAndLengthKind) {
289289 LHS.ptrAndLength .ptr = Str.data ();
290290 LHS.ptrAndLength .length = Str.size ();
291291 assert (isValid () && " Invalid twine!" );
@@ -352,7 +352,7 @@ class Twine {
352352 // right thing. Yet.
353353
354354 // / Construct as the concatenation of a C string and a StringRef.
355- /* implicit*/ Twine(const char *LHS, StringRef RHS)
355+ /* implicit*/ Twine(const char *LHS, const StringRef & RHS)
356356 : LHSKind(CStringKind), RHSKind(PtrAndLengthKind) {
357357 this ->LHS .cString = LHS;
358358 this ->RHS .ptrAndLength .ptr = RHS.data ();
@@ -361,7 +361,7 @@ class Twine {
361361 }
362362
363363 // / Construct as the concatenation of a StringRef and a C string.
364- /* implicit*/ Twine(StringRef LHS, const char *RHS)
364+ /* implicit*/ Twine(const StringRef & LHS, const char *RHS)
365365 : LHSKind(PtrAndLengthKind), RHSKind(CStringKind) {
366366 this ->LHS .ptrAndLength .ptr = LHS.data ();
367367 this ->LHS .ptrAndLength .length = LHS.size ();
@@ -530,14 +530,14 @@ inline Twine operator+(const Twine &LHS, const Twine &RHS) {
530530// / Additional overload to guarantee simplified codegen; this is equivalent to
531531// / concat().
532532
533- inline Twine operator +(const char *LHS, StringRef RHS) {
533+ inline Twine operator +(const char *LHS, const StringRef & RHS) {
534534 return Twine (LHS, RHS);
535535}
536536
537537// / Additional overload to guarantee simplified codegen; this is equivalent to
538538// / concat().
539539
540- inline Twine operator +(StringRef LHS, const char *RHS) {
540+ inline Twine operator +(const StringRef & LHS, const char *RHS) {
541541 return Twine (LHS, RHS);
542542}
543543
0 commit comments