Closed
Bug 1463907
Opened 6 years ago
Closed 6 years ago
Clean up redundant uses of do_QueryInterface
Categories
(Developer Infrastructure :: Source Code Analysis, enhancement)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1493226
People
(Reporter: adrian17, Unassigned)
References
Details
Attachments
(2 files)
5.04 KB,
patch
|
Details | Diff | Splinter Review | |
36.65 KB,
text/plain
|
Details |
I've noticed that the codebase has a small amount of seemingly-redundant (casting to the same type or base type) interface conversions. It seems like some of them were caused by recent interface refactors and removals. For example, what used to be nsIDOMNode* aDestinationNode; ... nsCOMPtr<nsINode> node = do_QueryInterface(aDestinationNode); After bug 1449147 became nsINode* aDestinationNode; ... nsCOMPtr<nsINode> node = do_QueryInterface(aDestinationNode); Which is clearly unnecessary. I've written a simple Clang checker that detects such QI uses. I'll attach the patch (not for review, I don't think it should go into the repo?) and output. While I don't think it has false positives, some cases of QI to related type are intentional. Still, it should be a useful tool for cleaning such code.
Reporter | ||
Comment 1•6 years ago
|
||
Reporter | ||
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Product: Core → Firefox Build System
Updated•6 years ago
|
Component: General → Source Code Analysis
Comment 3•6 years ago
|
||
I'm working on a patch for this, including fixes, in bug 1493226. I enforce it via a static_assert rather than a static analysis.
Updated•6 years ago
|
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•