llvm-project
40eda358 - [AST][NFC] Use struct as string table for AttrDoc (#246986)

Commit
2 days ago
[AST][NFC] Use struct as string table for AttrDoc (#246986) Using a StringRef array has two problems: first, the length evaluation uses a strlen-like loop from std::string_view at compile time (could be fixed with StringLiteral); and second, it causes dynamic relocations. Store all strings in one single global (445 kiB) and store a second array with the offsets indexed by the attribute kind. This avoids 7.5kiB of .data.rel.ro and improves compile times of AttrDocTable.cpp. For compatibility with older MSVC, struct members cannot use an initializer directly at the member declaration in constexpr contexts but need to use a separate initializer for the entire struct.
Author
Parents
Loading