Open
Bug 2044583
Opened 3 months ago
Updated 3 months ago
Write clang static analysis plugin to forbid `already_AddRefed&&` type
Categories
(Developer Infrastructure :: Source Code Analysis, task)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
NEW
People
(Reporter: dholbert, Unassigned)
References
Details
The already_AddRefed&& rvalue-reference type is sort of an anti-pattern, because already_AddRefed implies that we're trying to force an ownership transfer, but then the reference makes that optional.
(It intuitively feels like it might be the right thing to do since rvalue references are associated with clean ownership handoffs, but in this case it's counterproductive.)
I'm trying to remove all mentions of this type from our codebase (in function parameters at least) in bug 2044510.
As valentin suggested in bug 2044510 comment 25, we should consider writing a clang plugin to prevent this already_AddRefed&& type from being reintroduced in the future.
You need to log in
before you can comment on or make changes to this bug.
Description
•