[cfe-dev] Check C++ Bad Override

Arjun Singri arjunsingri at gmail.com
Fri Oct 7 18:19:16 PDT 2011


Have you run this on any open source software to see how many
results/violations show up? If yes, sharing the results will be useful. If
not, then its a good exercise to run it on an open source software. You can
even try running it on llvm itself.

Arjun

On Fri, Oct 7, 2011 at 7:12 AM, 章磊 <ioripolo at gmail.com> wrote:

> Hi Clang,
>
> The attached patch adds a C++ Checker to clang, it checks whether
> there are mistakes in override.
>
> The mistake mean things like this:
>
> class base {
>  virtual void foo() const {/*...*/}
> };
>
> class child: public base {
>  /* child::foo is probably meant to override base::foo but type
> signatures don't match
>  perfectly */
>  void foo() {}
> };
>
> and this:
>
> class base {
>  void foo() const {}
> };
>
> class child: public base {
>  /* child::foo is probably meant to override base::foo but
>  that function is not virtual. */
>  void foo() const {}
> };
>
> I implement this as a static analysis checker, because i think it's
> not too visible and not too fast.
>
> I will appreciate it if there are any advice about this patch.
>
> --
> Best regards!
>
> Lei Zhang
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111007/e0377747/attachment.html>


More information about the cfe-dev mailing list