<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Create a helper pragma to make unity builds easire"
   href="http://llvm.org/bugs/show_bug.cgi?id=20756">20756</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Create a helper pragma to make unity builds easire
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jpakkane@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Unity builds are a method of massively speeding up C++ compilations, up to and
including 90% faster. The basic idea is that you don't compile files a.cc,
b.cc, c.cc etc in separate invocations. Instead you create a file that looks
like this:

#include<a.cc>
#include<b.cc>
#include<c.cc>
etc

and then compile only this file. Some build systems (such as Meson) can even
generate this "unity file" automatically.

The big downside of this is that if two files have, say, a static function
doStuff, then the unity build will fail due to symbol crashes. This is tedious
and one of the main reasons unity builds are not used all that much.

A syntactically simple fix for this would be to create a new pragma called
unityfence that would be used like this:

#include<a.cc>
#pragma unityfence
#include<b.cc>
#pragma unityfence
#include<c.cc>
#pragma unityfence
etc

When the compiler encounters this pragma it would do the following:

- unset any "using" declarations encountered
- would remove static and anonymous symbols from the list of encountered
symbols but would keep them around and link already encountered usages to them
- hide other information which could cause build failures</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>