• Stephan Bergmann's avatar
    Suppress loplugin:unnecessaryoverride... · a6309a3c
    Stephan Bergmann yazdı
    ...when a class derives from multiple (non-virtual) instances of one base class,
    and the override disambiguates which of those instances' member to call.
    
    That was the case with SwXTextDocument::queryAdapter
    (sw/source/uibase/uno/unotxdoc.cxx), where SwXTextDocument derives from
    cppu::OWeakObject through both SwXTextDocumentBaseClass and SfxBaseModel, but
    calling queryAdapter through a pointer to SwXTextDocumentBaseClass apparently
    needs to call OWeakObject::queryAdapter on the second, SfxBaseModel-inherited
    OWeakObject base instance, or else CppunitTest_sw_macros_test fails.
    
    Who knows what other instances of similar non-unnecessary overrides have been
    removed with the help of broken loplugin:unnecessaryoverride, for which there
    were no tests that started to fail...
    
    Turns out .clang-format lacked "ReflowComments: false" to not break the special
    "// expected-error {{...}}" etc. comments in compilerplugins/clang/test/.
    
    Also, use a better location to report loplugin:unnecessaryoverride, to keep
    clang-format and loplugin:unnecessaryoverride from fighting over how to split
    lines and where to put the comment in
    compilerplugins/clang/test/unnecessaryoverride.cxx.
    
    Change-Id: I3b24df24369db12f8ec1080d6c9f7b70ff561a16
    Reviewed-on: https://gerrit.libreoffice.org/44418Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
    a6309a3c
unnecessaryoverride.cxx 1.1 KB