Skip to content

Commit bed7912

Browse files
authored
removed duplicated ErrorPath* aliases (danmar#6763)
1 parent 508eb98 commit bed7912

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

lib/valueflow.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ ValueFlow::Value ValueFlow::getLifetimeObjValue(const Token *tok, bool inconclus
19721972
template<class Predicate>
19731973
static std::vector<ValueFlow::LifetimeToken> getLifetimeTokens(const Token* tok,
19741974
bool escape,
1975-
ValueFlow::Value::ErrorPath errorPath,
1975+
ErrorPath errorPath,
19761976
Predicate pred,
19771977
const Settings& settings,
19781978
int depth = 20)
@@ -2120,7 +2120,7 @@ static std::vector<ValueFlow::LifetimeToken> getLifetimeTokens(const Token* tok,
21202120
return {{tok, std::move(errorPath)}};
21212121
}
21222122

2123-
std::vector<ValueFlow::LifetimeToken> ValueFlow::getLifetimeTokens(const Token* tok, const Settings& settings, bool escape, ValueFlow::Value::ErrorPath errorPath)
2123+
std::vector<ValueFlow::LifetimeToken> ValueFlow::getLifetimeTokens(const Token* tok, const Settings& settings, bool escape, ErrorPath errorPath)
21242124
{
21252125
return getLifetimeTokens(tok, escape, std::move(errorPath), [](const Token*) {
21262126
return false;
@@ -2130,14 +2130,14 @@ std::vector<ValueFlow::LifetimeToken> ValueFlow::getLifetimeTokens(const Token*
21302130
bool ValueFlow::hasLifetimeToken(const Token* tok, const Token* lifetime, const Settings& settings)
21312131
{
21322132
bool result = false;
2133-
getLifetimeTokens(tok, false, ValueFlow::Value::ErrorPath{}, [&](const Token* tok2) {
2133+
getLifetimeTokens(tok, false, ErrorPath{}, [&](const Token* tok2) {
21342134
result = tok2->exprId() == lifetime->exprId();
21352135
return result;
21362136
}, settings);
21372137
return result;
21382138
}
21392139

2140-
static const Token* getLifetimeToken(const Token* tok, ValueFlow::Value::ErrorPath& errorPath, const Settings& settings, bool* addressOf = nullptr)
2140+
static const Token* getLifetimeToken(const Token* tok, ErrorPath& errorPath, const Settings& settings, bool* addressOf = nullptr)
21412141
{
21422142
std::vector<ValueFlow::LifetimeToken> lts = ValueFlow::getLifetimeTokens(tok, settings);
21432143
if (lts.size() != 1)
@@ -2150,7 +2150,7 @@ static const Token* getLifetimeToken(const Token* tok, ValueFlow::Value::ErrorPa
21502150
return lts.front().token;
21512151
}
21522152

2153-
const Variable* ValueFlow::getLifetimeVariable(const Token* tok, ValueFlow::Value::ErrorPath& errorPath, const Settings& settings, bool* addressOf)
2153+
const Variable* ValueFlow::getLifetimeVariable(const Token* tok, ErrorPath& errorPath, const Settings& settings, bool* addressOf)
21542154
{
21552155
const Token* tok2 = getLifetimeToken(tok, errorPath, settings, addressOf);
21562156
if (tok2 && tok2->variable())
@@ -2160,7 +2160,7 @@ const Variable* ValueFlow::getLifetimeVariable(const Token* tok, ValueFlow::Valu
21602160

21612161
const Variable* ValueFlow::getLifetimeVariable(const Token* tok, const Settings& settings)
21622162
{
2163-
ValueFlow::Value::ErrorPath errorPath;
2163+
ErrorPath errorPath;
21642164
return getLifetimeVariable(tok, errorPath, settings, nullptr);
21652165
}
21662166

lib/valueflow.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ namespace ValueFlow {
7373

7474
struct LifetimeToken {
7575
const Token* token{};
76-
Value::ErrorPath errorPath;
76+
ErrorPath errorPath;
7777
bool addressOf{};
7878
bool inconclusive{};
7979

8080
LifetimeToken() = default;
8181

82-
LifetimeToken(const Token* token, Value::ErrorPath errorPath)
82+
LifetimeToken(const Token* token, ErrorPath errorPath)
8383
: token(token), errorPath(std::move(errorPath))
8484
{}
8585

86-
LifetimeToken(const Token* token, bool addressOf, Value::ErrorPath errorPath)
86+
LifetimeToken(const Token* token, bool addressOf, ErrorPath errorPath)
8787
: token(token), errorPath(std::move(errorPath)), addressOf(addressOf)
8888
{}
8989

@@ -112,17 +112,17 @@ namespace ValueFlow {
112112
std::vector<LifetimeToken> getLifetimeTokens(const Token* tok,
113113
const Settings& settings,
114114
bool escape = false,
115-
Value::ErrorPath errorPath = Value::ErrorPath{});
115+
ErrorPath errorPath = ErrorPath{});
116116

117117
bool hasLifetimeToken(const Token* tok, const Token* lifetime, const Settings& settings);
118118

119-
const Variable* getLifetimeVariable(const Token* tok, Value::ErrorPath& errorPath, const Settings& settings, bool* addressOf = nullptr);
119+
const Variable* getLifetimeVariable(const Token* tok, ErrorPath& errorPath, const Settings& settings, bool* addressOf = nullptr);
120120

121121
const Variable* getLifetimeVariable(const Token* tok, const Settings& settings);
122122

123123
bool isLifetimeBorrowed(const Token *tok, const Settings &settings);
124124

125-
std::string lifetimeMessage(const Token *tok, const Value *val, Value::ErrorPath &errorPath);
125+
std::string lifetimeMessage(const Token *tok, const Value *val, ErrorPath &errorPath);
126126

127127
CPPCHECKLIB Value getLifetimeObjValue(const Token *tok, bool inconclusive = false);
128128

lib/vfvalue.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
//---------------------------------------------------------------------------
2323

2424
#include "config.h"
25+
#include "errortypes.h"
2526
#include "mathlib.h"
2627

2728
#include <cassert>
2829
#include <cmath>
2930
#include <cstdint>
3031
#include <functional>
31-
#include <list>
3232
#include <string>
3333
#include <type_traits>
3434
#include <utility>
@@ -40,8 +40,6 @@ namespace ValueFlow
4040
{
4141
class CPPCHECKLIB Value {
4242
public:
43-
using ErrorPathItem = std::pair<const Token *, std::string>;
44-
using ErrorPath = std::list<ErrorPathItem>;
4543
enum class Bound : std::uint8_t { Upper, Lower, Point };
4644

4745
explicit Value(long long val = 0, Bound b = Bound::Point) :

test/testvalueflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class TestValueFlow : public TestFixture {
371371

372372
std::ostringstream ostr;
373373
for (const ValueFlow::Value &v : tok->values()) {
374-
for (const ValueFlow::Value::ErrorPathItem &ep : v.errorPath) {
374+
for (const ErrorPathItem &ep : v.errorPath) {
375375
const Token *eptok = ep.first;
376376
const std::string &msg = ep.second;
377377
ostr << eptok->linenr() << ',' << msg << '\n';

0 commit comments

Comments
 (0)