astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2019-09-02 06:59:07 +02:00
parent cb509f1a8b
commit 7d63bdee6f
6 changed files with 36 additions and 36 deletions

View File

@ -831,10 +831,10 @@ void CheckStl::invalidContainer()
return false;
if (info.tok->varId() == skipVarId)
return false;
if (info.tok->variable()->isReference() &&
!isVariableDecl(info.tok) &&
if (info.tok->variable()->isReference() &&
!isVariableDecl(info.tok) &&
reaches(info.tok->variable()->nameToken(), tok, library, nullptr)) {
ErrorPath ep;
bool addressOf = false;
const Variable* var = getLifetimeVariable(info.tok, ep, &addressOf);

View File

@ -1364,7 +1364,7 @@ void CheckUninitVar::valueFlowUninit()
while (Token::simpleMatch(nextTok->astParent(), "."))
nextTok = nextTok->astParent();
nextTok = nextAfterAstRightmostLeaf(nextTok);
if(nextTok == scope.bodyEnd)
if (nextTok == scope.bodyEnd)
break;
tok = nextTok ? nextTok : tok;
}

View File

@ -1040,14 +1040,14 @@ private:
}
void comparisonOfBoolWithInt9() { // #9304
check("bool f(int a, bool b)\n"
"{\n"
" if ((a == 0 ? false : true) != b) {\n"
" b = !b;\n"
" }\n"
" return b;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("bool f(int a, bool b)\n"
"{\n"
" if ((a == 0 ? false : true) != b) {\n"
" b = !b;\n"
" }\n"
" return b;\n"
"}");
ASSERT_EQUALS("", errout.str());
}

View File

@ -6695,11 +6695,11 @@ private:
// don't warn if some other instance's members are assigned to
checkInitializationListUsage("class C {\n"
"public:\n"
" C(C& c) : m_i(c.m_i) { c.m_i = (Foo)-1; }\n"
"private:\n"
" Foo m_i;\n"
"};");
"public:\n"
" C(C& c) : m_i(c.m_i) { c.m_i = (Foo)-1; }\n"
"private:\n"
" Foo m_i;\n"
"};");
ASSERT_EQUALS("", errout.str());
}

View File

@ -7079,17 +7079,17 @@ private:
void incomplete_type() {
GET_SYMBOL_DB("template<class _Ty,\n"
" class _Alloc = std::allocator<_Ty>>\n"
" class SLSurfaceLayerData\n"
" : public _Vector_alloc<_Vec_base_types<_Ty, _Alloc>>\n"
"{ // varying size array of values\n"
"\n"
" using reverse_iterator = _STD reverse_iterator<iterator>;\n"
" using const_reverse_iterator = _STD reverse_iterator<const_iterator>;\n"
" const_reverse_iterator crend() const noexcept\n"
" { // return iterator for end of reversed nonmutable sequence\n"
" return (rend());\n"
" }\n"
"};");
" class SLSurfaceLayerData\n"
" : public _Vector_alloc<_Vec_base_types<_Ty, _Alloc>>\n"
"{ // varying size array of values\n"
"\n"
" using reverse_iterator = _STD reverse_iterator<iterator>;\n"
" using const_reverse_iterator = _STD reverse_iterator<const_iterator>;\n"
" const_reverse_iterator crend() const noexcept\n"
" { // return iterator for end of reversed nonmutable sequence\n"
" return (rend());\n"
" }\n"
"};");
(void)db;
ASSERT_EQUALS("", errout.str());

View File

@ -4443,14 +4443,14 @@ private:
}
void uninitvar_nonmember() {
valueFlowUninit( "struct Foo {\n"
" int bar;\n"
"};\n"
"\n"
"int main() {\n"
" Foo* foo;\n"
" foo.b\n"
"}\n");
valueFlowUninit("struct Foo {\n"
" int bar;\n"
"};\n"
"\n"
"int main() {\n"
" Foo* foo;\n"
" foo.b\n"
"}\n");
ASSERT_EQUALS("[test.cpp:7]: (error) Uninitialized variable: foo\n", errout.str());
}