[PATCH] D26768: [analyzer] Improve VirtualCallChecker diagnostics and move to optin package.
Devin Coughlin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 12 09:28:38 PST 2016
dcoughlin added a comment.
In https://reviews.llvm.org/D26768#619222, @malcolm.parsons wrote:
> In https://reviews.llvm.org/D26768#618651, @dcoughlin wrote:
>
> > The definite false positives were cases where the programmer seemed aware of the semantics of virtual calls during construction/destruction and had each subclass explicitly call its own version of the virtual method in question.
>
>
> How is this avoiding the check for a qualifier on the call?
>
> if (CME->getQualifier())
> callIsNonVirtual = true;
>
They didn't use the qualified version. Rather, each class had duplication of the same logic calling the virtual method its individual constructor/destructor. In the cases I examined either the virtual method didn't call super (most common pattern) or it did and was idempotent if called multiple times.
>> The likely false positives were cases where there was no subclass of the constructed class that overrode the method in question.
>
> I'd like to be told about these so that the class can be marked final.
I agree, but this produces too many alarms to be on by default in the analyzer. I put the check in it in the 'optin' package so individual projects can decide whether they want to enforce this rule or not.
Repository:
rL LLVM
https://reviews.llvm.org/D26768
More information about the cfe-commits
mailing list