This is an archive of the discontinued LLVM Phabricator instance.

Avoid including Module.h from ExternalASTSource.h
ClosedPublic

Authored by rnk on Mar 6 2020, 4:18 PM.

Details

Summary

Module.h takes 86ms to parse, mostly parsing the class itself. Avoid it
if possible. ASTContext.h depends on ExternalASTSource.h.

A few NFC changes were needed to make this possible:

  • Move ASTSourceDescriptor to Module.h. This needs Module to be complete, and seems more related to modules and AST files than external AST sources.
  • Move "import complete" bit from Module* pointer int pair to NextLocalImport pointer. Required because PointerIntPair<Module*,...> requires Module to be complete, and now it may not be.

Diff Detail

Event Timeline

rnk created this revision.Mar 6 2020, 4:18 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 6 2020, 4:18 PM

This will no doubt also need some patches to the Swift compiler, but given the NFC-ness this hopefully should be fine.

rnk added a comment.Mar 10 2020, 4:38 PM

This will no doubt also need some patches to the Swift compiler, but given the NFC-ness this hopefully should be fine.

True. I could leave behind a typedef for the ASTSourceDescriptor if it matters.

Any concerns, or does someone mind approving?

aaron.ballman accepted this revision.Mar 11 2020, 4:38 AM

Aside from minor nits, this seems reasonable to me, LG!

clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
16

Please sort the includes.

clang/lib/AST/ASTContext.cpp
1619

80-col limit

This revision is now accepted and ready to land.Mar 11 2020, 4:38 AM

To avoid bot breakage, I would recommend testing -DLLVM_ENABLE_MODULES=1 stage2 build works before landing this, as it is notoriously sensitive to header reshuffling.

rnk added a comment.Mar 11 2020, 1:37 PM

Thanks!

To avoid bot breakage, I would recommend testing -DLLVM_ENABLE_MODULES=1 stage2 build works before landing this, as it is notoriously sensitive to header reshuffling.

Good idea, I confirmed this passed.

This revision was automatically updated to reflect the committed changes.
rnk marked an inline comment as done.