[clang] [clang-tools-extra] Remove `StringLiteral` in favor of `StringRef` (PR #122366)
Benoit Jacob via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 9 13:06:17 PST 2025
bjacob wrote:
> I didn't really understand the last paragraph of the PR description. How does using StringRef instead of StringLiteral reduce relocations?
It does not - sorry if that was confusingly worded. What I was trying to say is that using a plain `const char[]` instead of a StringLiteral avoids one relocation. The problem then with StringLiteral is that its existence and name naturally lead people to use it for things that could have been a `const char[]` , resulting in more relocations. Maybe not having a class named `StringLiteral` will result in more string literals remaining `const char[]`.
https://github.com/llvm/llvm-project/pull/122366
More information about the cfe-commits
mailing list