diff options
author | Benjamin Ni <benjaminniri@hotmail.com> | 2015-09-25 11:41:53 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-11-02 23:40:57 +0100 |
commit | be729e772196f33543e21cb9bac21add87726b20 (patch) | |
tree | f2150f458e2b07f8924b4702d37c09c8dd52215a /compilerplugins | |
parent | 6ccf68622e51c1b727dd042c1c1a71b5d1fd6a12 (diff) |
tdf#94269: Replace "n" prefix for bool variables with "b"
Change-Id: I178545792c7354a362658ac7ef8b1d4cf0865797
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/implicitboolconversion.cxx | 110 | ||||
-rw-r--r-- | compilerplugins/clang/literaltoboolconversion.cxx | 8 | ||||
-rw-r--r-- | compilerplugins/clang/plugin.cxx | 14 | ||||
-rw-r--r-- | compilerplugins/clang/pluginhandler.cxx | 18 | ||||
-rw-r--r-- | compilerplugins/clang/store/constantfunction.cxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/stringconstant.cxx | 24 | ||||
-rw-r--r-- | compilerplugins/clang/vclwidgets.cxx | 24 |
7 files changed, 102 insertions, 102 deletions
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index ef8bc8e2526f..091c8f280b09 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -306,15 +306,15 @@ private: std::stack<std::vector<ImplicitCastExpr const *>> nested; std::stack<CallExpr const *> calls; - bool externCIntFunctionDefinition = false; + bool bExternCIntFunctionDefinition = false; }; bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); calls.push(expr); - bool ret = RecursiveASTVisitor::TraverseCallExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCallExpr(expr); FunctionProtoType const * t; - bool ext = isExternCFunctionCall(expr, &t); + bool bExt = isExternCFunctionCall(expr, &t); assert(!nested.empty()); for (auto i: nested.top()) { auto j = std::find_if( @@ -332,7 +332,7 @@ bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) { { assert(t->isVariadic()); // ignore bool to int promotions of variadic arguments - } else if (ext) { + } else if (bExt) { if (t != nullptr) { assert( static_cast<std::size_t>(n) < compat::getNumParams(*t)); @@ -386,13 +386,13 @@ bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) { } calls.pop(); nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseCXXMemberCallExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCXXMemberCallExpr(expr); assert(!nested.empty()); for (auto i: nested.top()) { auto j = std::find_if( @@ -445,30 +445,30 @@ bool ImplicitBoolConversion::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr) reportWarning(i); } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseCXXConstructExpr(CXXConstructExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseCXXConstructExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCXXConstructExpr(expr); checkCXXConstructExpr(expr); nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseCXXTemporaryObjectExpr( CXXTemporaryObjectExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseCXXTemporaryObjectExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCXXTemporaryObjectExpr(expr); checkCXXConstructExpr(expr); nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseCStyleCastExpr(CStyleCastExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseCStyleCastExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCStyleCastExpr(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getSubExpr()->IgnoreParens()) { @@ -476,13 +476,13 @@ bool ImplicitBoolConversion::TraverseCStyleCastExpr(CStyleCastExpr * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseCXXStaticCastExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCXXStaticCastExpr(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getSubExpr()->IgnoreParens()) { @@ -490,14 +490,14 @@ bool ImplicitBoolConversion::TraverseCXXStaticCastExpr(CXXStaticCastExpr * expr) } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseCXXFunctionalCastExpr( CXXFunctionalCastExpr * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr); + bool bRet = RecursiveASTVisitor::TraverseCXXFunctionalCastExpr(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getSubExpr()->IgnoreParens()) { @@ -505,14 +505,14 @@ bool ImplicitBoolConversion::TraverseCXXFunctionalCastExpr( } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseConditionalOperator( ConditionalOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseConditionalOperator(expr); + bool bRet = RecursiveASTVisitor::TraverseConditionalOperator(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getTrueExpr()->IgnoreParens() @@ -529,12 +529,12 @@ bool ImplicitBoolConversion::TraverseConditionalOperator( } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinLT(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinLT(expr); + bool bRet = RecursiveASTVisitor::TraverseBinLT(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getLHS()->IgnoreParens() @@ -549,12 +549,12 @@ bool ImplicitBoolConversion::TraverseBinLT(BinaryOperator * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinLE(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinLE(expr); + bool bRet = RecursiveASTVisitor::TraverseBinLE(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getLHS()->IgnoreParens() @@ -569,12 +569,12 @@ bool ImplicitBoolConversion::TraverseBinLE(BinaryOperator * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinGT(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinGT(expr); + bool bRet = RecursiveASTVisitor::TraverseBinGT(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getLHS()->IgnoreParens() @@ -589,12 +589,12 @@ bool ImplicitBoolConversion::TraverseBinGT(BinaryOperator * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinGE(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinGE(expr); + bool bRet = RecursiveASTVisitor::TraverseBinGE(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getLHS()->IgnoreParens() @@ -609,12 +609,12 @@ bool ImplicitBoolConversion::TraverseBinGE(BinaryOperator * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinEQ(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinEQ(expr); + bool bRet = RecursiveASTVisitor::TraverseBinEQ(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getLHS()->IgnoreParens() @@ -629,12 +629,12 @@ bool ImplicitBoolConversion::TraverseBinEQ(BinaryOperator * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinNE(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinNE(expr); + bool bRet = RecursiveASTVisitor::TraverseBinNE(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (!((i == expr->getLHS()->IgnoreParens() @@ -649,17 +649,17 @@ bool ImplicitBoolConversion::TraverseBinNE(BinaryOperator * expr) { } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinAssign(BinaryOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinAssign(expr); + bool bRet = RecursiveASTVisitor::TraverseBinAssign(expr); // /usr/include/gtk-2.0/gtk/gtktogglebutton.h: struct _GtkToggleButton: // guint GSEAL (active) : 1; // even though <http://www.gtk.org/api/2.6/gtk/GtkToggleButton.html>: // "active" gboolean : Read / Write - bool ext = false; + bool bExt = false; MemberExpr const * me = dyn_cast<MemberExpr>(expr->getLHS()); if (me != nullptr) { FieldDecl const * fd = dyn_cast<FieldDecl>(me->getMemberDecl()); @@ -667,25 +667,25 @@ bool ImplicitBoolConversion::TraverseBinAssign(BinaryOperator * expr) { && fd->getBitWidthValue(compiler.getASTContext()) == 1) { TypedefType const * t = fd->getType()->getAs<TypedefType>(); - ext = t != nullptr && t->getDecl()->getNameAsString() == "guint"; + bExt = t != nullptr && t->getDecl()->getNameAsString() == "guint"; } } assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getRHS()->IgnoreParens() - || !(ext || isBoolExpr(expr->getLHS()))) + || !(bExt || isBoolExpr(expr->getLHS()))) { reportWarning(i); } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinAndAssign(CompoundAssignOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinAndAssign(expr); + bool bRet = RecursiveASTVisitor::TraverseBinAndAssign(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getRHS()->IgnoreParens() @@ -705,13 +705,13 @@ bool ImplicitBoolConversion::TraverseBinAndAssign(CompoundAssignOperator * expr) << expr->getRHS()->IgnoreParenImpCasts()->getType() << expr->getSourceRange(); } - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinOrAssign(CompoundAssignOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinOrAssign(expr); + bool bRet = RecursiveASTVisitor::TraverseBinOrAssign(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getRHS()->IgnoreParens() @@ -731,13 +731,13 @@ bool ImplicitBoolConversion::TraverseBinOrAssign(CompoundAssignOperator * expr) << expr->getRHS()->IgnoreParenImpCasts()->getType() << expr->getSourceRange(); } - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseBinXorAssign(CompoundAssignOperator * expr) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseBinXorAssign(expr); + bool bRet = RecursiveASTVisitor::TraverseBinXorAssign(expr); assert(!nested.empty()); for (auto i: nested.top()) { if (i != expr->getRHS()->IgnoreParens() @@ -757,12 +757,12 @@ bool ImplicitBoolConversion::TraverseBinXorAssign(CompoundAssignOperator * expr) << expr->getRHS()->IgnoreParenImpCasts()->getType() << expr->getSourceRange(); } - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseReturnStmt(ReturnStmt * stmt) { nested.push(std::vector<ImplicitCastExpr const *>()); - bool ret = RecursiveASTVisitor::TraverseReturnStmt(stmt); + bool bRet = RecursiveASTVisitor::TraverseReturnStmt(stmt); Expr const * expr = stmt->getRetValue(); if (expr != nullptr) { ExprWithCleanups const * ec = dyn_cast<ExprWithCleanups>(expr); @@ -773,41 +773,41 @@ bool ImplicitBoolConversion::TraverseReturnStmt(ReturnStmt * stmt) { } assert(!nested.empty()); for (auto i: nested.top()) { - if (i != expr || !externCIntFunctionDefinition) { + if (i != expr || !bExternCIntFunctionDefinition) { reportWarning(i); } } nested.pop(); - return ret; + return bRet; } bool ImplicitBoolConversion::TraverseFunctionDecl(FunctionDecl * decl) { - bool ext = false; + bool bExt = false; if (hasCLanguageLinkageType(decl) && decl->isThisDeclarationADefinition()) { QualType t { compat::getReturnType(*decl) }; if (t->isSpecificBuiltinType(BuiltinType::Int) || t->isSpecificBuiltinType(BuiltinType::UInt)) { - ext = true; + bExt = true; } else { TypedefType const * t2 = t->getAs<TypedefType>(); // cf. rtl_locale_equals (and sal_Int32 can be long): if (t2 != nullptr && t2->getDecl()->getNameAsString() == "sal_Int32") { - ext = true; + bExt = true; } } } - if (ext) { - assert(!externCIntFunctionDefinition); - externCIntFunctionDefinition = true; + if (bExt) { + assert(!bExternCIntFunctionDefinition); + bExternCIntFunctionDefinition = true; } - bool ret = RecursiveASTVisitor::TraverseFunctionDecl(decl); - if (ext) { - externCIntFunctionDefinition = false; + bool bRet = RecursiveASTVisitor::TraverseFunctionDecl(decl); + if (bExt) { + bExternCIntFunctionDefinition = false; } - return ret; + return bRet; } bool ImplicitBoolConversion::VisitImplicitCastExpr( diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx index 588b75ddd8e2..8e0c71973068 100644 --- a/compilerplugins/clang/literaltoboolconversion.cxx +++ b/compilerplugins/clang/literaltoboolconversion.cxx @@ -121,7 +121,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr( || isa<FloatingLiteral>(subExpr) || isa<ImaginaryLiteral>(subExpr) || isa<StringLiteral>(subExpr)) { - bool rewritten = false; + bool bRewritten = false; if (rewriter != nullptr) { SourceLocation loc { compiler.getSourceManager().getExpansionLoc( expr2->getLocStart()) }; @@ -135,19 +135,19 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr( compiler.getLangOpts()); std::string tok { s, n }; if (tok == "sal_False" || tok == "0") { - rewritten = replaceText( + bRewritten = replaceText( compiler.getSourceManager().getExpansionLoc( expr2->getLocStart()), n, "false"); } else if (tok == "sal_True" || tok == "1") { - rewritten = replaceText( + bRewritten = replaceText( compiler.getSourceManager().getExpansionLoc( expr2->getLocStart()), n, "true"); } } } - if (!rewritten) { + if (!bRewritten) { report( DiagnosticsEngine::Warning, "implicit conversion (%0) of literal of type %1 to %2", diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 10881095e60b..2f45e4fbf7cc 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -249,18 +249,18 @@ bool RewritePlugin::adjustRangeForOptions( CharSourceRange* range, RewriteOption SourceLocation fileStartLoc = SM.getLocForStartOfFile( SM.getFileID( range->getBegin())); if( fileStartLoc.isInvalid()) return false; - bool invalid = false; - const char* fileBuf = SM.getCharacterData( fileStartLoc, &invalid ); - if( invalid ) + bool isInvalid = false; + const char* fileBuf = SM.getCharacterData( fileStartLoc, &isInvalid ); + if( isInvalid ) return false; - const char* startBuf = SM.getCharacterData( range->getBegin(), &invalid ); - if( invalid ) + const char* startBuf = SM.getCharacterData( range->getBegin(), &isInvalid ); + if( isInvalid ) return false; SourceLocation locationEnd = range->getEnd(); if( range->isTokenRange()) locationEnd = locationAfterToken( locationEnd ); - const char* endBuf = SM.getCharacterData( locationEnd, &invalid ); - if( invalid ) + const char* endBuf = SM.getCharacterData( locationEnd, &isInvalid ); + if( isInvalid ) return false; const char* startPos = startBuf; --startPos; diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 74260c599cc5..54a181e55245 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -49,7 +49,7 @@ struct PluginData const int MAX_PLUGINS = 100; static PluginData plugins[ MAX_PLUGINS ]; static int pluginCount = 0; -static bool pluginObjectsCreated = false; +static bool bPluginObjectsCreated = false; PluginHandler::PluginHandler( CompilerInstance& compiler, const vector< string >& args ) : compiler( compiler ) @@ -67,7 +67,7 @@ PluginHandler::PluginHandler( CompilerInstance& compiler, const vector< string > rewriters.insert( *it ); } createPlugins( rewriters ); - pluginObjectsCreated = true; + bPluginObjectsCreated = true; } PluginHandler::~PluginHandler() @@ -122,7 +122,7 @@ void PluginHandler::createPlugins( set< string > rewriters ) void PluginHandler::registerPlugin( Plugin* (*create)( const Plugin::InstantiationData& ), const char* optionName, bool isPPCallback, bool byDefault ) { - assert( !pluginObjectsCreated ); + assert( !bPluginObjectsCreated ); assert( pluginCount < MAX_PLUGINS ); plugins[ pluginCount ].create = create; plugins[ pluginCount ].object = NULL; @@ -197,7 +197,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) and BUILDDIR is sometimes in SRCDIR. */ string modifyFile; const char* pathWarning = NULL; - bool skip = false; + bool bSkip = false; if( strncmp( e->getName(), WORKDIR "/", strlen( WORKDIR "/" )) == 0 ) pathWarning = "modified source in workdir/ : %0"; else if( strcmp( SRCDIR, BUILDDIR ) != 0 && strncmp( e->getName(), BUILDDIR "/", strlen( BUILDDIR "/" )) == 0 ) @@ -207,7 +207,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) else { pathWarning = "modified source in unknown location, not modifying : %0"; - skip = true; + bSkip = true; } if( modifyFile.empty()) modifyFile = e->getName(); @@ -227,12 +227,12 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) // Warn only now, so that files not in scope do not cause warnings. if( pathWarning != NULL ) report( DiagnosticsEngine::Warning, pathWarning ) << e->getName(); - if( skip ) + if( bSkip ) continue; char* filename = new char[ modifyFile.length() + 100 ]; sprintf( filename, "%s.new.%d", modifyFile.c_str(), getpid()); string error; - bool ok = false; + bool bOk = false; std::unique_ptr<raw_fd_ostream> ostream( compat::create_raw_fd_ostream(filename, error) ); if( error.empty()) @@ -240,11 +240,11 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) it->second.write( *ostream ); ostream->close(); if( !ostream->has_error() && rename( filename, modifyFile.c_str()) == 0 ) - ok = true; + bOk = true; } ostream->clear_error(); unlink( filename ); - if( !ok ) + if( !bOk ) report( DiagnosticsEngine::Error, "cannot write modified source to %0 (%1)" ) << modifyFile << error; delete[] filename; } diff --git a/compilerplugins/clang/store/constantfunction.cxx b/compilerplugins/clang/store/constantfunction.cxx index 5dcbcc274024..d1d67f605c2f 100644 --- a/compilerplugins/clang/store/constantfunction.cxx +++ b/compilerplugins/clang/store/constantfunction.cxx @@ -432,7 +432,7 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { } const CompoundStmt *pCompoundStmt = dyn_cast<CompoundStmt>(pFunctionDecl->getBody()); - bool aEmptyBody = false; + bool bEmptyBody = false; if (pCompoundStmt) { if (pCompoundStmt->size() > 1) { return true; @@ -454,13 +454,13 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) { } } } else { - aEmptyBody = true; + bEmptyBody = true; } } std::string aMessage = "this "; aMessage += pCXXMethodDecl ? "method" : "function"; - if (aEmptyBody) { + if (bEmptyBody) { aMessage += " is empty and should be removed, " + aFunctionName; } else { aMessage += " returns a constant value and should be converted to a constant " diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index 2688542fcda5..f9b3f5a55ce6 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -123,15 +123,15 @@ bool StringConstant::TraverseCallExpr(CallExpr * expr) { return false; } calls_.push(expr); - bool res = true; + bool bRes = true; for (auto * e: expr->children()) { if (!TraverseStmt(e)) { - res = false; + bRes = false; break; } } calls_.pop(); - return res; + return bRes; } bool StringConstant::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr) { @@ -139,15 +139,15 @@ bool StringConstant::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr) { return false; } calls_.push(expr); - bool res = true; + bool bRes = true; for (auto * e: expr->children()) { if (!TraverseStmt(e)) { - res = false; + bRes = false; break; } } calls_.pop(); - return res; + return bRes; } bool StringConstant::TraverseCXXOperatorCallExpr(CXXOperatorCallExpr * expr) @@ -156,15 +156,15 @@ bool StringConstant::TraverseCXXOperatorCallExpr(CXXOperatorCallExpr * expr) return false; } calls_.push(expr); - bool res = true; + bool bRes = true; for (auto * e: expr->children()) { if (!TraverseStmt(e)) { - res = false; + bRes = false; break; } } calls_.pop(); - return res; + return bRes; } bool StringConstant::TraverseCXXConstructExpr(CXXConstructExpr * expr) { @@ -172,15 +172,15 @@ bool StringConstant::TraverseCXXConstructExpr(CXXConstructExpr * expr) { return false; } calls_.push(expr); - bool res = true; + bool bRes = true; for (auto * e: expr->children()) { if (!TraverseStmt(e)) { - res = false; + bRes = false; break; } } calls_.pop(); - return res; + return bRes; } bool StringConstant::VisitCallExpr(CallExpr const * expr) { diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 6873ae282b43..15833e0fcacc 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -159,7 +159,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD if (!isDerivedFromWindow(pRecordDecl)) { return true; } - bool foundVclPtrField = false; + bool bFoundVclPtrField = false; for(auto fieldDecl = pRecordDecl->field_begin(); fieldDecl != pRecordDecl->field_end(); ++fieldDecl) { @@ -167,26 +167,26 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD if (pFieldRecordType) { const CXXRecordDecl *pFieldRecordTypeDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl()); if (startsWith(pFieldRecordTypeDecl->getQualifiedNameAsString(), "VclPtr")) { - foundVclPtrField = true; + bFoundVclPtrField = true; break; } } } - bool foundDispose = false; + bool bFoundDispose = false; for(auto methodDecl = pRecordDecl->method_begin(); methodDecl != pRecordDecl->method_end(); ++methodDecl) { if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") { - foundDispose = true; + bFoundDispose = true; break; } } const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pCXXDestructorDecl->getBody()); // having an empty body and no dispose() method is fine - if (!foundVclPtrField && !foundDispose && pCompoundStatement && pCompoundStatement->size() == 0) { + if (!bFoundVclPtrField && !bFoundDispose && pCompoundStatement && pCompoundStatement->size() == 0) { return true; } - if (foundVclPtrField && pCompoundStatement && pCompoundStatement->size() == 0) { + if (bFoundVclPtrField && pCompoundStatement && pCompoundStatement->size() == 0) { report( DiagnosticsEngine::Warning, "OutputDevice subclass with VclPtr field must call disposeOnce() from its destructor.", @@ -195,7 +195,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD return true; } // check that the destructor for a OutputDevice subclass does nothing except call into the disposeOnce() method - bool ok = false; + bool bOk = false; if (pCompoundStatement) { bool bFoundDisposeOnce = false; int nNumExtraStatements = 0; @@ -214,9 +214,9 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD if (!pCallExpr && !dyn_cast<ParenExpr>(x)) nNumExtraStatements++; } - ok = bFoundDisposeOnce && nNumExtraStatements == 0; + bOk = bFoundDisposeOnce && nNumExtraStatements == 0; } - if (!ok) { + if (!bOk) { SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc( pCXXDestructorDecl->getLocStart()); StringRef filename = compiler.getSourceManager().getFilename(spellingLocation); @@ -330,16 +330,16 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) { if (pParentRecordDecl && isDerivedFromWindow(pParentRecordDecl) && startsWith(recordDecl->getQualifiedNameAsString(), "VclPtr")) { - bool foundDispose = false; + bool bFoundDispose = false; for(auto methodDecl = pParentRecordDecl->method_begin(); methodDecl != pParentRecordDecl->method_end(); ++methodDecl) { if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") { - foundDispose = true; + bFoundDispose = true; break; } } - if (!foundDispose) { + if (!bFoundDispose) { report( DiagnosticsEngine::Warning, "OutputDevice subclass with a VclPtr field MUST have a dispose() method.", |