[all-commits] [llvm/llvm-project] 673d96: [llvm][ADT] Make `Twine` aware of `StringLiteral`

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Aug 3 10:53:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 673d963436666000aba89e3b5c7a85056bdba8ce
      https://github.com/llvm/llvm-project/commit/673d963436666000aba89e3b5c7a85056bdba8ce
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M llvm/include/llvm/ADT/Twine.h
    M llvm/lib/Support/Twine.cpp
    M llvm/unittests/ADT/TwineTest.cpp

  Log Message:
  -----------
  [llvm][ADT] Make `Twine` aware of `StringLiteral`

The `const char *` storage backing StringLiteral has static lifetime. Making `Twine` aware of that allows us to avoid allocating heap memory in some contexts (e.g. avoid passing it to `StringSaver::save()` in a follow-up Clang patch).

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157010




More information about the All-commits mailing list