Skip to content

use std::string_view for has_prefix, has_infix, has_suffix - #9099

Draft
kroening wants to merge 1 commit into
developfrom
string_view_has_prefix
Draft

use std::string_view for has_prefix, has_infix, has_suffix#9099
kroening wants to merge 1 commit into
developfrom
string_view_has_prefix

Conversation

@kroening

@kroening kroening commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

The has_prefix function does not copy the given strings, and hence, using std::string_view can be used to relieve the caller from constructing the std::string object.

  • 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/
  • n/a 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.

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.83%. Comparing base (8575c6e) to head (e43324c).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9099      +/-   ##
===========================================
- Coverage    80.84%   80.83%   -0.01%     
===========================================
  Files         1717     1717              
  Lines       190061   190075      +14     
  Branches        73       73              
===========================================
  Hits        153648   153648              
- Misses       36413    36427      +14     

☔ View full report in Codecov by Harness.
📢 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.

@kroening
kroening force-pushed the string_view_has_prefix branch from 7c5728f to 4268510 Compare July 3, 2026 16:13
@kroening kroening changed the title use std::string_view for has_prefix use std::string_view for has_prefix, has_infix, has_suffix Jul 3, 2026
@kroening
kroening marked this pull request as draft July 6, 2026 17:57
@kroening
kroening force-pushed the string_view_has_prefix branch 2 times, most recently from 2b3601b to 261fca7 Compare August 10, 2026 19:34
The has_prefix and has_infix functions do not copy the given
strings, and hence, using std::string_view can be used to relieve the caller
from constructing the std::string object.

This should, but does not work with has_suffix, owing to a false alarm
reported by gcc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants