Todd Lipcon has posted comments on this change.

Change subject: ref_counted: fix move constructors to actually move
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/8002/2/src/kudu/gutil/ref_counted.h
File src/kudu/gutil/ref_counted.h:

PS2, Line 252:   // Move constructor. This is required in addition to the 
conversion
             :   // constructor below in order for clang to warn about 
pessimizing moves.
> After adding this, did you run clang-tidy across the codebase to see these 
seems they are emitted during normal compilation. I tried adding this code to a 
random unit test:

scoped_refptr<RefCountedBytes> foo() {
  scoped_refptr<RefCountedBytes> bar;
  return std::move(bar);
}

and with the patch it output:

../../src/kudu/util/string_case-test.cc:32:10: warning: moving a local object 
in a return statement prevents copy elision [-Wpessimizing-move]
  return std::move(bar);
         ^
../../src/kudu/util/string_case-test.cc:32:10: note: remove std::move call here
  return std::move(bar);
         ^~~~~~~~~~   ~
1 warning generated.

(before the patch it output nothing)


-- 
To view, visit http://gerrit.cloudera.org:8080/8002
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6b6b6753ab16221e065900eba5a7c178975d38a6
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Dan Burkert <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <[email protected]>
Gerrit-HasComments: Yes

Reply via email to