GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/smt/abstract_values.cpp Lines: 16 16 100.0 %
Date: 2021-03-22 Branches: 25 66 37.9 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file abstract_values.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Andrew Reynolds, Morgan Deters
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief Utility for constructing and maintaining abstract values.
13
 **/
14
15
#include "smt/abstract_values.h"
16
17
#include "options/smt_options.h"
18
19
namespace CVC4 {
20
namespace smt {
21
22
9620
AbstractValues::AbstractValues(NodeManager* nm)
23
    : d_nm(nm),
24
      d_fakeContext(),
25
      d_abstractValueMap(&d_fakeContext),
26
9620
      d_abstractValues()
27
{
28
9620
}
29
9599
AbstractValues::~AbstractValues() {}
30
31
105597
Node AbstractValues::substituteAbstractValues(TNode n)
32
{
33
  // We need to do this even if options::abstractValues() is off,
34
  // since the setting might have changed after we already gave out
35
  // some abstract values.
36
105597
  return d_abstractValueMap.apply(n);
37
}
38
39
8
Node AbstractValues::mkAbstractValue(TNode n)
40
{
41
3758
  Assert(options::abstractValues());
42
8
  Node& val = d_abstractValues[n];
43
8
  if (val.isNull())
44
  {
45
8
    val = d_nm->mkAbstractValue(n.getType());
46
8
    d_abstractValueMap.addSubstitution(val, n);
47
  }
48
  // We are supposed to ascribe types to all abstract values that go out.
49
16
  Node ascription = d_nm->mkConst(AscriptionType(n.getType()));
50
8
  Node retval = d_nm->mkNode(kind::APPLY_TYPE_ASCRIPTION, ascription, val);
51
16
  return retval;
52
}
53
54
}  // namespace smt
55
30426
}  // namespace CVC4