[cfe-dev] Check C++ Bad Override

章磊 ioripolo at gmail.com
Fri Oct 7 22:06:10 PDT 2011


Hi Arjun,

I have not run this patch on some open source software, but i will do
it later. When i got any results, i will let you know asap.

2011/10/8, Arjun Singri <arjunsingri at gmail.com>:
> 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
>>
>>
>


-- 
Best regards!

Lei Zhang




More information about the cfe-dev mailing list