This is an archive of the discontinued LLVM Phabricator instance.

[libc++][test] Silence MSVC warning
ClosedPublic

Authored by CaseyCarter on Jan 9 2023, 1:36 AM.

Details

Reviewers
huixie90
philnik
Group Reviewers
Restricted Project
Commits
rG96f1cd2427e4: [libc++][test] Silence MSVC warning
Summary

Our static analyzer likes to warn when loop bodies are never executed, which is true for make_string<T>(""). Build the result with basic_string's iterator-pair constructor instead, which is simpler (one liner), faster (single pass), and doesn't trigger the warning.

Diff Detail

Event Timeline

CaseyCarter created this revision.Jan 9 2023, 1:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 1:36 AM
CaseyCarter requested review of this revision.Jan 9 2023, 1:36 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptJan 9 2023, 1:36 AM
philnik accepted this revision.Jan 9 2023, 3:08 AM
philnik added a subscriber: philnik.

LGTM

libcxx/test/std/ranges/range.factories/range.istream.view/utils.h
9

Seems even simpler.

This revision is now accepted and ready to land.Jan 9 2023, 3:08 AM
CaseyCarter added inline comments.Jan 9 2023, 3:04 PM
libcxx/test/std/ranges/range.factories/range.istream.view/utils.h
9

The (pointer, length) constructor would only work when CharT is char, this works for any CharT to which a const char lvalue converts. Most notably that includes basic_string<wchar_t> which the tests use.

This revision was landed with ongoing or failed builds.Jan 9 2023, 3:05 PM
This revision was automatically updated to reflect the committed changes.