Skip to content

Review and simplify unrollType uses#2019

Open
sim642 wants to merge 6 commits into
masterfrom
unrolltype-review
Open

Review and simplify unrollType uses#2019
sim642 wants to merge 6 commits into
masterfrom
unrolltype-review

Conversation

@sim642
Copy link
Copy Markdown
Member

@sim642 sim642 commented May 5, 2026

See individual commits.

sim642 added 5 commits May 5, 2026 17:22
VD.top_value already includes on-demand unrolling.
It also needs non-unrolled type because it checks for mutex, etc. types.
VD.bot_value already includes on-demand unrolling.
It also needs non-unrolled type because it checks for mutex, etc. types.
@sim642 sim642 added this to the v2.8.0 Clumsy Clurichaun milestone May 5, 2026
Copilot AI review requested due to automatic review settings May 5, 2026 14:43
@sim642 sim642 added the cleanup Refactoring, clean-up label May 5, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 refactors several call sites to rely less on explicit Cil.unrollType calls by centralizing struct-type checks in Cilfacade and passing more original typ values through to ValueDomain. In the analyzer, that mostly affects value initialization/top-value fallback paths and a small memLeak helper.

Changes:

  • Added Cilfacade.isStructType and reused shared type predicates.
  • Replaced several explicit unrollType calls in base.ml and valueDomain.ml with direct typ forwarding.
  • Simplified memLeak/global-struct filtering and union-find struct-type detection.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/common/util/cilfacade.ml Adds a new helper for identifying struct (not union) types.
src/cdomains/unionFind.ml Reuses a shared struct/union predicate instead of a local helper.
src/cdomain/value/cdomains/valueDomain.ml Simplifies TNamed handling in bot_value.
src/analyses/memLeak.ml Replaces manual global-struct filtering with the new facade helper.
src/analyses/base.ml Removes explicit unrollType calls in several VD.top_value fallback paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| t when is_mutexattr_type t -> MutexAttr (MutexAttrDomain.bot ())
| t when is_jmp_buf_type t -> JmpBuf (JmpBufs.Bufs.empty (), false)
| TNamed ({ttype=t; _}, _) -> bot_value ~varAttr (unrollType t)
| TNamed ({ttype=t; _}, _) -> bot_value ~varAttr t
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bot_value was an odd one out that had this unrollType for the TNamed case, others didn't so I removed it from here as well.
Technically, unrollType does propagate the attributes but these functions haven't done that before so I'm not sure if it's actually needed for anything. I left TODOs about this just in case.

Comment thread src/analyses/base.ml
Comment thread src/analyses/base.ml
Comment thread src/analyses/base.ml
Comment thread src/analyses/base.ml
Comment thread src/analyses/base.ml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Refactoring, clean-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants