cprover
type_eq.cpp File Reference
#include "type_eq.h"
#include "invariant.h"
#include "namespace.h"
#include "std_types.h"
#include "symbol.h"
+ Include dependency graph for type_eq.cpp:

Go to the source code of this file.

Functions

bool type_eq (const typet &type1, const typet &type2, const namespacet &ns)
 Check types for equality at the top level. More...
 

Detailed Description

Type equality

Definition in file type_eq.cpp.

Function Documentation

◆ type_eq()

bool type_eq ( const typet type1,
const typet type2,
const namespacet ns 
)

Check types for equality at the top level.

If either of the types is a symbol type, i.e., a reference into the symbol table, retrieve it from the namespace and compare but don't do this recursively. For equality across all level in the hierarchy use base_type_eq. Example:

  • symbol_typet("a") and ns.lookup("a").type will compare equal,
  • struct_typet {symbol_typet("a")} and struct_typet {ns.lookup("a") .type} will not compare equal.
    Parameters
    type1The first type to compare.
    type2The second type to compare.
    nsThe namespace, needed for resolution of symbols.

Definition at line 31 of file type_eq.cpp.