Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Issue 2692853008: Use universal references in templated analysis passthrough functions. (Closed)

Created:
3 years, 10 months ago by Kevin M
Modified:
3 years, 10 months ago
Reviewers:
danakj, Wez
CC:
chromium-reviews, vmpstr+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use universal references in templated analysis passthrough functions. The ANALYSIS_ASSUME_TRUE macros must support lvalues and rvalues without copying. Currently we are taking arguments by-value; this does not work for things like null checks on unique_ptr (DCHECK(my_unique_ptr)). Taking a non-const reference doesn't work either, as one cannot take a reference to an rvalue parameter. Multiple definitions for by-val and by-ref don't work, because the choice between TVal and TVal& is too ambiguous for the compiler. Universal references work nicely in this case because they allow lvalue and rvalue parameters to be taken without making copies or the need for adding overloads. Also added ANALYSIS_ASSUME_TRUE to DCHECK_OP implementation bodies. This prevents the static analyzer from proceeding if a comparison- based DCHECK fails, which is a static assertion that the asserted condition will always hold. R=danakj@chromium.org,wez@chromium.org BUG=687243 Review-Url: https://codereview.chromium.org/2692853008 Cr-Commit-Position: refs/heads/master@{#452351} Committed: https://chromium.googlesource.com/chromium/src/+/549cad5d1141989cc3cac9ae7161984b40ae5607

Patch Set 1 #

Total comments: 4

Patch Set 2 : danakj #2 #

Total comments: 2

Patch Set 3 : danakj#7 #

Total comments: 2

Patch Set 4 : Perfect forwarding #

Patch Set 5 : perfect forwarding #

Total comments: 2

Patch Set 6 : memory => utility for std::forward #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -4 lines) Patch
M base/logging.h View 1 2 3 4 5 1 chunk +8 lines, -4 lines 0 comments Download

Messages

Total messages: 27 (9 generated)
Kevin M
3 years, 10 months ago (2017-02-14 19:53:52 UTC) #1
danakj
https://codereview.chromium.org/2692853008/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/1/base/logging.h#newcode301 base/logging.h:301: // An rvalue parameter is used because it allows ...
3 years, 10 months ago (2017-02-14 20:09:17 UTC) #2
Kevin M
See https://codereview.chromium.org/2691243004 for the forked DCHECK_OP CL. https://codereview.chromium.org/2692853008/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/1/base/logging.h#newcode301 base/logging.h:301: // An ...
3 years, 10 months ago (2017-02-14 21:05:09 UTC) #4
danakj
Hm, this kept both parts tho still, maybe its not ready yet? The description has ...
3 years, 10 months ago (2017-02-14 21:10:10 UTC) #5
Kevin M
Ah, I guess I misunderstood what you meant. Removing the '&&' is incompatible with move-only ...
3 years, 10 months ago (2017-02-14 21:57:50 UTC) #6
danakj
On Tue, Feb 14, 2017 at 4:57 PM, <kmarshall@chromium.org> wrote: > Ah, I guess I ...
3 years, 10 months ago (2017-02-14 21:59:22 UTC) #7
Kevin M
OK, done. :) https://codereview.chromium.org/2692853008/diff/20001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/20001/base/logging.h#newcode304 base/logging.h:304: inline constexpr TVal AnalysisAssumeTrue(TVal arg) { ...
3 years, 10 months ago (2017-02-14 22:07:48 UTC) #8
danakj
https://codereview.chromium.org/2692853008/diff/40001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/40001/base/logging.h#newcode639 base/logging.h:639: if (ANALYZER_ASSUME_TRUE(v1 op v2)) \ This is the other ...
3 years, 10 months ago (2017-02-14 22:09:39 UTC) #9
Kevin M
https://codereview.chromium.org/2692853008/diff/40001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/40001/base/logging.h#newcode639 base/logging.h:639: if (ANALYZER_ASSUME_TRUE(v1 op v2)) \ On 2017/02/14 22:09:39, danakj ...
3 years, 10 months ago (2017-02-14 22:29:17 UTC) #10
danakj
LGTM
3 years, 10 months ago (2017-02-14 22:39:04 UTC) #11
danakj
https://codereview.chromium.org/2692853008/diff/80001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/80001/base/logging.h#newcode12 base/logging.h:12: #include <memory> forward is in <utility> tho
3 years, 10 months ago (2017-02-14 22:39:32 UTC) #12
Kevin M
https://codereview.chromium.org/2692853008/diff/80001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2692853008/diff/80001/base/logging.h#newcode12 base/logging.h:12: #include <memory> On 2017/02/14 22:39:31, danakj wrote: > forward ...
3 years, 10 months ago (2017-02-14 22:41:01 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2692853008/100001
3 years, 10 months ago (2017-02-14 22:42:03 UTC) #16
commit-bot: I haz the power
Try jobs failed on following builders: android_arm64_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_arm64_dbg_recipe/builds/211265) android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, ...
3 years, 10 months ago (2017-02-15 00:40:29 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2692853008/100001
3 years, 10 months ago (2017-02-21 19:27:20 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL) linux_chromium_asan_rel_ng on ...
3 years, 10 months ago (2017-02-21 21:31:23 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2692853008/100001
3 years, 10 months ago (2017-02-22 23:11:36 UTC) #24
commit-bot: I haz the power
3 years, 10 months ago (2017-02-23 02:31:18 UTC) #27
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/549cad5d1141989cc3cac9ae7161...

Powered by Google App Engine
This is Rietveld 408576698