[LLVMdev] Google Summer of Code

Vassil Vassilev
Tue, 10 Mar 2015 08:03:58 -0000

On 09/03/15 21:52, Anna Zaks wrote:
>
> +Easily, some of the code snippets end up being copied dozens of
> +times, which leads to worse maintainability, understandability and
> logical
> +design.
Should be better now.
>
> The project description stresses code maintainability and logical
> design more than bug finding due to omissions in copy and pasted code.
> Reading this made me think of a check that would suggest people to
> replace copy and pasted code with a function call or something like
> that... Examples do stress the specific bugs that could be found,
> which is what I had in mind:
>
> +   Copy-paste infrastructure could be used to build other
"goodies". Some
> +examples and possible applications are:
>
> Is this intentional? If not, maybe we could rephrase a bit with more
> emphasis on bug finding. I would also make it a requirement to use the
> infrastructure for bug detection.
Well, partially yes, I wanted to have the project description as broad
as possible so that interested students to specialized in a direction,
in which they are most comfortable. Because IMO the project is bigger
than 1 usual GSoC project.
I rephrased it to make it more focused towards bugs. Could you elaborate
on the "I would also make it a requirement to use the infrastructure for
bug detection.", please?

BTW, please feel free to submit a patch to the patch (:)), if you think
something else requires fixing or better wording.
>
> Thanks for driving this!
Sure, thank you for reviewing!
Vassil
> Anna.
>
>> On Mar 9, 2015, at 1:54 AM, Vassil Vassilev <vvasilev at cern.ch
>> <mailto:vvasilev at cern.ch>> wrote:
>>
>> Hi Anton,
>>  (CC-ing the people who might be interested to review)
>>  I am attaching the patch.
>> Many thanks,
>> Vassil
>> On 04/03/15 23:00, Anton Korobeynikov wrote:
>>> Please provide a patch to Open Projects list.
>>>
>>> On Wed, Mar 4, 2015 at 8:25 PM, Vassil Vassilev <vvasilev at
cern.ch
>>> <mailto:vvasilev at cern.ch>> wrote:
>>>> On 17/02/15 09:47, Anton Korobeynikov wrote:
>>>>> John,
>>>>>
>>>>> Yes, I'm taking care about application as usual.
>>>> I saw the the LLVM mentoring org was accepted. Congrats!
>>>> Anton, could you tell me what is the procedure of submitting a
>>>> proposal for
>>>> a project (I will be the mentor)?
>>>> Many thanks,
>>>> Vassil
>>>>
>>>>> On Tue, Feb 17, 2015 at 4:48 AM, Eric Christopher
>>>>> <echristo at gmail.com <mailto:echristo at
gmail.com>>
>>>>> wrote:
>>>>>> I believe Anton was going to do so.
>>>>>>
>>>>>>
>>>>>> On Mon, Feb 16, 2015, 5:14 PM John Criswell
<jtcriswel at gmail.com
>>>>>> <mailto:jtcriswel at gmail.com>> wrote:
>>>>>>> Dear All,
>>>>>>>
>>>>>>> Has someone registered LLVM as an organization for
Google Summer
>>>>>>> of Code
>>>>>>> 2015?  I'm interested in mentoring a GSoC
student this summer.
>>>>>>>
>>>>>>> -- John T.
>>>>>>>
>>>>>>> --
>>>>>>> John Criswell
>>>>>>> Assistant Professor
>>>>>>> Department of Computer Science, University of
Rochester
>>>>>>> http://www.cs.rochester.edu/u/criswell
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> LLVM Developers mailing list
>>>>>>> LLVMdev at cs.uiuc.edu
http://llvm.cs.uiuc.edu
>>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>
>>>
>>>
>>
>>
>> --
>> --------------------------------------------
>> Q: Why is this email five sentences or less?
>> A:http://five.sentenc.es <http://five.sentenc.es/>
>>
>> <CopyPasteDetectorGSoC15.diff>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150310/836f965f/attachment.html>
-------------- next part --------------
Index: /Users/vvassilev/workspace/llvm-project/www/OpenProjects.html
==================================================================---
/Users/vvassilev/workspace/llvm-project/www/OpenProjects.html	(revision 231588)
+++ /Users/vvassilev/workspace/llvm-project/www/OpenProjects.html	(working copy)
@@ -4,6 +4,7 @@


What is this?
+ Google Summer of Code
2015
Google Summer of Code
2014
LLVM Subprojects: Clang and
VMKit
Improving the current
system
@@ -64,6 +65,88 @@

 <!-- ***********************************************************************
-->

+ Google Summer of Code 2015
projects
+
+<!-- ***********************************************************************
-->
+
+
+ Copy-paste detection
+
+
+
+ Description of the project:
+The copy-paste is a common programming practice. Most of the programmers start
+from a code snippet, which already exists in the system and modify it to match
+their needs. Easily, some of the code snippets end up being copied dozens of
+times, which leads to a seamless introduction of new hard-to-find bugs.
+Also, copy-paste usually means worse maintainability, understandability and
+logical design.
+
+Clang and <a
href="http://clang-analyzer.llvm.org/">
+clang's static analyzer provide all the building blocks to build
a generic
+C/C++ copy-paste detector.
+
+ Expected results: Develop a copy-paste detector and
integrate it into
+one of the existing tools. An ideal candidate would be clang static analyzer.
+Lay the foundations of detection of slightly modified code (semantic analysis
+required). Implement thorough test suite. Prepare a final poster of the work
+and be ready to present it.
+
+ Confirmed Mentor: Vassil Vassilev
+
+ How to contact the mentor: vvasilev at cern.ch or
+ vassil_vassilev at hotmail.com
+
+ Desirable skills:
+ Advanced C++, Basic knowledge of Clang/Clang Static Analyzer.
+
+ What the student will learn: Static analyzer,
Clang, etc
+ Further information:
+   The developed copy-paste infrastructure could be used to build for building
+more advanced bug checkers. Some examples and possible applications are:
+
+ Detect issues in the control flow:
+
+        if (cond)
+          do_a();
+        else
+          do_a(); // here we could implement warning that both branches are the
same
+
+      A more realistic example (provided by Nick Lewycky) could be:
+
+        #define num_cpus() (1)
+        #define max_omp_threads() (1)
+        int test8(int expr) {
+          if (expr)
+            return num_cpus();
+          else
+           return max_omp_threads();
+        }
+
+      The implementation should be extremely efficient and with low false
+      positive rate, in order to end up in clang's mainline. Initial work
done
+      by Nick could be found
+      <a
href="https://gist.github.com/vgvassilev/471feedc9de61a9590da">here.
+
+ Detect modified code snippets (example by Marshall
Clow):
+      Code block #1 is about 50 lines of code, with references to a global
+      variable (global1, global1, global1, global1, global1).
+
+      Code block #2 is an obviously duplicated and edited block of code, with
+      references to (global2, global2, global2, global1, global2).
+
+      A diagnostics "Are you sure you don't mean 'global2'
here?" would be great.
+
+ An example (provided by Sean McBride) that these
copy-pasto-s exist
+ even in LLVM/clang codebase:
+      <a
href="http://www.viva64.com/en/b/0108/">here.
+
+
+
+
+
+<!-- ***********************************************************************
-->
+
Google Summer of Code 2014
projects

 <!-- ***********************************************************************
-->