Open
Bug 1443448
Opened 6 years ago
Updated 2 years ago
[clang-tidy] Disallow non-empty inline virtual methods
Categories
(Developer Infrastructure :: Source Code Analysis, enhancement)
Developer Infrastructure
Source Code Analysis
Tracking
(Not tracked)
NEW
People
(Reporter: jwatt, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: memory-footprint)
Chromium has a checker for this: https://www.chromium.org/developers/coding-style/chromium-style-checker-errors#TOC-Virtual-Method-Out-of-lining It seems like they got good code size reductions. See the comments on: https://codereview.chromium.org/5741001/ for example.
Updated•6 years ago
|
Version: Version 3 → Trunk
Updated•6 years ago
|
Blocks: clang-based-analysis
Comment 1•6 years ago
|
||
Code available here: https://chromium.googlesource.com/chromium/src/tools/clang/+/2cf23bd023e0692f00f023970c7e673490dffa43/plugins/FindBadConstructs.cpp
Reporter | ||
Comment 2•6 years ago
|
||
I wonder if they'd be willing to convert it to clang-tidy and upstream it?
Comment 3•6 years ago
|
||
As the code is right now, there must be some fundamental modifications in order to upstream it to clang-tidy, because the current analysis doesn't use a matcher to match a 'CXXFuncDecl' inside a 'CXXRecordDecl', it still relies on hooking up on a ASTConsumer that's why they used the clang-plugin architecture. TBH I'm not even sure that the code exists in the latest revisions of that folder.
Comment 4•6 years ago
|
||
While not quite the same warning, clang's -Wweak-vtable flag can report when a class's virtual functions are all inline. Without a "home" translation unit for the class's out-of-line vtable, a duplicate vtable will be emitted in every translation unit that references the class. This warning is very noisy. https://clang.llvm.org/docs/DiagnosticsReference.html#wweak-vtables
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•