Skip to content

Commit

Permalink
Upgrade opaque pointer-related failures to panics
Browse files Browse the repository at this point in the history
This way, users who encounter them in the wild will be more strongly encouraged
to report it on the issue tracker.
  • Loading branch information
RyanGlScott committed Jun 1, 2023
1 parent b7ae243 commit 6ccc934
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/SAWScript/Crucible/LLVM/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,11 @@ constructExpandedSetupValue cc sc loc t =
Crucible.X86_FP80Type{} -> failUnsupportedType "X86_FP80"
-- See https://github.com/GaloisInc/saw-script/issues/1879 for why it is
-- tricky to support opaque pointers here.
Crucible.PtrOpaqueType -> failUnsupportedType "PtrOpaque"
Crucible.PtrOpaqueType ->
panic "SAWScript.Crucible.LLVM.Builtins.constructExpandedSetupValue"
[ "llvm_fresh_expanded_val does not support opaque pointers"
, "Please report this at: https://github.com/GaloisInc/saw-script/issues/1879"
]
where failUnsupportedType tyName = throwCrucibleSetup loc $ unwords
["llvm_fresh_expanded_var: " ++ tyName ++ " not supported"]

Expand Down
11 changes: 7 additions & 4 deletions src/SAWScript/Crucible/LLVM/Skeleton.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import qualified Data.Set as Set
import qualified Text.LLVM as LLVM
import qualified Text.LLVM.DebugUtils as LLVM

import SAWScript.Panic (panic)

--------------------------------------------------------------------------------
-- ** Skeletons

Expand Down Expand Up @@ -101,10 +103,11 @@ parseType (LLVM.PtrTo t) = pure $ TypeSkeleton t True [SizeGuess 1 True "default
-- It is unclear how to combine opaque pointers with type skeletons due to the
-- lack of a pointee type. For now, we simply fail if we encounter one
-- (see #1877).
parseType LLVM.PtrOpaque = fail $ unlines
[ "Skeleton generation does not support opaque pointers."
, "You should report this issue at: https://github.com/GaloisInc/saw-script/issues/1877"
]
parseType LLVM.PtrOpaque =
panic "SAWScript.Crucible.LLVM.Skeleton.parseType"
[ "Skeleton generation does not support opaque pointers"
, "Please report this at: https://github.com/GaloisInc/saw-script/issues/1877"
]
parseType (LLVM.Array i t) = pure $ TypeSkeleton t True
[ SizeGuess (fromIntegral i) True $ "default guess of size " <> Text.pack (show i)
]
Expand Down

0 comments on commit 6ccc934

Please sign in to comment.