[
https://issues.apache.org/jira/browse/MESOS-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Bannier updated MESOS-5059:
------------------------------------
Issue Type: Improvement (was: Bug)
> Implement a clang-tidy check catching uses of const ref to extend lifetimes
> ---------------------------------------------------------------------------
>
> Key: MESOS-5059
> URL: https://issues.apache.org/jira/browse/MESOS-5059
> Project: Mesos
> Issue Type: Improvement
> Reporter: Benjamin Bannier
>
> Mesos style discourages extending a value's lifetime with const references,
> e.g.,
> {code}
> const string& temporary = strings::join("/", "home", "user", ".bashrc");
> {code}
> We should add a clang-tidy check to catch such usage.
> With good reason we do allow giving names to values with const references,
> e.g.,
> {code}
> struct S
> {
> string name_;
> const int& name() const { return name_; }
> };
> void f(const S& s) {
> const string& name = s.name();
> }
> {code}
> This checker should not flag such usage, but it seems likely that it would
> identify incorrect getters which do actually return a value where instead
> returning a constant reference was needed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)