[all-commits] [llvm/llvm-project] af450e: Avoid including FileSystem.h from MemoryBuffer.h

Reid Kleckner via All-commits all-commits at lists.llvm.org
Sat Feb 29 12:36:44 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: af450eabb925a8735434282d4cab6280911c229a
      https://github.com/llvm/llvm-project/commit/af450eabb925a8735434282d4cab6280911c229a
  Author: Reid Kleckner <rnk at google.com>
  Date:   2020-02-29 (Sat, 29 Feb 2020)

  Changed paths:
    M clang/lib/Frontend/SerializedDiagnosticPrinter.cpp
    M clang/lib/Lex/DependencyDirectivesSourceMinimizer.cpp
    M clang/tools/libclang/CIndexer.cpp
    M clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
    M clang/utils/TableGen/MveEmitter.cpp
    M llvm/include/llvm/BinaryFormat/MsgPackReader.h
    M llvm/include/llvm/Bitstream/BitstreamReader.h
    M llvm/include/llvm/Support/MemoryBuffer.h
    M llvm/lib/BinaryFormat/AMDGPUMetadataVerifier.cpp
    M llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
    M llvm/lib/IR/Attributes.cpp
    M llvm/lib/IR/LLVMRemarkStreamer.cpp
    M llvm/lib/Support/MemoryBuffer.cpp
    M llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
    M llvm/tools/llvm-exegesis/lib/Clustering.cpp
    M llvm/tools/llvm-mca/CodeRegion.h
    M llvm/unittests/ProfileData/SampleProfTest.cpp
    M llvm/unittests/Support/YAMLIOTest.cpp
    M llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp
    M llvm/utils/TableGen/OptRSTEmitter.cpp

  Log Message:
  -----------
  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.




More information about the All-commits mailing list