This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by IncludeGuardian on Jul 13 2023, 4:32 AM.

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, 5551657b310b, and 90bfe2df25e7.


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 13 2023, 4:32 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
IncludeGuardian requested review of this revision.Jul 13 2023, 4:32 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 13 2023, 4:32 AM

@MaskRay seems like ninja on its own after preparing lldb isn't enough to build tests. I've now built llvm, clang, flang, bolt, lldb, + tests - I'm hoping that this is it now!

@MaskRay seems like ninja on its own after preparing lldb isn't enough to build tests. I've now built llvm, clang, flang, bolt, lldb, + tests - I'm hoping that this is it now!

You can build everything required for all tests with the check-* targets, for example: check-lldb, check-llvm, check-clang.
There is also a check-all. Just make sure to kill the job after the compilation is done, otherwise you will be running a massive test suite ;)

To be concrete, you can do something like ninja check-all. Or also cmake --build <path/to/build_dir> --target check-all

This revision was not accepted when it landed; it landed in state Needs Review.Jul 13 2023, 1:09 PM
This revision was automatically updated to reflect the committed changes.
MaskRay added subscribers: mysterymath, phosek.EditedJul 13 2023, 2:50 PM

http://45.33.8.238/linux/112305/step_4.txt looks like a missing include

I've fixed it in 816141ce0eb899178dbcb6f0671875eb825b2f84 but it seems that the current build strategy of llvm-debuginfod makes it error-prone for refactoring. @mysterymath @phosek

http://45.33.8.238/linux/112305/step_4.txt looks like a missing include

I've fixed it in 816141ce0eb899178dbcb6f0671875eb825b2f84 but it seems that the current build strategy of llvm-debuginfod makes it error-prone for refactoring. @mysterymath @phosek

Actually I am unable to figure out how to get brotli cmake files. I relied on gn to test my fix:)

llvm/utils/gn/gn.py gen /tmp/out/gn
ninja -C /tmp/out/gn llvm-debuginfod