Run dmake and astyle

This commit is contained in:
amai2012 2020-02-16 19:58:09 +01:00
parent ae0a73a538
commit efeb7deb7a
3 changed files with 18 additions and 22 deletions

View File

@ -513,7 +513,7 @@ $(libcppdir)/mathlib.o: lib/mathlib.cpp lib/config.h lib/errorlogger.h lib/mathl
$(libcppdir)/path.o: lib/path.cpp externals/simplecpp/simplecpp.h lib/config.h lib/path.h lib/utils.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/path.o $(libcppdir)/path.cpp
$(libcppdir)/pathanalysis.o: lib/pathanalysis.cpp lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/pathanalysis.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/utils.h lib/valueflow.h
$(libcppdir)/pathanalysis.o: lib/pathanalysis.cpp lib/astutils.h lib/config.h lib/errorlogger.h lib/importproject.h lib/library.h lib/mathlib.h lib/pathanalysis.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/utils.h lib/valueflow.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CPPFILESDIR) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(libcppdir)/pathanalysis.o $(libcppdir)/pathanalysis.cpp
$(libcppdir)/pathmatch.o: lib/pathmatch.cpp lib/config.h lib/path.h lib/pathmatch.h lib/utils.h

View File

@ -249,14 +249,14 @@ static ProgramMemory getInitialProgramState(const Token* tok,
ProgramMemory getProgramMemory(const Token *tok, const std::unordered_map<nonneg int, ValueFlow::Value>& vars)
{
ProgramMemory programMemory;
for(const auto& p:vars) {
for (const auto& p:vars) {
const ValueFlow::Value &value = p.second;
programMemory.replace(getInitialProgramState(tok, value.tokvalue));
programMemory.replace(getInitialProgramState(tok, value.condition));
}
fillProgramMemoryFromConditions(programMemory, tok, nullptr);
ProgramMemory state;
for(const auto& p:vars) {
for (const auto& p:vars) {
nonneg int varid = p.first;
const ValueFlow::Value &value = p.second;
programMemory.setValue(varid, value);

View File

@ -2144,11 +2144,9 @@ static bool bifurcate(const Token* tok, const std::set<nonneg int>& varids, cons
return false;
}
struct SelectMapKeys
{
struct SelectMapKeys {
template<class Pair>
typename Pair::first_type operator()(const Pair& p) const
{
typename Pair::first_type operator()(const Pair& p) const {
return p.first;
}
};
@ -2157,11 +2155,11 @@ struct ValueFlowForwardAnalyzer : ForwardAnalyzer {
const TokenList* tokenlist;
ValueFlowForwardAnalyzer()
: tokenlist(nullptr)
: tokenlist(nullptr)
{}
ValueFlowForwardAnalyzer(const TokenList* t)
: tokenlist(t)
: tokenlist(t)
{}
virtual int getIndirect() const = 0;
@ -2276,11 +2274,11 @@ struct SingleValueFlowForwardAnalyzer : ValueFlowForwardAnalyzer {
ValueFlow::Value value;
SingleValueFlowForwardAnalyzer()
: ValueFlowForwardAnalyzer()
: ValueFlowForwardAnalyzer()
{}
SingleValueFlowForwardAnalyzer(const ValueFlow::Value& v, const TokenList* t)
: ValueFlowForwardAnalyzer(t), value(v)
: ValueFlowForwardAnalyzer(t), value(v)
{}
virtual const std::unordered_map<nonneg int, const Variable*>& getVars() const = 0;
@ -2292,7 +2290,7 @@ struct SingleValueFlowForwardAnalyzer : ValueFlowForwardAnalyzer {
virtual bool isAlias(const Token* tok) const OVERRIDE {
if (value.isLifetimeValue())
return false;
for(const auto& p:getVars()) {
for (const auto& p:getVars()) {
nonneg int varid = p.first;
const Variable* var = p.second;
if (tok->varId() == varid)
@ -2308,7 +2306,7 @@ struct SingleValueFlowForwardAnalyzer : ValueFlowForwardAnalyzer {
}
virtual bool isGlobal() const OVERRIDE {
for(const auto&p:getVars()) {
for (const auto&p:getVars()) {
const Variable* var = p.second;
if (var->isGlobal() && !var->isConst())
return true;
@ -2400,11 +2398,11 @@ struct VariableForwardAnalyzer : SingleValueFlowForwardAnalyzer {
std::unordered_map<nonneg int, const Variable*> varids;
VariableForwardAnalyzer()
: SingleValueFlowForwardAnalyzer(), var(nullptr), varids()
: SingleValueFlowForwardAnalyzer(), var(nullptr), varids()
{}
VariableForwardAnalyzer(const Variable* v, const ValueFlow::Value& val, const TokenList* t)
: SingleValueFlowForwardAnalyzer(val, t), var(v), varids() {
: SingleValueFlowForwardAnalyzer(val, t), var(v), varids() {
varids[var->declarationId()] = var;
}
@ -2448,22 +2446,20 @@ struct ExpressionForwardAnalyzer : SingleValueFlowForwardAnalyzer {
bool unknown;
ExpressionForwardAnalyzer()
: SingleValueFlowForwardAnalyzer(), expr(nullptr), varids(), local(true), unknown(false)
: SingleValueFlowForwardAnalyzer(), expr(nullptr), varids(), local(true), unknown(false)
{}
ExpressionForwardAnalyzer(const Token* e, const ValueFlow::Value& val, const TokenList* t)
: SingleValueFlowForwardAnalyzer(val, t), expr(e), varids(), local(true), unknown(false) {
: SingleValueFlowForwardAnalyzer(val, t), expr(e), varids(), local(true), unknown(false) {
setupExprVarIds();
}
static bool nonLocal(const Variable* var, bool deref)
{
static bool nonLocal(const Variable* var, bool deref) {
return !var || (!var->isLocal() && !var->isArgument()) || (deref && var->isArgument() && var->isPointer()) || var->isStatic() || var->isReference() || var->isExtern();
}
void setupExprVarIds()
{
void setupExprVarIds() {
visitAstNodes(expr,
[&](const Token *tok) {
if (tok->varId() == 0 && tok->isName() && tok->previous()->str() != ".") {
@ -2492,7 +2488,7 @@ struct ExpressionForwardAnalyzer : SingleValueFlowForwardAnalyzer {
virtual std::vector<int> evaluate(const Token* tok) const OVERRIDE {
if (tok->hasKnownIntValue())
return {static_cast<int>(tok->values().front().intvalue)};
return std::vector<int>{};
return std::vector<int> {};
}
virtual const std::unordered_map<nonneg int, const Variable*>& getVars() const OVERRIDE {