Make namespacet references const where possible#8995
Merged
tautschnig merged 1 commit intodiffblue:developfrom Apr 30, 2026
Merged
Make namespacet references const where possible#8995tautschnig merged 1 commit intodiffblue:developfrom
tautschnig merged 1 commit intodiffblue:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves const-correctness by converting namespacet & parameters/members to const namespacet & in core code and variable-sensitivity unit tests, aligning the API with the fact that namespacet is effectively immutable after construction.
Changes:
- Make
linking_diagnosticstconstructor acceptconst namespacet &. - Update WMM
cfg_visitortto store aconst namespacet &. - Update multiple variable-sensitivity unit-test helpers/tests to take/store
const namespacet &.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| unit/analyses/variable-sensitivity/variable_sensitivity_test_helpers.h | Update helper function signatures to const namespacet &. |
| unit/analyses/variable-sensitivity/variable_sensitivity_test_helpers.cpp | Keep helper definitions in sync with const namespacet & signatures. |
| unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp | Update helper functions to accept const namespacet &. |
| unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp | Make assume_testert store const namespacet & and update related helpers. |
| unit/analyses/variable-sensitivity/interval_abstract_value/extremes-go-top.cpp | Update helper signature to const namespacet & (and reflow declaration). |
| unit/analyses/variable-sensitivity/full_array_abstract_object/maximum_length.cpp | Update write_array helper signature to const namespacet &. |
| unit/analyses/variable-sensitivity/eval-member-access.cpp | Update helper prototypes/definitions to const namespacet &. |
| src/linking/linking_diagnostics.h | Make linking_diagnosticst ctor take const namespacet &. |
| src/goto-instrument/wmm/goto2graph.h | Make cfg_visitort::ns a const namespacet &. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kroening
approved these changes
Apr 30, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #8995 +/- ##
========================================
Coverage 80.50% 80.51%
========================================
Files 1704 1704
Lines 188818 188821 +3
Branches 73 73
========================================
+ Hits 152017 152022 +5
+ Misses 36801 36799 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
namespacet has no non-const member functions (other than constructors and assignment), so non-const references to it are misleading. The only legitimate non-const use is in goto_symext::symex_with_state where the namespacet object is reassigned via reset_namespacet. Changes in src/: - linking_diagnosticst constructor: namespacet& -> const namespacet& (the member was already const) - cfg_visitort (wmm): namespacet& member and constructor parameter made const Changes in unit/: - variable_sensitivity_test_helpers: all namespacet& parameters -> const - eval-member-access, assume, assume_prune, maximum_length, extremes-go-top: all namespacet& parameters and members -> const Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
bbead80 to
954ca7b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
namespacet has no non-const member functions (other than constructors and assignment), so non-const references to it are misleading. The only legitimate non-const use is in goto_symext::symex_with_state where the namespacet object is reassigned via reset_namespacet.
Changes in src/:
Changes in unit/: