summaryrefslogtreecommitdiffstats
path: root/tools/lint/cpp-virtual-final.yml
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /tools/lint/cpp-virtual-final.yml
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tools/lint/cpp-virtual-final.yml25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/lint/cpp-virtual-final.yml b/tools/lint/cpp-virtual-final.yml
new file mode 100644
index 0000000000..20c5837f36
--- /dev/null
+++ b/tools/lint/cpp-virtual-final.yml
@@ -0,0 +1,25 @@
+---
+cpp-virtual-final:
+ description: "Virtual function declarations should specify only one of
+ `virtual`, `final`, or `override`"
+ level: error
+ include: ['.']
+ extensions: ['cc', 'cpp', 'h', 'mm']
+ type: regex
+ #
+ # This lint warns about:
+ #
+ # virtual void Bad1() final
+ # void Bad2() final override
+ # void Bad3() override final
+ #
+ # Caveats: This lint ...
+ #
+ # * Doesn't warn about `virtual void NotBad() override` at this time
+ # because there are currently 6963 instances of this pattern.
+ #
+ # * Doesn't warn about function declarations that span multiple lines
+ # because the regex can't match across line breaks.
+ #
+ # virtual ) final | final override | override final
+ payload: ^ *virtual .+\).+\bfinal\b|\bfinal +override\b|\boverride +final\b