parent
211ab3dd63
commit
94b6c87049
|
@ -501,8 +501,6 @@ bool FwdAnalysis::possiblyAliased(const Token *expr, const Token *startToken) co
|
|||
const bool pure = false;
|
||||
const bool followVar = false;
|
||||
for (const Token *tok = startToken; tok; tok = tok->previous()) {
|
||||
if (tok->str() == "{" && tok->scope()->type == Scope::eFunction && !(tok->astParent() && tok->astParent()->str() == ","))
|
||||
break;
|
||||
|
||||
if (Token::Match(tok, "%name% (") && !Token::Match(tok, "if|while|for")) {
|
||||
// Is argument passed by reference?
|
||||
|
|
|
@ -161,6 +161,7 @@ private:
|
|||
TEST_CASE(localvaralias18); // ticket #9234 - iterator
|
||||
TEST_CASE(localvaralias19); // ticket #9828
|
||||
TEST_CASE(localvaralias20); // ticket #10966
|
||||
TEST_CASE(localvaralias21);
|
||||
TEST_CASE(localvarasm);
|
||||
TEST_CASE(localvarstatic);
|
||||
TEST_CASE(localvarextern);
|
||||
|
@ -4926,6 +4927,18 @@ private:
|
|||
errout.str());
|
||||
}
|
||||
|
||||
void localvaralias21() { // #11728
|
||||
functionVariableUsage("void f(int i) {\n"
|
||||
" bool b = true;\n"
|
||||
" bool* p = &b;\n"
|
||||
" int j{};\n"
|
||||
" if (i)\n"
|
||||
" b = false;\n"
|
||||
" if (*p) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvarasm() {
|
||||
|
||||
functionVariableUsage("void foo(int &b)\n"
|
||||
|
|
Loading…
Reference in New Issue