[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    [PATCH] D43322: Diagnose cases of "return x" that should be "return std::move(x)" for efficiency
From:       Arthur O'Dwyer via Phabricator via cfe-commits <cfe-commits () lists ! llvm ! org>
Date:       2018-02-28 21:39:28
Message-ID: d7ef9fb8ba9f5e5801a7175a835745f2 () localhost ! localdomain
[Download RAW message or body]

Quuxplusone added inline comments.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5639
+  "local variable %0 will be copied despite being %select{returned|thrown}1 by \
name">, +  InGroup<ReturnStdMove>, DefaultIgnore;
+def note_add_std_move : Note<
----------------
I would like some guidance on whether it would be appropriate to turn this warning on \
as part of `-Wmove`.


================
Comment at: lib/Sema/SemaStmt.cpp:3083
+        Diag(Value->getExprLoc(), diag::warn_return_std_move_in_cxx11)
+            << Value->getSourceRange()
+            << NRVOCandidate->getDeclName() << ResultType << QT;
----------------
This source range does the right thing; thanks @rtrieu!


Repository:
  rC Clang

https://reviews.llvm.org/D43322



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic