[all-commits] [llvm/llvm-project] bbbc4f: Avoid keeping internal string_views in Twine.

Sterling-Augustine via All-commits all-commits at lists.llvm.org
Tue Jul 20 08:47:33 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bbbc4f110e35ac709b943efaa1c4c99ec073da30
      https://github.com/llvm/llvm-project/commit/bbbc4f110e35ac709b943efaa1c4c99ec073da30
  Author: Sterling Augustine <saugustine at google.com>
  Date:   2021-07-20 (Tue, 20 Jul 2021)

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

  Log Message:
  -----------
  Avoid keeping internal string_views in Twine.

This is a follow-up to https://reviews.llvm.org/D103935

A Twine's internal layout should not depend on which version of the
C++ standard is in use. Dynamically linking binaries compiled with two
different layouts (eg, --std=c++14 vs --std=c++17) ends up
problematic.

This change avoids that issue by immediately converting a
string_view to a pointer-and-length at the cost of an extra eight-bytes
in Twine.

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




More information about the All-commits mailing list