Clang import; some small tweaks

This commit is contained in:
Daniel Marjamäki 2020-01-09 13:52:17 +01:00
parent 64612bf93e
commit a9dbf129f0
2 changed files with 3 additions and 2 deletions

View File

@ -427,7 +427,8 @@ Token *clangastdump::AstNode::createTokens(TokenList *tokenList)
sep1->astOperand2(sep2);
sep2->astOperand1(expr2);
sep2->astOperand2(expr3);
createScope(tokenList, Scope::ScopeType::eFor, children[4]);
Scope *scope = createScope(tokenList, Scope::ScopeType::eFor, children[4]);
scope->classDef = forToken;
return nullptr;
}
if (nodeType == FunctionDecl) {

View File

@ -4144,7 +4144,7 @@ static void valueFlowForwardAssign(Token * const tok,
ErrorLogger * const errorLogger,
const Settings * const settings)
{
const Token * const endOfVarScope = var->typeStartToken()->scope()->bodyEnd;
const Token * const endOfVarScope = var->nameToken()->scope()->bodyEnd;
if (std::any_of(values.begin(), values.end(), std::mem_fn(&ValueFlow::Value::isLifetimeValue))) {
valueFlowForwardLifetime(tok, tokenlist, errorLogger, settings);
values.remove_if(std::mem_fn(&ValueFlow::Value::isLifetimeValue));