This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Disable predefined macros in tests. NFC
ClosedPublic

Authored by sammccall on May 7 2022, 10:08 AM.

Details

Summary

These aren't needed. With them the generated predefines buffer is 13KB.
For every TestTU, we must:

  • generate the buffer (3 times: parsing preamble, scanning preamble, main file)
  • parse the buffer (again 3 times)
  • serialize all the macros it defines in the PCH
  • compress the buffer itself to write it into the PCH
  • decompress it from the PCH

Avoiding this reduces unit test time by ~25%.

Diff Detail

Event Timeline

sammccall created this revision.May 7 2022, 10:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2022, 10:08 AM
sammccall requested review of this revision.May 7 2022, 10:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2022, 10:08 AM
ilya-biryukov accepted this revision.May 9 2022, 2:08 AM

LGTM.

clang-tools-extra/clangd/unittests/TestTU.cpp
44

NIT: maybe mention that not doing this actually saves a big fraction of test time. It might not be obvious that this type of work is that expensive even for hundreds of predefined macros.

This revision is now accepted and ready to land.May 9 2022, 2:08 AM
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.