Page MenuHomePhabricator

[libc] Add a standalone flavor of an equivalent of std::string_view.
ClosedPublic

Authored by sivachandra on Feb 23 2021, 1:07 PM.

Details

Summary

This class is to serve as a replacement for llvm::StringRef as part of
the plans to limit dependency on other parts of LLVM. One use of
llvm::StringRef in MPFRWrapper has been replaced with the new class.

Diff Detail

Event Timeline

sivachandra created this revision.Feb 23 2021, 1:07 PM
sivachandra requested review of this revision.Feb 23 2021, 1:07 PM
lntue added inline comments.Feb 23 2021, 2:32 PM
libc/utils/CPP/StringView.h
43

Do we need error checking for the case when Str == nullptr but N > 0?

71

I think we need early exit when Data == nullptr, since it will reach here in that case.

Address comments.

sivachandra marked an inline comment as done.Feb 23 2021, 3:23 PM
sivachandra added inline comments.
libc/utils/CPP/StringView.h
71

Ah, good catch! Fixed now.

lntue accepted this revision.Feb 23 2021, 3:28 PM
This revision is now accepted and ready to land.Feb 23 2021, 3:28 PM
This revision was landed with ongoing or failed builds.Feb 23 2021, 3:40 PM
This revision was automatically updated to reflect the committed changes.