[llvm] Move StringExtras.h include from Error.h to Error.cpp
authorElliot Goodrich <elliotgoodrich@gmail.com>
Sat, 17 Jun 2023 12:18:23 +0000 (13:18 +0100)
committerElliot Goodrich <elliotgoodrich@gmail.com>
Sun, 25 Jun 2023 14:42:34 +0000 (15:42 +0100)
commit2fa0dbd7bf353db98b27b56137cced0a67de2748
tree936eca5f7fe17ace764e8074106c9801a1229e89
parentb0abd4893fa1bfae7f71b6b6e98770c9b1c07620
[llvm] 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/D153229
llvm/include/llvm/Support/Error.h
llvm/lib/Support/Error.cpp