Skip to content

Commit 3bf0b7b

Browse files
danielsntedinski
authored andcommitted
Add missing type constructors (rust-lang#711)
1 parent dc04fc7 commit 3bf0b7b

File tree

1 file changed

+22
-0
lines changed
  • compiler/cbmc/src/goto_program

1 file changed

+22
-0
lines changed

compiler/cbmc/src/goto_program/typ.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,20 @@ impl Type {
369369
}
370370
}
371371

372+
pub fn is_c_size_t(&self) -> bool {
373+
match self {
374+
Type::CInteger(CIntType::SizeT) => true,
375+
_ => false,
376+
}
377+
}
378+
379+
pub fn is_c_ssize_t(&self) -> bool {
380+
match self {
381+
Type::CInteger(CIntType::SSizeT) => true,
382+
_ => false,
383+
}
384+
}
385+
372386
pub fn is_code(&self) -> bool {
373387
match self {
374388
Code { .. } => true,
@@ -620,6 +634,14 @@ impl Type {
620634
CInteger(CIntType::Int)
621635
}
622636

637+
pub fn c_size_t() -> Self {
638+
CInteger(CIntType::SizeT)
639+
}
640+
641+
pub fn c_ssize_t() -> Self {
642+
CInteger(CIntType::SSizeT)
643+
}
644+
623645
/// corresponds to [code_typet] in CBMC, representing a function type
624646
/// ret (params ..)
625647
pub fn code(parameters: Vec<Parameter>, return_type: Type) -> Self {

0 commit comments

Comments
 (0)