With the conversion between StringRef and std::string now being explicit, converting SmallStrings becomes more tedious. This patch adds an explicit operator so you can write std::string(Str) instead of Str.str().str().
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/ADT/SmallString.h | ||
---|---|---|
278 | The comment is redundant, because the code self explains. |
llvm/include/llvm/ADT/SmallString.h | ||
---|---|---|
278 | It's the same in StringRef, but I agree! |
Unit tests: fail. 62303 tests passed, 1 failed and 838 were skipped.
failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_mutex_requirements_mutex/thread_mutex_recursive/try_lock.pass.cpp
clang-tidy: fail. clang-tidy found 0 errors and 4 warnings. 0 of them are added as review comments below (why?).
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml
Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
With the conversion between StringRef and std::string now being explicit, converting SmallStrings becomes more tedious
Explicitly mention 777180a32b61070a10dd330b4f038bf24e916af1 in the description.
This indirection seems like unnecessary work. Could you reimplement this as a direct conversion to std::string?
llvm/include/llvm/ADT/SmallString.h | ||
---|---|---|
278 | I'm late here, but that should probably be this->data() instead of this->begin(). It does the same thing in this case, but begin() returns an "iterator" while data() returns a pointer. And the constructor that's being called is defined as taking a pointer and size. |
llvm/include/llvm/ADT/SmallString.h | ||
---|---|---|
278 | Thanks Craig! I've fixed it for the std::string and llvm::StringRef case above. To github.com:llvm/llvm-project.git cfebd777422..a5f479473b2 master -> master |
The comment is redundant, because the code self explains.