std::string_view("") produces a string_view instance that compares
equal to std::string_view(), but requires more complex initialization
(storing the address of the string literal, rather than zeroing).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
670 ms | linux > LLVM.Other::new-pass-manager.ll | |
2,040 ms | windows > LLVM.Other::new-pass-manager.ll |
Event Timeline
You don't really need to duplicate every single std::string test. Just enough so that it detects it, kind of like ::out::TestString. Also can you update the docs and release notes to explain this behaviour.
Applied feedback from review
- reduced test cases to verify functionality
- updated release notes
- updated docs
clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp | ||
---|---|---|
25 | nit: using size_type = decltype(sizeof(0)); | |
30 | This constructor doesn't exist according to the standard: http://eel.is/c++draft/string.view.template.general | |
65 | Can you also add tests for wstring_view? Also, perhaps one for std::string_view foo{}; (to remove the spurious {}) |
Applied review feedback
clang-tools-extra/test/clang-tidy/checkers/readability-redundant-string-init.cpp | ||
---|---|---|
65 | Done for wstring_view re std::string_view foo{}, it looks like we don't even match std::string{}, https://godbolt.org/z/zaafrb |
nit: using size_type = decltype(sizeof(0));