[Qt-creator] ** Caution Message may be spoofed ** Re: Find references of virtual functions?

Konstantin Tokarev annulen at yandex.ru
Mon Sep 14 15:34:46 CEST 2020



14.09.2020, 16:15, "Murphy, Sean" <smurphy at walbro.com>:
>>  > Anyhow, given it's a virtual, how can you know at compile time if
>>  > you're calling GrandChild::foo() or not?
>>  >
>>  > Abstract *blah = getFoo();
>>  > blah->foo(); // might call Grandchild::foo(), or not
>>
>>  FWIW, there are at least 3 cases when it is certainly known at compile time
>>  which overload is called:
>>
>>  1) if object is referenced by value:
>>
>>    Grandchild blah;
>>    blah.foo();
>>
>>  2) fully qualified method call:
>>
>>    Grandchild *blah = getFoo();
>>    blah->Grandchild::foo(); // or Base::foo() etc.
>>
>>  3) when foo() is final in Grandchild:
>>
>>    Grandchild *blah = getFoo();
>>    blah->foo();
>
> Thanks Konstantin, for clarifying better than my initial post did. The 3 examples
> above are exactly what I'm referring to. There are instances in the codebase
> where it should be pretty well determined at compile time which overload is
> going to get used, and I only want to see the ones that match for my use case
> (trying to find the impact of changing the behavior of just one of inherited
> classes' overloads).

Note that if such feature was implemented and you could find all places where
your target overload is certainly called, there would be other call sites where
it *might* be called and this is what "find all references" is trying to show.

>
> But currently find all references doesn't give me the option to disregard ones
> that clearly can't be the one I'm trying to find. And because the Search Results
> pane only gives the single line of code that contains the symbol, I often don't
> have enough context there to determine which overload is going to be called,
> forcing me to click on most of the search result entries to then manually
> evaluate whether that chunk of code is likely calling the broken function or not.
>
> Sean
>
> This message has been scanned for malware by Forcepoint. www.forcepoint.com
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> https://lists.qt-project.org/listinfo/qt-creator


-- 
Regards,
Konstantin


More information about the Qt-creator mailing list