Skip to content

use std::string_view in string_utils#9005

Open
kroening wants to merge 1 commit into
developfrom
string_utils_string_view
Open

use std::string_view in string_utils#9005
kroening wants to merge 1 commit into
developfrom
string_utils_string_view

Conversation

@kroening
Copy link
Copy Markdown
Collaborator

This introduces std::string_view as a replacement for std::string parameters for the string utility functions in util/string_utils.h, in the hope of avoiding copies of string contents.

The change is designed not to break any usage of the functions; C++17 guarantees that there's an implicit conversion from std::string to std::string_view.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@kroening kroening force-pushed the string_utils_string_view branch from 107e7f5 to a6d99d2 Compare May 11, 2026 17:40
This introduces std::string_view as a replacement for std::string parameters
for the string utility functions in util/string_utils.h, in the hope of
avoiding copies of string contents.

The change is designed not to break any usage of the functions; C++17
guarantees that there's an implicit conversion from std::string to
std::string_view.  The exception is a single-charater string constructed
from char.
@kroening kroening force-pushed the string_utils_string_view branch from a6d99d2 to e81b174 Compare May 11, 2026 17:41
@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 98.55072% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.55%. Comparing base (166a7d4) to head (e81b174).

Files with missing lines Patch % Lines
src/util/string_utils.cpp 78.94% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9005   +/-   ##
========================================
  Coverage    80.55%   80.55%           
========================================
  Files         1707     1707           
  Lines       189016   189015    -1     
  Branches        73       73           
========================================
+ Hits        152261   152262    +1     
+ Misses       36755    36753    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant