From a4f8c444320a6f0f0690682d367993f86c0bba71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 16 Apr 2018 12:55:37 +0200 Subject: [PATCH] astyle formatting [ci skip] --- lib/checkleakautovar.cpp | 12 ++++++------ lib/checkleakautovar.h | 3 +-- test/testleakautovar.cpp | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/checkleakautovar.cpp b/lib/checkleakautovar.cpp index b8665d69b..1603283c8 100644 --- a/lib/checkleakautovar.cpp +++ b/lib/checkleakautovar.cpp @@ -562,25 +562,25 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken, const Token * endToken = ftok->linkAt(1); - if(!Token::Match(endToken, "> %var% {|( %var%")) + if (!Token::Match(endToken, "> %var% {|( %var%")) continue; bool arrayDelete = false; - if(Token::findsimplematch(ftok->next(), "[ ]", endToken)) + if (Token::findsimplematch(ftok->next(), "[ ]", endToken)) arrayDelete = true; // Check deleter const Token * deleterToken = nullptr; const Token * endDeleterToken = nullptr; const Library::AllocFunc* af = nullptr; - if(Token::Match(ftok, "unique_ptr < %type% ,")) { + if (Token::Match(ftok, "unique_ptr < %type% ,")) { deleterToken = ftok->tokAt(4); endDeleterToken = endToken; - } else if(Token::Match(endToken, "> %var% {|( %var% ,")) { + } else if (Token::Match(endToken, "> %var% {|( %var% ,")) { deleterToken = endToken->tokAt(5); endDeleterToken = endToken->linkAt(2); } - if(deleterToken) { + if (deleterToken) { // Check if its a pointer to a function const Token * dtok = Token::findmatch(deleterToken, "& %name%", endDeleterToken); if (dtok) { @@ -592,7 +592,7 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken, const Scope * tscope = dtok->type()->classScope; for (const Token *tok2 = tscope->classStart; tok2 != tscope->classEnd; tok2 = tok2->next()) { af = _settings->library.dealloc(tok2); - if (af) + if (af) break; } } diff --git a/lib/checkleakautovar.h b/lib/checkleakautovar.h index eef35b8a0..cd2a43418 100644 --- a/lib/checkleakautovar.h +++ b/lib/checkleakautovar.h @@ -48,8 +48,7 @@ public: int type; AllocInfo(int type_ = 0, AllocStatus status_ = NOALLOC) : status(status_), type(type_) {} - bool managed() const - { + bool managed() const { return status < 0; } }; diff --git a/test/testleakautovar.cpp b/test/testleakautovar.cpp index 6ea18ced4..208bbd4fa 100644 --- a/test/testleakautovar.cpp +++ b/test/testleakautovar.cpp @@ -105,7 +105,7 @@ private: // mismatching allocation/deallocation TEST_CASE(mismatchAllocDealloc); - + TEST_CASE(smartPointerDeleter); // Execution reaches a 'return'