-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C++: Update expected test results after frontend update #20926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
55f33b7 to
809d440
Compare
a0260cc to
9e3d772
Compare
84743fd to
97afb1e
Compare
The new frontend version does less constant folding.
094636d to
18c9049
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates C++ test expectations following a frontend change that reduces constant folding behavior. The changes ensure that constant comparisons in required-constant contexts (static asserts, template arguments, constexpr initializers, and enum constants) are excluded from the cpp/constant-comparison query, as these represent deliberate programmer choices.
Key changes:
- Updated compiler version support documentation (Clang 19.1.0 → 21, GCC 15.0 → 15)
- Modified
cpp/constant-comparisonquery to exclude comparisons in constant-required contexts - Updated test expectations across multiple test suites to reflect reduced constant folding
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/codeql/reusables/supported-versions-compilers.rst | Updated supported Clang and GCC versions |
| cpp/ql/test/query-tests/Likely Bugs/Arithmetic/PointlessComparison/RegressionTests.cpp | Added test cases for comparisons in constant-required contexts |
| cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedLocals/code2.cpp | Corrected comment about false positive (now fixed) |
| cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedLocals/UnusedLocals.expected | Removed false positive for v2 used as template parameter |
| cpp/ql/test/query-tests/Best Practices/SloppyGlobal/SloppyGlobal.expected | Updated location spans for global variables |
| cpp/ql/test/library-tests/templates/variables/template_variables.expected | Updated location spans for template variable declarations |
| cpp/ql/test/library-tests/templates/isfromtemplateinstantiation/isfromuninstantiatedtemplate.expected | Updated location spans for var_template |
| cpp/ql/test/library-tests/scopes/parents/parents.expected | Updated location spans for template variable var |
| cpp/ql/test/library-tests/ir/ir/raw_ir.expected | Reordered IR instructions for lambda field initialization |
| cpp/ql/test/library-tests/ir/ir/aliased_ir.expected | Reordered aliased IR instructions for lambda field initialization |
| cpp/ql/test/library-tests/ir/ir/PrintAST.expected | Added assignment operators and changed ValueCategory for x |
| cpp/ql/test/library-tests/constants/addresses/addresses.expected | Added baseline for newly detected non-constant address expressions |
| cpp/ql/test/library-tests/constants/addresses/addresses.cpp | Uncommented stmtexpr_int test case |
| cpp/ql/src/change-notes/2026-01-02-constant-comparison.md | Added change note for query update |
| cpp/ql/src/Likely Bugs/Arithmetic/PointlessComparison.ql | Added exclusions for constant-required contexts |
| cpp/ql/lib/change-notes/2026-01-02-constant-folding.md | Added change note for constant folding behavior change |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
See the internal PR for further details.
Observe that the frontend now does less constant folding, which has an impact on cpp/constant-comparison. I've addressed this by excluding expressions from contexts where a constant is required. The programmer likely made a deliberate choice in that case and expects the comparison to be constant. DCA shows one new alert on Boost, which I have not been able to capture as a test case. QA does not show a significant change in alerts for cpp/constant-comparison with the changes made here.