[LLVMbugs] [Bug 20756] New: Create a helper pragma to make unity builds easire
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Aug 26 12:29:49 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20756
Bug ID: 20756
Summary: Create a helper pragma to make unity builds easire
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: jpakkane at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140826/d21e72f4/attachment.html>
More information about the llvm-bugs
mailing list