parent
7bbdc95f25
commit
a79dff15ab
|
@ -770,7 +770,7 @@ struct ForwardTraversal {
|
||||||
tryTraversal.updateRange(tok->next(), endBlock, depth - 1);
|
tryTraversal.updateRange(tok->next(), endBlock, depth - 1);
|
||||||
bool bail = tryTraversal.actions.isModified();
|
bool bail = tryTraversal.actions.isModified();
|
||||||
if (bail)
|
if (bail)
|
||||||
analyzer->lowerToPossible();
|
return Break();
|
||||||
|
|
||||||
while (Token::simpleMatch(endBlock, "} catch (")) {
|
while (Token::simpleMatch(endBlock, "} catch (")) {
|
||||||
Token* endCatch = endBlock->linkAt(2);
|
Token* endCatch = endBlock->linkAt(2);
|
||||||
|
|
|
@ -265,6 +265,7 @@ private:
|
||||||
TEST_CASE(moveCallback);
|
TEST_CASE(moveCallback);
|
||||||
TEST_CASE(moveClassVariable);
|
TEST_CASE(moveClassVariable);
|
||||||
TEST_CASE(forwardAndUsed);
|
TEST_CASE(forwardAndUsed);
|
||||||
|
TEST_CASE(moveAndReference);
|
||||||
|
|
||||||
TEST_CASE(funcArgNamesDifferent);
|
TEST_CASE(funcArgNamesDifferent);
|
||||||
TEST_CASE(funcArgOrderDifferent);
|
TEST_CASE(funcArgOrderDifferent);
|
||||||
|
@ -10193,6 +10194,18 @@ private:
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (warning) Access of forwarded variable 't'.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (warning) Access of forwarded variable 't'.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void moveAndReference() { // #9791
|
||||||
|
check("void g(std::string&&);\n"
|
||||||
|
"void h(const std::string&);\n"
|
||||||
|
"void f() {\n"
|
||||||
|
" std::string s;\n"
|
||||||
|
" const std::string& r = s;\n"
|
||||||
|
" g(std::move(s));\n"
|
||||||
|
" h(r);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:7]: (warning) Access of moved variable 'r'.\n", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void funcArgNamesDifferent() {
|
void funcArgNamesDifferent() {
|
||||||
check("void func1(int a, int b, int c);\n"
|
check("void func1(int a, int b, int c);\n"
|
||||||
"void func1(int a, int b, int c) { }\n"
|
"void func1(int a, int b, int c) { }\n"
|
||||||
|
|
|
@ -5407,6 +5407,18 @@ private:
|
||||||
" (void)p[i];\n"
|
" (void)p[i];\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #11492
|
||||||
|
valueFlowUninit("void f() {\n"
|
||||||
|
" int i;\n"
|
||||||
|
" try {\n"
|
||||||
|
" i = 0;\n"
|
||||||
|
" }\n"
|
||||||
|
" catch (...) {\n"
|
||||||
|
" if (i) {}\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value
|
void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value
|
||||||
|
|
Loading…
Reference in New Issue