[all-commits] [llvm/llvm-project] 8aad33: [libc] Fix API for remove_{prefix, suffix}

Jeff Bailey via All-commits all-commits at lists.llvm.org
Mon Jul 18 07:40:22 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8aad330eebc0b9cfd8dd00e8ed692cb89e7577df
      https://github.com/llvm/llvm-project/commit/8aad330eebc0b9cfd8dd00e8ed692cb89e7577df
  Author: Jeff Bailey <jeffbailey at google.com>
  Date:   2022-07-18 (Mon, 18 Jul 2022)

  Changed paths:
    M libc/src/__support/CPP/StringView.h
    M libc/src/stdlib/getenv.cpp
    M libc/test/src/__support/CPP/stringview_test.cpp

  Log Message:
  -----------
  [libc] Fix API for remove_{prefix, suffix}

The API in StringView.h for remove_prefix was incorrect and was returning a
new StringView rather than just altering the view.

As part of this, also removed some of the safety features.  The comment
correctly noted that the behaviour is undefined in some cases,
but the code and test cases checked for that.

One caller was relying on the old behaviour, so fixed it and added some
comments.

Tested:
check-libc
llvmlibc
libc-loader-tests

Reviewed By: gchatelet

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




More information about the All-commits mailing list