[llvm-dev] Splitting up Type.h: Good idea, bad idea?

John McCall via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 7 10:34:50 PDT 2020


On 7 Apr 2020, at 13:27, Reid Kleckner wrote:
> Hello Clang folks,

Why is this on llvm-dev instead of cfe-dev?

> I was using -ftime-trace to see where the compiler spends time parsing
> clang's own headers, and it pointed me to Type.h. Many AST headers 
> need
> QualType to be complete, but they do not need the full type class
> hierarchy. To improve compile time, I have attempted to create a new
> header, QualType.h, that defines only the QualType wrapper class. I 
> have
> started to transition popular clang headers (Decl.h, Expr.h, 
> ASTContext.h,
> etc) to just use QualType.h. I got pretty far with this, and pushed 
> the
> results to github:
> https://github.com/llvm/llvm-project/compare/master...rnk:split-qual-type-prune
>
> You can see it is pretty involved / invasive. Many inline methods had 
> to be
> sunk to cpp files, and this may affect performance. So far, I have 
> nothing
> to show for it in build time gains, because there are still too many 
> Type.h
> includes.

How many translation units actually don’t ultimately need the type
definitions?  Because this achieves nothing if almost every translation
unit ends up including Type.h anyway.

John.


More information about the llvm-dev mailing list