Hello Mike Percy, Kudu Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/8502
to look at the new patch set (#2).
Change subject: stopwatch: avoid clang use-after-move warnings in LOG_TIMING
macros
......................................................................
stopwatch: avoid clang use-after-move warnings in LOG_TIMING macros
As seen in [1] the implementation of LOG_TIMING was confusing
clang-tidy's use-after-move detection, since it relied on a
single-iteration for loop. Although the loop always ran for exactly one
iteration, clang-tidy wasn't smart enough to identify that, and thus any
std::move inside the loop would be analyzed as if it could run twice
(which would be an error).
This detects the case that the code is being analyzed and removes the
timing macro definitions.
A new test case produces the following clang-tidy warning without the
fix:
logging-test.cc:242:18: warning: 's1' used after it was moved
[misc-use-after-move]
LOG(INFO) << s1;
^
logging-test.cc:243:8: note: move occurred here
s2 = std::move(s1);
^
logging-test.cc:242:18: note: the use happens in a later loop iteration than
the move
LOG(INFO) << s1;
^
With the fix, clang-tidy is clean.
[1] https://gerrit.cloudera.org/c/8352/8/src/kudu/fs/fs_manager.cc#372
Change-Id: I4ee030291d54cde0d846ceec6b8610ef051ffafa
---
M build-support/clang_tidy_gerrit.py
M src/kudu/util/logging-test.cc
M src/kudu/util/stopwatch.h
3 files changed, 41 insertions(+), 1 deletion(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/02/8502/2
--
To view, visit http://gerrit.cloudera.org:8080/8502
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4ee030291d54cde0d846ceec6b8610ef051ffafa
Gerrit-Change-Number: 8502
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Mike Percy <[email protected]>
Gerrit-Reviewer: Todd Lipcon <[email protected]>