[all-commits] [llvm/llvm-project] 39d8e6: Add missing StringExtras.h includes

Elliot Goodrich via All-commits all-commits at lists.llvm.org
Sat Jul 8 02:20:41 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 39d8e6e22cd192db6ace37a4c842265058dcddb8
  Author: Elliot Goodrich <elliotgoodrich at gmail.com>
  Date:   2023-07-08 (Sat, 08 Jul 2023)

  Changed paths:
    M clang/lib/Driver/ToolChain.cpp
    M clang/lib/Driver/ToolChains/BareMetal.cpp
    M llvm/lib/Analysis/VectorUtils.cpp
    M llvm/lib/Transforms/IPO/Internalize.cpp
    M llvm/lib/Transforms/Scalar/MergeICmps.cpp
    M llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
    M llvm/lib/Transforms/Utils/ModuleUtils.cpp
    M llvm/tools/llvm-objdump/XCOFFDump.cpp
    M llvm/unittests/Support/CompressionTest.cpp

  Log Message:
  Add missing StringExtras.h includes

In preparation for removing the `#include "llvm/ADT/StringExtras.h"`
from the header to source file of `llvm/Support/Error.h`, first add in
all the missing includes that were previously included transitively
through this header.

This is fixing all files missed in b0abd4893fa1.

Differential Revision: https://reviews.llvm.org/D154543

  Commit: fc6b12689c5001aa050fc1d855209a5e319112b7
  Author: Elliot Goodrich <elliotgoodrich at gmail.com>
  Date:   2023-07-08 (Sat, 08 Jul 2023)

  Changed paths:
    M llvm/include/llvm/Support/Error.h
    M llvm/lib/Support/Error.cpp

  Log Message:
  [Support] Move StringExtras.h include from Error.h to Error.cpp

Move the implementation of the `toString` function from
`llvm/Support/Error.h` to the source file, which allows us to move
`#include "llvm/ADT/StringExtras.h"` to the source file as well.

As `Error.h` is present in a large number of translation units this
means we are unnecessarily bringing in the contents of
`StringExtras.h` - itself a large file with lots of includes - and
slowing down compilation.

Also move the `#include "llvm/ADT/SmallVector.h"` directive to the
source file as it's no longer needed, but this does not give as much of
a benefit.

This reduces the total number of preprocessing tokens across the LLVM
source files in lib from (roughly) 1,920,413,050 to 1,903,629,230 - a
reduction of ~0.87%. This should result in a small improvement in
compilation time.

Differential Revision: https://reviews.llvm.org/D154543

Compare: https://github.com/llvm/llvm-project/compare/23f0f061c399...fc6b12689c50

More information about the All-commits mailing list