[clazy] [Bug 408380] New: detect useless overrides

Milian Wolff bugzilla_noreply at kde.org
Thu Jun 6 13:07:34 BST 2019


https://bugs.kde.org/show_bug.cgi?id=408380

            Bug ID: 408380
           Summary: detect useless overrides
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: mail at milianw.de
                CC: smartins at kde.org
  Target Milestone: ---

SUMMARY
struct foo { virtual void asdf(); }
struct bar : foo { void asdf() override { foo::asdf(); } }

The override is completely useless, and I find such code far too often - could
clazy/clang-tidy detect it and remove the useless code?

it may be problematic to detect when

- non-trivial arguments are forwarded (still useless)
- Q_UNUSED or similar
- instead of calling the parent implementation, the parent implementation code
is duplicated:

struct foo { virtual void asdf() { printf("hello");  }
struct bar : foo { void asdf() override { printf("hello"); } }

OBSERVED RESULT
not detected

EXPECTED RESULT
useless overrides are marked and offered for automatic removal

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list