diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2024-10-25 11:33:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-25 11:33:44 -0700 |
commit | 61946687bc68ccba763571cb420049b9a3749dfe (patch) | |
tree | eb0f357ec9a91fd89512db6df57d69692b1af631 /clang/lib/Serialization/ASTWriter.cpp | |
parent | 4ac0e7e400fe2a66d1fd5d5d1fa1c899dfb16716 (diff) | |
download | llvm-61946687bc68ccba763571cb420049b9a3749dfe.zip llvm-61946687bc68ccba763571cb420049b9a3749dfe.tar.gz llvm-61946687bc68ccba763571cb420049b9a3749dfe.tar.bz2 |
[clang][modules] Shrink the size of `Module::Headers` (#113395)
This patch shrinks the size of the `Module` class from 2112B to 1624B. I
wasn't able to get a good data on the actual impact on memory usage, but
given my `clang-scan-deps` workload at hand (with tens of thousands of
instances), I think there should be some win here. This also speeds up
my benchmark by under 0.1%.
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 4948902..b576822 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -3070,9 +3070,9 @@ void ASTWriter::WriteSubmodules(Module *WritingModule) { Module::HK_PrivateTextual}, {SUBMODULE_EXCLUDED_HEADER, ExcludedHeaderAbbrev, Module::HK_Excluded} }; - for (auto &HL : HeaderLists) { + for (const auto &HL : HeaderLists) { RecordData::value_type Record[] = {HL.RecordKind}; - for (auto &H : Mod->Headers[HL.HeaderKind]) + for (const auto &H : Mod->getHeaders(HL.HeaderKind)) Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten); } |