Skip to content
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

crucible-syntax: Add support for externs #1055

Merged
merged 2 commits into from
Nov 15, 2022
Merged

crucible-syntax: Add support for externs #1055

merged 2 commits into from
Nov 15, 2022

Conversation

RyanGlScott
Copy link
Contributor

extern is to defglobal what declare is to defun. This patch adds the necessary parts to crucible-syntax to parse externs, create fresh GlobalVars for each extern, and put them into the ParsedProgram API so that callers can insert externs into the SymGlobalState with appropriate RegValues. I've included a test case that demonstrates this in action.

Fixes #1054.

`extern` is to `defglobal` what `declare` is to `defun`. This patch adds the
necessary parts to `crucible-syntax` to parse `extern`s, create fresh
`GlobalVar`s for each `extern`, and put them into the `ParsedProgram` API so
that callers can insert externs into the `SymGlobalState` with appropriate
`RegValue`s. I've included a test case that demonstrates this in action.

Fixes #1054.
`Pair TypeRepr` can usually be replaced with `Some`, given that most of the
things that `TypeRepr` is paired with (`GlobalVar`, `Atom`, `Reg`, etc.) already
store their `TypeRepr` internally.

Fixes #1053.
@RyanGlScott RyanGlScott merged commit 0f33813 into master Nov 15, 2022
@RyanGlScott RyanGlScott deleted the rgs/externs branch November 15, 2022 21:04
RyanGlScott added a commit to GaloisInc/ambient-verifier that referenced this pull request Mar 1, 2023
`extern` is to `defglobal` what `declare` is to `defun`. This patch:

* Bumps the `crucible` submodule to bring in the changes from
  GaloisInc/crucible#1055, which adds support for
  `extern`s on the `crucible-syntax` side.
* Adds the necessary plumbing to the verifier to support the use of `extern`s
  in function overrides. For the most part, this process is nearly identical to
  the process used for forward declarations (see `Wrinkle: Externs` in
  `Note [Resolving forward declarations]` in
  `Ambient.FunctionOverride.Overrides.ForwardDeclarations`), but perhaps even
  simpler due to the fact that we do not (yet) have any global variables that
  are wired directly into the verifier.

Fixes #52.
RyanGlScott added a commit that referenced this pull request Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

crucible-syntax: Support global variables defined outside of a .cbl file
3 participants