Avoid including FileSystem.h from MemoryBuffer.h
authorReid Kleckner <rnk@google.com>
Sat, 29 Feb 2020 18:23:54 +0000 (10:23 -0800)
committerReid Kleckner <rnk@google.com>
Sat, 29 Feb 2020 20:30:23 +0000 (12:30 -0800)
commitaf450eabb925a8735434282d4cab6280911c229a
tree35fda0ac1523cd2feed427119e23d5f22ebc5ff0
parent798e661567cfffde92ca080fbfbcf72956499283
Avoid including FileSystem.h from MemoryBuffer.h

Lots of headers pass around MemoryBuffer objects, but very few open
them. Let those that do include FileSystem.h.

Saves ~250 includes of Chrono.h & FileSystem.h:

$ diff -u thedeps-before.txt thedeps-after.txt | grep '^[-+] ' | sort | uniq -c | sort -nr
    254 -    ../llvm/include/llvm/Support/FileSystem.h
    253 -    ../llvm/include/llvm/Support/Chrono.h
    237 -    ../llvm/include/llvm/Support/NativeFormatting.h
    237 -    ../llvm/include/llvm/Support/FormatProviders.h
    192 -    ../llvm/include/llvm/ADT/StringSwitch.h
    190 -    ../llvm/include/llvm/Support/FormatVariadicDetails.h
...

This requires duplicating the file_t typedef, which is unfortunate. I
sunk the choice of mapping mode down into the cpp file using variable
template specializations instead of class members in headers.
20 files changed:
clang/lib/Frontend/SerializedDiagnosticPrinter.cpp
clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
clang/tools/libclang/CIndexer.cpp
clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
clang/utils/TableGen/MveEmitter.cpp
llvm/include/llvm/BinaryFormat/MsgPackReader.h
llvm/include/llvm/Bitstream/BitstreamReader.h
llvm/include/llvm/Support/MemoryBuffer.h
llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/LLVMRemarkStreamer.cpp
llvm/lib/Support/MemoryBuffer.cpp
llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
llvm/tools/llvm-exegesis/lib/Clustering.cpp
llvm/tools/llvm-mca/CodeRegion.h
llvm/unittests/ProfileData/SampleProfTest.cpp
llvm/unittests/Support/YAMLIOTest.cpp
llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp
llvm/utils/TableGen/OptRSTEmitter.cpp