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

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 7 10:27:43 PDT 2020

Hello Clang folks,

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:

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

At this point I am wondering if this is worth doing at all. I figured I
would take a break and ask for some opinions. If people generally feel this
is worth pursuing, I'll break that branch up and upload it to phab in
incremental pieces.

The next most popular header seems to be CanonicalType.h, and it appears to
be pretty strongly coupled to Type.h. It essentially reiterates all of the
derived classes of Type, so I'm not sure how to break this link yet.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200407/5edf19bb/attachment.html>

More information about the llvm-dev mailing list