We used to treat an Expr mutated whenever it's passed as non-const
reference argument to a function. This results in false positives in
cases like this:
int x; std::vector<int> v; v.emplace_back(x); // `x` is passed as non-const reference to `emplace_back`
In theory the false positives can be suppressed with
v.emplace_back(std::as_const(x)) but that's considered overly verbose,
inconsistent with existing code and spammy as diags.
This diff is first step in handling such cases by following into the function definition
and see whether the argument is mutated inside.
Thanks!
I know this has performance implications, but those will exist even if one has this in his own code.