parent
0f8f207719
commit
987c8a854e
|
@ -22,8 +22,7 @@ struct ForwardTraversal {
|
||||||
bool analyzeTerminate;
|
bool analyzeTerminate;
|
||||||
Terminate terminate = Terminate::None;
|
Terminate terminate = Terminate::None;
|
||||||
|
|
||||||
Progress Break(Terminate t = Terminate::None)
|
Progress Break(Terminate t = Terminate::None) {
|
||||||
{
|
|
||||||
if ((!analyzeOnly || analyzeTerminate) && t != Terminate::None)
|
if ((!analyzeOnly || analyzeTerminate) && t != Terminate::None)
|
||||||
terminate = t;
|
terminate = t;
|
||||||
return Progress::Break;
|
return Progress::Break;
|
||||||
|
@ -237,8 +236,7 @@ struct ForwardTraversal {
|
||||||
return ft;
|
return ft;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ForwardTraversal> tryForkScope(Token* endBlock, bool isModified = false)
|
std::vector<ForwardTraversal> tryForkScope(Token* endBlock, bool isModified = false) {
|
||||||
{
|
|
||||||
if (analyzer->updateScope(endBlock, isModified)) {
|
if (analyzer->updateScope(endBlock, isModified)) {
|
||||||
ForwardTraversal ft = forkScope(endBlock);
|
ForwardTraversal ft = forkScope(endBlock);
|
||||||
return {ft};
|
return {ft};
|
||||||
|
|
|
@ -116,8 +116,7 @@ struct ReverseTraversal {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void traverse(Token* start, const Token* end = nullptr)
|
void traverse(Token* start, const Token* end = nullptr) {
|
||||||
{
|
|
||||||
if (start == end)
|
if (start == end)
|
||||||
return;
|
return;
|
||||||
for (Token* tok = start->previous(); tok != end; tok = tok->previous()) {
|
for (Token* tok = start->previous(); tok != end; tok = tok->previous()) {
|
||||||
|
|
|
@ -3827,7 +3827,9 @@ static void valueFlowForwardAssign(Token* const tok,
|
||||||
values.remove_if(std::mem_fn(&ValueFlow::Value::isLifetimeValue));
|
values.remove_if(std::mem_fn(&ValueFlow::Value::isLifetimeValue));
|
||||||
}
|
}
|
||||||
if (std::all_of(
|
if (std::all_of(
|
||||||
vars.begin(), vars.end(), [&](const Variable* var) { return !var->isPointer() && !var->isSmartPointer(); }))
|
vars.begin(), vars.end(), [&](const Variable* var) {
|
||||||
|
return !var->isPointer() && !var->isSmartPointer();
|
||||||
|
}))
|
||||||
values.remove_if(std::mem_fn(&ValueFlow::Value::isTokValue));
|
values.remove_if(std::mem_fn(&ValueFlow::Value::isTokValue));
|
||||||
if (tok->astParent()) {
|
if (tok->astParent()) {
|
||||||
for (ValueFlow::Value& value : values) {
|
for (ValueFlow::Value& value : values) {
|
||||||
|
@ -4458,8 +4460,7 @@ struct SimpleConditionHandler : ConditionHandler {
|
||||||
const Token* exprTok,
|
const Token* exprTok,
|
||||||
const std::list<ValueFlow::Value>& values,
|
const std::list<ValueFlow::Value>& values,
|
||||||
TokenList* tokenlist,
|
TokenList* tokenlist,
|
||||||
const Settings* settings) const OVERRIDE
|
const Settings* settings) const OVERRIDE {
|
||||||
{
|
|
||||||
return valueFlowReverse(start, endToken, exprTok, values, tokenlist, settings);
|
return valueFlowReverse(start, endToken, exprTok, values, tokenlist, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6179,8 +6180,7 @@ struct ContainerConditionHandler : ConditionHandler {
|
||||||
const Token* exprTok,
|
const Token* exprTok,
|
||||||
const std::list<ValueFlow::Value>& values,
|
const std::list<ValueFlow::Value>& values,
|
||||||
TokenList* tokenlist,
|
TokenList* tokenlist,
|
||||||
const Settings* settings) const OVERRIDE
|
const Settings* settings) const OVERRIDE {
|
||||||
{
|
|
||||||
if (values.empty())
|
if (values.empty())
|
||||||
return;
|
return;
|
||||||
if (!exprTok->variable())
|
if (!exprTok->variable())
|
||||||
|
|
|
@ -2137,8 +2137,7 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void nullpointer69()
|
void nullpointer69() {
|
||||||
{
|
|
||||||
check("void f(const Scope *scope) {\n"
|
check("void f(const Scope *scope) {\n"
|
||||||
" if (scope->definedType) {}\n"
|
" if (scope->definedType) {}\n"
|
||||||
" while (scope) {\n"
|
" while (scope) {\n"
|
||||||
|
|
Loading…
Reference in New Issue