| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Accessor write-back depth and standard scalar conversion coverage are incomplete.
Get a fresh assessment by requesting another Copilot review.
Pull request overviewAdds C++ dataflow models for values contained in standard and BDE optional types.
Changes:
| File | Description |
|---|---|
| cpp/ql/lib/semmle/code/cpp/models/Models.qll | Registers optional models. |
| cpp/ql/lib/semmle/code/cpp/models/implementations/Optional.qll | Implements construction and mutation summaries. |
| cpp/ql/lib/ext/optional.model.yml | Defines accessor flow summaries. |
| cpp/ql/lib/change-notes/2026-09-15-optional.md | Documents the new modeling. |
| cpp/ql/test/library-tests/dataflow/optional/optional.h | Provides reduced optional APIs. |
| cpp/ql/test/library-tests/dataflow/optional/test.cpp | Tests core optional operations. |
| cpp/ql/test/library-tests/dataflow/optional/emplacement.cpp | Tests emplacement body analysis. |
| cpp/ql/test/library-tests/dataflow/optional/conversion.cpp | Tests user-defined conversions. |
| cpp/ql/test/library-tests/dataflow/optional/flow.ql | Configures optional flow tests. |
| cpp/ql/test/library-tests/dataflow/optional/flow.expected | Stores generated expectations. |
| cpp/ql/test/library-tests/dataflow/optional-std-backed/test.cpp | Tests std-backed BDE optionals. |
| cpp/ql/test/library-tests/dataflow/optional-std-backed/flow.ql | Configures std-backed tests. |
| cpp/ql/test/library-tests/dataflow/optional-std-backed/flow.expected | Stores generated expectations. |
cpp/ql/lib/ext/optional.model.yml:12
- ["std", "optional", False, "operator*", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["std", "optional", False, "operator*", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:15
- ["std", "optional", False, "operator->", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["std", "optional", False, "operator->", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:18
- ["bsl", "optional", False, "value", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["bsl", "optional", False, "value", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:21
- ["bsl", "optional", False, "operator*", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["bsl", "optional", False, "operator*", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:24
- ["bsl", "optional", False, "operator->", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["bsl", "optional", False, "operator->", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:27
- ["BloombergLP::bslstl", "Optional_Base", False, "value", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["BloombergLP::bslstl", "Optional_Base", False, "value", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:30
- ["BloombergLP::bslstl", "Optional_Base", False, "operator*", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["BloombergLP::bslstl", "Optional_Base", False, "operator*", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
cpp/ql/lib/ext/optional.model.yml:33
- ["BloombergLP::bslstl", "Optional_Base", False, "operator->", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"]
- ["BloombergLP::bslstl", "Optional_Base", False, "operator->", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"]
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
| - ["std", "optional", False, "value", "", "", "ReturnValue[*]", "Argument[-1].Element[]", "value", "manual"] | ||
| - ["std", "optional", False, "value", "", "", "ReturnValue[**]", "Argument[-1].Element[*]", "value", "manual"] |
| ( | ||
| sourceType = targetType | ||
| or | ||
| sourceType instanceof ArithmeticType and targetType instanceof ArithmeticType | ||
| ) |
| Back | FazBrowse Home | New Git URL |
This change models contained-value flow through std::optional and bsl::optional, including construction, copy/move assignment, value, operator*, operator->, and single-argument scalar emplacement.
The models preserve aggregate fields and write through the returned references, including BDE accessors on Optional_Base and configurations that inherit from std::optional. User-defined conversions and emplacement constructors remain available for body analysis.
Tests cover scalar, pointer, and aggregate payloads; const access; reference writes; copy/move operations; and constructors that use or ignore their inputs.
The engagement state and the clearing of historical taint after reset or replacement are modeled conservatively. Allocator-tag construction, legacy move emulation, value_or, and monadic operations are out of scope.