GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/builtin/theory_builtin_type_rules.cpp Lines: 10 10 100.0 %
Date: 2021-11-07 Branches: 13 24 54.2 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * Type rules for the builtin theory.
14
 */
15
16
#include "theory/builtin/theory_builtin_type_rules.h"
17
18
#include "expr/attribute.h"
19
#include "expr/skolem_manager.h"
20
#include "expr/uninterpreted_constant.h"
21
22
namespace cvc5 {
23
namespace theory {
24
namespace builtin {
25
26
2585
TypeNode UninterpretedConstantTypeRule::computeType(NodeManager* nodeManager,
27
                                                    TNode n,
28
                                                    bool check)
29
{
30
2585
  return n.getConst<UninterpretedConstant>().getType();
31
}
32
33
/**
34
 * Attribute for caching the ground term for each type. Maps TypeNode to the
35
 * skolem to return for mkGroundTerm.
36
 */
37
struct GroundTermAttributeId
38
{
39
};
40
typedef expr::Attribute<GroundTermAttributeId, Node> GroundTermAttribute;
41
42
320
Node SortProperties::mkGroundTerm(TypeNode type)
43
{
44
  // we typically use this method for sorts, although there are other types
45
  // where it is used as well, e.g. arrays that are not closed enumerable.
46
  GroundTermAttribute gta;
47
320
  if (type.hasAttribute(gta))
48
  {
49
285
    return type.getAttribute(gta);
50
  }
51
35
  SkolemManager* sm = NodeManager::currentNM()->getSkolemManager();
52
  Node k = sm->mkDummySkolem(
53
70
      "groundTerm", type, "a ground term created for type " + type.toString());
54
35
  type.setAttribute(gta, k);
55
35
  return k;
56
}
57
58
}  // namespace builtin
59
}  // namespace theory
60
31137
}  // namespace cvc5