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; return false;
if (info.tok->varId() == skipVarId) if (info.tok->varId() == skipVarId)
return false; return false;
if (info.tok->variable()->isReference() && if (info.tok->variable()->isReference() &&
!isVariableDecl(info.tok) && !isVariableDecl(info.tok) &&
reaches(info.tok->variable()->nameToken(), tok, library, nullptr)) { reaches(info.tok->variable()->nameToken(), tok, library, nullptr)) {
ErrorPath ep; ErrorPath ep;
bool addressOf = false; bool addressOf = false;
const Variable* var = getLifetimeVariable(info.tok, ep, &addressOf); const Variable* var = getLifetimeVariable(info.tok, ep, &addressOf);

View File

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

View File

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

View File

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

View File

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

View File

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