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}


CrOS-Libchrome-Original-Commit: 549cad5d1141989cc3cac9ae7161984b40ae5607
1 file changed
tree: 69292e8d6e1a30267371f8d732969fd81904bdfa
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/