Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / src / LLVMVisitor / Register.cpp
blob: 873d4e020bb60219ebdc5c7319f7d0dd94cefe04 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "Register.h"

Register::Register(std::string prepend) : prepend(prepend), counter(1) {}

Register& Register::operator++() {
	++counter;
	return *this;
}

Register Register::operator++(int) {
	Register old = *this;
	++(*this);
	return old;
}

std::string Register::operator*() {
	return prepend + std::to_string(counter);
}