From 8c591308cb6dd64164523e6562c9ccfd6f33fb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 30 Oct 2019 17:58:19 +0100 Subject: [PATCH] astyle formatting [ci skip] --- lib/programmemory.cpp | 36 +++++++++++++++++++++++------------- lib/programmemory.h | 6 +++--- test/testtokenize.cpp | 2 +- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index b2993b1be..275cfccb0 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -5,11 +5,13 @@ #include "symboldatabase.h" #include -void ProgramMemory::setValue(nonneg int varid, const ValueFlow::Value &value) { +void ProgramMemory::setValue(nonneg int varid, const ValueFlow::Value &value) +{ values[varid] = value; } -bool ProgramMemory::getIntValue(nonneg int varid, MathLib::bigint* result) const { +bool ProgramMemory::getIntValue(nonneg int varid, MathLib::bigint* result) const +{ const std::map::const_iterator it = values.find(varid); const bool found = it != values.end() && it->second.isIntValue(); if (found) @@ -17,11 +19,13 @@ bool ProgramMemory::getIntValue(nonneg int varid, MathLib::bigint* result) const return found; } -void ProgramMemory::setIntValue(nonneg int varid, MathLib::bigint value) { +void ProgramMemory::setIntValue(nonneg int varid, MathLib::bigint value) +{ values[varid] = ValueFlow::Value(value); } -bool ProgramMemory::getTokValue(nonneg int varid, const Token** result) const { +bool ProgramMemory::getTokValue(nonneg int varid, const Token** result) const +{ const std::map::const_iterator it = values.find(varid); const bool found = it != values.end() && it->second.isTokValue(); if (found) @@ -29,28 +33,34 @@ bool ProgramMemory::getTokValue(nonneg int varid, const Token** result) const { return found; } -bool ProgramMemory::hasValue(nonneg int varid) { +bool ProgramMemory::hasValue(nonneg int varid) +{ return values.find(varid) != values.end(); } -void ProgramMemory::swap(ProgramMemory &pm) { +void ProgramMemory::swap(ProgramMemory &pm) +{ values.swap(pm.values); } -void ProgramMemory::clear() { +void ProgramMemory::clear() +{ values.clear(); } -bool ProgramMemory::empty() const { +bool ProgramMemory::empty() const +{ return values.empty(); } -void ProgramMemory::replace(const ProgramMemory &pm) { +void ProgramMemory::replace(const ProgramMemory &pm) +{ for (auto&& p:pm.values) values[p.first] = p.second; } -void ProgramMemory::insert(const ProgramMemory &pm) { +void ProgramMemory::insert(const ProgramMemory &pm) +{ for (auto&& p:pm.values) values.insert(p); } @@ -220,9 +230,9 @@ ProgramMemory getProgramMemory(const Token *tok, nonneg int varid, const ValueFl } void execute(const Token *expr, - ProgramMemory * const programMemory, - MathLib::bigint *result, - bool *error) + ProgramMemory * const programMemory, + MathLib::bigint *result, + bool *error) { if (!expr) *error = true; diff --git a/lib/programmemory.h b/lib/programmemory.h index b6dd1ab29..655e1df68 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -30,9 +30,9 @@ struct ProgramMemory { }; void execute(const Token *expr, - ProgramMemory * const programMemory, - MathLib::bigint *result, - bool *error); + ProgramMemory * const programMemory, + MathLib::bigint *result, + bool *error); /** * Is condition always false when variable has given value? diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 83e15bfc2..46c37d525 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7620,7 +7620,7 @@ private: " a=b;\n" " }\n" "}")); - + // daca@home hang ASSERT_EQUALS("a{([= 0return b{([= fori0=i10!=i++;;(", testAst("a = [&]() -> std::pair { return 0; };\n"