Apply clang-format to code base

This commit is contained in:
clang-format-bot 2022-09-22 21:26:05 +03:00 committed by ζeh Matt
parent f37d0be806
commit ddb0522bbf
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0
2199 changed files with 118692 additions and 114392 deletions

View file

@ -1,48 +1,51 @@
#include "output.hpp"
#include <cassert>
#include <algorithm>
#include <cassert>
#include <iterator>
#include "locals.hpp"
namespace Compiler
{
Output::Output (Locals& locals) : mLocals (locals) {}
Output::Output(Locals& locals)
: mLocals(locals)
{
}
void Output::getCode (std::vector<Interpreter::Type_Code>& code) const
void Output::getCode(std::vector<Interpreter::Type_Code>& code) const
{
code.clear();
// header
code.push_back (static_cast<Interpreter::Type_Code> (mCode.size()));
assert (mLiterals.getIntegerSize()%4==0);
code.push_back (static_cast<Interpreter::Type_Code> (mLiterals.getIntegerSize()/4));
assert (mLiterals.getFloatSize()%4==0);
code.push_back (static_cast<Interpreter::Type_Code> (mLiterals.getFloatSize()/4));
assert (mLiterals.getStringSize()%4==0);
code.push_back (static_cast<Interpreter::Type_Code> (mLiterals.getStringSize()/4));
code.push_back(static_cast<Interpreter::Type_Code>(mCode.size()));
assert(mLiterals.getIntegerSize() % 4 == 0);
code.push_back(static_cast<Interpreter::Type_Code>(mLiterals.getIntegerSize() / 4));
assert(mLiterals.getFloatSize() % 4 == 0);
code.push_back(static_cast<Interpreter::Type_Code>(mLiterals.getFloatSize() / 4));
assert(mLiterals.getStringSize() % 4 == 0);
code.push_back(static_cast<Interpreter::Type_Code>(mLiterals.getStringSize() / 4));
// code
std::copy (mCode.begin(), mCode.end(), std::back_inserter (code));
std::copy(mCode.begin(), mCode.end(), std::back_inserter(code));
// literals
mLiterals.append (code);
mLiterals.append(code);
}
const Literals& Output::getLiterals() const
{
return mLiterals;
}
const std::vector<Interpreter::Type_Code>& Output::getCode() const
{
return mCode;
}
const Locals& Output::getLocals() const
{
return mLocals;
@ -52,17 +55,17 @@ namespace Compiler
{
return mLiterals;
}
std::vector<Interpreter::Type_Code>& Output::getCode()
{
return mCode;
}
Locals& Output::getLocals()
{
return mLocals;
}
void Output::clear()
{
mLiterals.clear();
@ -70,4 +73,3 @@ namespace Compiler
mLocals.clear();
}
}