[llvm] [ADT] Teach StringRef to derive from std::string_view (PR #113752)

LLVM Continuous Integration via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 26 10:21:41 PDT 2024


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `flang-aarch64-latest-gcc` running on `linaro-flang-aarch64-latest-gcc` while building `llvm` at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/5375

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 5 (build-unified-tree) failure: build (failure)
...
48.128 [7228/4/28] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ABIBreak.cpp.o
48.262 [7228/3/29] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/DLangDemangle.cpp.o
49.286 [7228/2/30] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o
49.419 [7225/4/31] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CRC.cpp.o
49.651 [7225/3/32] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.o
51.007 [7225/2/33] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Compression.cpp.o
51.099 [7223/3/34] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTF.cpp.o
52.918 [7223/2/35] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ConvertEBCDIC.cpp.o
53.047 [7220/4/36] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.o
53.527 [7220/3/37] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o
FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_EXPORTS -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/lib/Support -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/llvm/lib/Support -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/include -I/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17 -fPIC -UNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o -c /home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/llvm-project/llvm/lib/Support/CommandLine.cpp
../llvm-project/llvm/lib/Support/CommandLine.cpp: In function ‘void ExpandBasePaths(llvm::StringRef, llvm::StringSaver&, const char*&)’:
../llvm-project/llvm/lib/Support/CommandLine.cpp:1127:54: error: call of overloaded ‘StringRef(const llvm::StringLiteral&)’ is ambiguous
 1127 |   for (StringRef::size_type TokenPos = ArgString.find(Token);
      |                                        ~~~~~~~~~~~~~~^~~~~~~
In file included from ../llvm-project/llvm/include/llvm/ADT/StringMapEntry.h:19,
                 from ../llvm-project/llvm/include/llvm/ADT/StringMap.h:17,
                 from ../llvm-project/llvm/include/llvm/Support/CommandLine.h:26,
                 from ../llvm-project/llvm/lib/Support/CommandLine.cpp:18:
../llvm-project/llvm/include/llvm/ADT/StringRef.h:103:28: note: candidate: ‘constexpr llvm::StringRef::StringRef(std::string_view)’
  103 |     /*implicit*/ constexpr StringRef(std::string_view Str) : Base(Str) {}
      |                            ^~~~~~~~~
../llvm-project/llvm/include/llvm/ADT/StringRef.h:51:26: note: candidate: ‘constexpr llvm::StringRef::StringRef(const llvm::StringRef&)’
   51 |   class LLVM_GSL_POINTER StringRef : public std::string_view {
      |                          ^~~~~~~~~
../llvm-project/llvm/include/llvm/ADT/StringRef.h:313:41: note:   initializing argument 1 of ‘size_t llvm::StringRef::find(llvm::StringRef, size_t) const’
  313 |     [[nodiscard]] size_t find(StringRef Str, size_t From = 0) const;
      |                               ~~~~~~~~~~^~~
../llvm-project/llvm/lib/Support/CommandLine.cpp:1129:33: error: call of overloaded ‘StringRef(const llvm::StringLiteral&)’ is ambiguous
 1129 |        TokenPos = ArgString.find(Token, StartPos)) {
      |                   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
../llvm-project/llvm/include/llvm/ADT/StringRef.h:103:28: note: candidate: ‘constexpr llvm::StringRef::StringRef(std::string_view)’
  103 |     /*implicit*/ constexpr StringRef(std::string_view Str) : Base(Str) {}
      |                            ^~~~~~~~~
../llvm-project/llvm/include/llvm/ADT/StringRef.h:51:26: note: candidate: ‘constexpr llvm::StringRef::StringRef(const llvm::StringRef&)’
   51 |   class LLVM_GSL_POINTER StringRef : public std::string_view {
      |                          ^~~~~~~~~
../llvm-project/llvm/include/llvm/ADT/StringRef.h:313:41: note:   initializing argument 1 of ‘size_t llvm::StringRef::find(llvm::StringRef, size_t) const’
  313 |     [[nodiscard]] size_t find(StringRef Str, size_t From = 0) const;
      |                               ~~~~~~~~~~^~~
53.997 [7220/2/38] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/CSKYAttributes.cpp.o
54.464 [7220/1/39] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTFWrapper.cpp.o
ninja: build stopped: subcommand failed.

```

</details>

https://github.com/llvm/llvm-project/pull/113752


More information about the llvm-commits mailing list