[llvm-dev] Code in headers

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 10 16:13:45 PST 2016


Some parts of Clang are very careful about keeping implementation details
out of headers, and others aren't. Consider RecordLayoutBuilder, for
example, whose class definition is in the .cpp file.

In general I would say that we are in favor of hiding as many
implementation details as we can, it's just thankless work to refactor
headers to sink code code into .cpp files, prune transitive includes, and
fix the resulting build errors.

On Wed, Feb 10, 2016 at 4:07 PM, <Alexander G. Riccio> via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> While investigating compile times, I noticed that there's no information
> in the LLVM coding standards about code in headers. Many LLVM/Clang headers
> have lots of complex code in headers - I'm specifically looking at the
> Static Analyzer projects (seemingly slowest compile times, biggest
> hinderance to my productivity) - that probably doesn't need to be there.
> Nobody likes slow compile times.
>
> What's the LLVM policy on code in headers?
>
> If there is none, the Chromium "C++ Dos and Don'ts"
> <https://www.chromium.org/developers/coding-style/cpp-dos-and-donts> page
> offers a good starting point.
>
>
> Sincerely,
> Alexander Riccio
> --
> "Change the world or go home."
> about.me/ariccio
>
> <http://about.me/ariccio>
> If left to my own devices, I will build more.
>>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160210/c9b60f11/attachment.html>


More information about the llvm-dev mailing list