[cfe-dev] CopyPaste detection clang static analyzer

Vassil Vassilev vvasilev at cern.ch
Wed Feb 5 03:41:36 PST 2014


On 03/02/14 23:08, Richard wrote:
> In article <CAENS6EsgzhXWfANFze8VAp68qDGHnrHNZJaaLmi28YJtnQwOmw at mail.gmail.com>,
>      David Blaikie <dblaikie at gmail.com> writes:
>
>> On Mon, Feb 3, 2014 at 3:06 AM, Vassil Vassilev <vvasilev at cern.ch> wrote:
>>
>>>    A few months ago I was looking for a copy-paste detector for a C++
>>> project. I didn't find such a feature of clang's static analyzer. Is this
>>> the case?
>> copy-paste detector? As in plagarism detection?
> I don't think plagiarism is the concern.  The conern is that
> copy/paste of blocks of code where the pasted block needs to be
> updated in several places, but not all of the updates were performed.
Exactly.
>
> Coverity can detect such instances, for instance.
>
> Here is an article from 2006 describing such a tool:
> <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.123.113>
>
> Wikipedia says PMD has a copy/paste detector that works with C++:
> <http://en.wikipedia.org/wiki/PMD_(software)#Copy.2FPaste_Detector_.28CPD.29>
>
> "Note that CPD works with Java, JSP, C, C++, C#, Fortran and PHP code.
> Your own language is missing ? See how to add it here"
> <http://pmd.sourceforge.net/snapshot/cpd-usage.html>
Thanks for the pointers. I think that would be good to have in the 
static analyzer wouldn't it?
Vassil



More information about the cfe-dev mailing list