This is an archive of the discontinued LLVM Phabricator instance.

[Support] Move StringExtras.h include from Error.h to Error.cpp (part 5)
ClosedPublic

Authored by IncludeGuardian on Jul 11 2023, 2:34 PM.

Details

Summary

1st commit
[lldb] 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, 39d8e6e22cd1,
a11efd49266f, and 5551657b310b.


2nd commit
[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.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJul 11 2023, 2:34 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
IncludeGuardian requested review of this revision.Jul 11 2023, 2:34 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 11 2023, 2:34 PM
lldb/tools/lldb-vscode/VSCode.cpp
17

This should be the final failure on the last time landing the Error.h change to main https://lab.llvm.org/buildbot#builders/68/builds/55847

Still, would be good to land the lldb commit separately. And ensure that you have performed the last-minute testing...
Ensure that projects like flang bolt still build.

MaskRay accepted this revision.Jul 11 2023, 4:29 PM
This revision is now accepted and ready to land.Jul 11 2023, 4:29 PM