Coverage Report

Created: 2026-07-13 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/solidity/libsolidity/formal/SSAVariable.h
Line
Count
Source
1
/*
2
  This file is part of solidity.
3
4
  solidity is free software: you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
6
  the Free Software Foundation, either version 3 of the License, or
7
  (at your option) any later version.
8
9
  solidity is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
  GNU General Public License for more details.
13
14
  You should have received a copy of the GNU General Public License
15
  along with solidity.  If not, see <http://www.gnu.org/licenses/>.
16
*/
17
// SPDX-License-Identifier: GPL-3.0
18
19
#pragma once
20
21
#include <memory>
22
23
namespace solidity::frontend::smt
24
{
25
26
/**
27
 * This class represents the SSA representation of a program variable.
28
 */
29
class SSAVariable
30
{
31
public:
32
  SSAVariable();
33
  /// Resets index to 0 and next index to 1.
34
  void resetIndex();
35
  /// Sets index to _index and only adjusts next if next <= _index.
36
  void setIndex(unsigned _index);
37
38
  /// This function returns the current index of this SSA variable.
39
0
  unsigned index() const { return m_currentIndex; }
40
8.08M
  unsigned& index() { return m_currentIndex; }
41
42
  unsigned operator++()
43
1.24M
  {
44
1.24M
    return m_currentIndex = m_nextFreeIndex++;
45
1.24M
  }
46
47
private:
48
  unsigned m_currentIndex;
49
  unsigned m_nextFreeIndex;
50
};
51
52
}