[LLVMdev] Google Summer of Code

Vassil Vassilev vvasilev at cern.ch
Tue Mar 10 01:03:58 PDT 2015

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!
> 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 @@
   <li><a href="#what">What is this?</a></li>
+  <li><a href="#gsoc2015">Google Summer of Code 2015</a></li>
   <li><a href="#gsoc2014">Google Summer of Code 2014</a></li>
   <li><a href="#subprojects">LLVM Subprojects: Clang and VMKit</a></li>
   <li><a href="#improving">Improving the current system</a>
@@ -64,6 +65,88 @@
 <!-- *********************************************************************** -->
 <div class="www_sectiontitle">
+  <a name="gsoc2015">Google Summer of Code 2015 projects</a>
+<!-- *********************************************************************** -->
+<div class="www_subsubsection">
+  <a name="target-desc">Copy-paste detection</a>
+<div class="www_text">
+<p><b>Description of the project: </b>
+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.
+<a href="http://clang.llvm.org">Clang</a> and <a href="http://clang-analyzer.llvm.org/">
+clang's static analyzer</a> provide all the building blocks to build a generic
+C/C++ copy-paste detector.</p>
+<p><b>Expected results: </b>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.
+<p><b>Confirmed Mentor:</b> Vassil Vassilev</p>
+<p><b>How to contact the mentor:</b> vvasilev at cern.ch or
+   vassil_vassilev at hotmail.com</p>
+<p><b>Desirable skills:</b>
+   Advanced C++, Basic knowledge of Clang/Clang Static Analyzer.</p>
+<p><b>What the student will learn:</b> Static analyzer, Clang, etc</p>
+<p><b>Further information:</b>
+   The developed copy-paste infrastructure could be used to build for building
+more advanced bug checkers. Some examples and possible applications are:
+  <ol>
+    <li><b>Detect issues in the control flow:</b>
+      <pre>
+        if (cond)
+          do_a();
+        else
+          do_a(); // here we could implement warning that both branches are the same
+      </pre>
+      A more realistic example (provided by Nick Lewycky) could be:
+      <pre>
+        #define num_cpus() (1)
+        #define max_omp_threads() (1)
+        int test8(int expr) {
+          if (expr)
+            return num_cpus();
+          else
+           return max_omp_threads();
+        }
+      </pre>
+      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.</a>
+    </li>
+    <li><b>Detect modified code snippets (example by Marshall Clow):</b><br />
+      Code block #1 is about 50 lines of code, with references to a global
+      variable (global1, global1, global1, global1, global1).
+      <br />
+      Code block #2 is an obviously duplicated and edited block of code, with
+      references to (global2, global2, global2, global1, global2).
+      <br />
+      A diagnostics "Are you sure you don't mean 'global2' here?" would be great.
+    </li>
+    <li><b>An example (provided by Sean McBride) that these copy-pasto-s exist
+      even in LLVM/clang codebase:</b>
+      <a href="http://www.viva64.com/en/b/0108/">here.</a></li>
+  </ol></p>
+<!-- *********************************************************************** -->
+<div class="www_sectiontitle">
   <a name="gsoc2014">Google Summer of Code 2014 projects</a>
 <!-- *********************************************************************** -->

More information about the llvm-dev mailing list