Lines Matching refs:reference
22 const ExpensiveToCopyType &reference() const;
37 using reference = T&;
50 reference at(int) const;
58 const TrivialToCopyType &reference() const;
85 // CHECK-MESSAGES: [[@LINE-1]]:14: warning: the const qualified variable 'AutoAssigned' is copy-constructed from a const reference; consider making it a const reference [performance-unnecessary-copy-initialization]
107 // CHECK-MESSAGES: [[@LINE-1]]:14: warning: the const qualified variable 'AutoAssigned' is copy-constructed from a const reference; consider making it a const reference [performance-unnecessary-copy-initialization]
128 const auto AutoAssigned = Obj.reference();
130 // CHECK-FIXES: const auto& AutoAssigned = Obj.reference();
133 const auto AutoCopyConstructed(Obj.reference());
135 // CHECK-FIXES: const auto& AutoCopyConstructed(Obj.reference());
138 const ExpensiveToCopyType VarAssigned = Obj.reference();
140 // CHECK-FIXES: const ExpensiveToCopyType& VarAssigned = Obj.reference();
143 const ExpensiveToCopyType VarCopyConstructed(Obj.reference());
145 // CHECK-FIXES: const ExpensiveToCopyType& VarCopyConstructed(Obj.reference());
150 const auto AutoAssigned = Obj.reference();
152 // CHECK-FIXES: const auto& AutoAssigned = Obj.reference();
155 const auto AutoCopyConstructed(Obj.reference());
157 // CHECK-FIXES: const auto& AutoCopyConstructed(Obj.reference());
160 const ExpensiveToCopyType VarAssigned = Obj.reference();
162 // CHECK-FIXES: const ExpensiveToCopyType& VarAssigned = Obj.reference();
165 const ExpensiveToCopyType VarCopyConstructed(Obj.reference());
167 // CHECK-FIXES: const ExpensiveToCopyType& VarCopyConstructed(Obj.reference());
172 const auto AutoAssigned = Obj->reference();
174 // CHECK-FIXES: const auto& AutoAssigned = Obj->reference();
177 const auto AutoCopyConstructed(Obj->reference());
179 // CHECK-FIXES: const auto& AutoCopyConstructed(Obj->reference());
182 const ExpensiveToCopyType VarAssigned = Obj->reference();
184 // CHECK-FIXES: const ExpensiveToCopyType& VarAssigned = Obj->reference();
187 const ExpensiveToCopyType VarCopyConstructed(Obj->reference());
189 // CHECK-FIXES: const ExpensiveToCopyType& VarCopyConstructed(Obj->reference());
305 const auto UnnecessaryCopy = Obj.reference();
307 // CHECK-FIXES: const auto& UnnecessaryCopy = Obj.reference();
313 const ExpensiveToCopyType &ConstReference = Obj.reference();
314 const auto UnnecessaryCopy = ConstReference.reference();
316 // CHECK-FIXES: const auto& UnnecessaryCopy = ConstReference.reference();
323 const auto UnnecessaryCopy = ConstPointer->reference();
325 // CHECK-FIXES: const auto& UnnecessaryCopy = ConstPointer->reference();
337 static const auto StaticVar = Obj.reference();
342 // CHECK-MESSAGES: [[@LINE-1]]:8: warning: the variable 'AutoAssigned' is copy-constructed from a const reference but is only used as const reference; consider making it a const reference [performance-unnecessary-copy-initialization]
364 auto Assigned = Obj.reference();
366 // CHECK-FIXES: const auto& Assigned = Obj.reference();
367 Assigned.reference();
384 auto NonConstInvoked = Obj.reference();
385 // CHECK-FIXES: auto NonConstInvoked = Obj.reference();
389 auto Reassigned = Obj.reference();
390 // CHECK-FIXES: auto Reassigned = Obj.reference();
394 auto MutatedByReference = Obj.reference();
395 // CHECK-FIXES: auto MutatedByReference = Obj.reference();
399 auto MutatedByPointer = Obj.reference();
400 // CHECK-FIXES: auto MutatedByPointer = Obj.reference();
406 const auto AutoAssigned = Obj.reference();
408 // CHECK-FIXES: const auto& AutoAssigned = Obj.reference();
413 const auto AutoAssigned = Obj.reference();
414 const auto AutoCopyConstructed(Obj.reference());
415 const ExpensiveToCopyType VarAssigned = Obj.reference();
416 const ExpensiveToCopyType VarCopyConstructed(Obj.reference());
421 const auto AutoAssigned = Obj.reference();
423 // CHECK-FIXES: const auto& AutoAssigned = Obj.reference();
429 const auto AutoAssigned = Obj.reference();
433 const auto AutoAssigned = Obj->reference();
435 // CHECK-FIXES: const auto& AutoAssigned = Obj->reference();
441 const auto AutoAssigned = Obj->reference();
442 const auto AutoCopyConstructed(Obj->reference());
443 const ExpensiveToCopyType VarAssigned = Obj->reference();
444 const ExpensiveToCopyType VarCopyConstructed(Obj->reference());
450 const auto AutoAssigned = LocalVar.reference();
452 // CHECK-FIXES: const auto& AutoAssigned = LocalVar.reference();
458 const auto AutoAssigned = Obj.reference();
469 auto AssignedInMacro = T.reference(); \
472 // CHECK-FIXES: auto AssignedInMacro = T.reference();
480 UNNECESSARY_COPY_INIT_IN_MACRO_ARGUMENT(auto CopyInMacroArg = Obj.reference());
483 // CHECK-FIXES: auto CopyInMacroArg = Obj.reference()
689 auto Copy = Orig.reference();
690 // CHECK-MESSAGES: [[@LINE-1]]:8: warning: the variable 'Copy' is copy-constructed from a const reference
691 // CHECK-FIXES: const auto& Copy = Orig.reference();
698 auto Copy = Orig.reference();
721 const auto &Ref = Orig.reference();
722 const auto NecessaryCopy = Ref.reference();
731 const auto NecessaryCopy = Pointer->reference();
738 // The typedef hides the fact that this is a reference type. The check needs
740 ReferenceType Ref = Orig.reference();
741 const auto NecessaryCopy = Ref.reference();
747 const auto &Ref = Orig.reference();
748 auto UnnecessaryCopy = Ref.reference();
750 // CHECK-FIXES: const auto& UnnecessaryCopy = Ref.reference();
758 // CHECK-MESSAGES: [[@LINE-1]]:14: warning: the const qualified variable 'AutoAssigned' is copy-constructed from a const reference but is never used; consider removing the statement [performance-unnecessary-copy-initialization]
762 // CHECK-MESSAGES: [[@LINE-1]]:8: warning: the variable 'TrailingCommentRemoved' is copy-constructed from a const reference but is never used;
857 // conversion, so converting this to a reference might not work.
875 // This template instantiation would not compile if the `AmbiguousCopy` above was made a reference.
888 // CHECK-MESSAGES: [[@LINE-1]]:5: warning: the variable 'UnnecessaryCopy2' is copy-constructed from a const reference
893 // CHECK-MESSAGES: [[@LINE-1]]:5: warning: the variable 'UnnecessaryCopy3' is copy-constructed from a const reference