[PATCH] D40824: toString function take a const refs where possible

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 20:44:02 PST 2017


sbc100 added inline comments.


================
Comment at: Common/Reproduce.cpp:58
 
-std::string lld::toString(opt::Arg *Arg) {
-  std::string K = Arg->getSpelling();
-  if (Arg->getNumValues() == 0)
+std::string lld::toString(const opt::Arg &Arg) {
+  std::string K = Arg.getSpelling();
----------------
ruiu wrote:
> Did you have to change * to &?
Its not necessary, but its consistent with the rest of the code here and in llvm (although they use operator<< on streams there it seems).

Its also a nice hint the reader that this function doesn't accept null isn't it? 

If you like I can revert this part.


https://reviews.llvm.org/D40824





More information about the llvm-commits mailing list