Forward declare FileEntry and DirectoryEntry in Module.h
authorReid Kleckner <rnk@google.com>
Thu, 27 Feb 2020 00:29:37 +0000 (16:29 -0800)
committerReid Kleckner <rnk@google.com>
Thu, 27 Feb 2020 18:18:06 +0000 (10:18 -0800)
commitbc8836651fba3304d92e1025ff6a918f25e9e209
treebcd1b9745ac65de4df60f0c569792c54a50ae415
parent04da3dfecc199a7fdd262b06eeb399fc8ce0d1f6
Forward declare FileEntry and DirectoryEntry in Module.h

FileManager.h is an expensive header (~350ms for me in isolation), so
try to do without it.

Notably, we need to avoid checking the alignment of FileEntry, which
happens for DenseMap<FileEntry*> and PointerUnion<FileEntry*>. I
adjusted the code to avoid PointerUnion, and moved the DenseMap
insertion to the .cpp file.

Globally, this only saved about ~17 includes of the related headers
because SourceManager.h still includes FileManager.h, and it is more
popular than Module.h.
clang/include/clang/Basic/Module.h
clang/include/clang/Serialization/ModuleFile.h
clang/lib/Basic/Module.cpp
clang/lib/Lex/ModuleMap.cpp