diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-02-02 19:38:56 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-02-02 22:59:45 +0100 |
commit | f5ee30c3eeb104c9178646b8a098e882593ea4df (patch) | |
tree | b4af123c8aba0382dea99a169668e89a82b94a00 /compilerplugins/clang | |
parent | always use the report() helper (diff) | |
download | core-f5ee30c3eeb104c9178646b8a098e882593ea4df.tar.gz core-f5ee30c3eeb104c9178646b8a098e882593ea4df.zip |
append [loplugin] automatically in report() rathen than manually everywhere
Change-Id: I2f98622f152ae0c7ac8d1113d6380f686ac7234c
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r-- | compilerplugins/clang/bodynotinblock.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/plugin.cxx | 7 | ||||
-rw-r--r-- | compilerplugins/clang/pluginhandler.cxx | 12 | ||||
-rw-r--r-- | compilerplugins/clang/postfixincrementfix.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/sallogareas.cxx | 10 | ||||
-rw-r--r-- | compilerplugins/clang/unusedvariablecheck.cxx | 4 |
6 files changed, 21 insertions, 20 deletions
diff --git a/compilerplugins/clang/bodynotinblock.cxx b/compilerplugins/clang/bodynotinblock.cxx index 76ab565c12d1..56edfbd7f1c9 100644 --- a/compilerplugins/clang/bodynotinblock.cxx +++ b/compilerplugins/clang/bodynotinblock.cxx @@ -122,10 +122,10 @@ void BodyNotInBlock::checkBody( const Stmt* body, SourceLocation stmtLocation, c if( bodyColumn == nextStatementColumn ) { report( DiagnosticsEngine::Warning, - "statement aligned as second statement in %select{if|while|for}0 body but not in a statement block [loplugin]", + "statement aligned as second statement in %select{if|while|for}0 body but not in a statement block", (*it)->getLocStart()) << stmtType; report( DiagnosticsEngine::Note, - "%select{if|while|for}0 body statement is here [loplugin]", + "%select{if|while|for}0 body statement is here", body->getLocStart()) << stmtType; } return; diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 799fbabdbf22..0c9769ef9b69 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -42,10 +42,11 @@ DiagnosticBuilder Plugin::report( DiagnosticsEngine::Level level, StringRef mess if( level == DiagnosticsEngine::Error && diag.getErrorsAsFatal()) level = DiagnosticsEngine::Fatal; #endif + string fullMessage = ( message + " [loplugin]" ).str(); if( loc.isValid()) - return diag.Report( loc, diag.getCustomDiagID( level, message )); + return diag.Report( loc, diag.getCustomDiagID( level, fullMessage )); else - return diag.Report( diag.getCustomDiagID( level, message )); + return diag.Report( diag.getCustomDiagID( level, fullMessage )); } bool Plugin::ignoreLocation( SourceLocation loc ) @@ -174,7 +175,7 @@ bool RewritePlugin::replaceText( SourceRange range, SourceRange replacementRange bool RewritePlugin::reportEditFailure( SourceLocation loc ) { - report( DiagnosticsEngine::Warning, "cannot perform source modification (macro expansion involved?) [loplugin]", loc ); + report( DiagnosticsEngine::Warning, "cannot perform source modification (macro expansion involved?)", loc ); return false; } diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 1c36ede707f8..3282ef00c77f 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -61,7 +61,7 @@ PluginHandler::PluginHandler( ASTContext& context, const vector< string >& args } pluginObjectsCreated = true; if( !args.empty() && !wasCreated ) - report( DiagnosticsEngine::Fatal, "unknown plugin tool %0 [loplugin]" ) << args.front(); + report( DiagnosticsEngine::Fatal, "unknown plugin tool %0" ) << args.front(); } PluginHandler::~PluginHandler() @@ -126,17 +126,17 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) } } if( modifyFile.empty()) - report( DiagnosticsEngine::Warning, "modified source in solver/ : %0 [loplugin]" ) << e->getName(); + report( DiagnosticsEngine::Warning, "modified source in solver/ : %0" ) << e->getName(); } else if( strncmp( e->getName(), WORKDIR, strlen( WORKDIR )) == 0 ) - report( DiagnosticsEngine::Warning, "modified source in workdir/ : %0 [loplugin]" ) << e->getName(); + report( DiagnosticsEngine::Warning, "modified source in workdir/ : %0" ) << e->getName(); else if( strcmp( SRCDIR, BUILDDIR ) != 0 && strncmp( e->getName(), BUILDDIR, strlen( BUILDDIR )) == 0 ) - report( DiagnosticsEngine::Warning, "modified source in build dir : %0 [loplugin]" ) << e->getName(); + report( DiagnosticsEngine::Warning, "modified source in build dir : %0" ) << e->getName(); else if( strncmp( e->getName(), SRCDIR, strlen( SRCDIR )) == 0 ) ; // ok else { - report( DiagnosticsEngine::Warning, "modified source in unknown location, not modifying : %0 [loplugin]" ) + report( DiagnosticsEngine::Warning, "modified source in unknown location, not modifying : %0" ) << e->getName(); continue; // ---> } @@ -157,7 +157,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) ostream.clear_error(); unlink( filename ); if( !ok ) - report( DiagnosticsEngine::Error, "cannot write modified source to %0 (%1) [loplugin]" ) << modifyFile << error; + report( DiagnosticsEngine::Error, "cannot write modified source to %0 (%1)" ) << modifyFile << error; delete[] filename; } } diff --git a/compilerplugins/clang/postfixincrementfix.cxx b/compilerplugins/clang/postfixincrementfix.cxx index e1f6849ec993..6d8da1ffc771 100644 --- a/compilerplugins/clang/postfixincrementfix.cxx +++ b/compilerplugins/clang/postfixincrementfix.cxx @@ -119,7 +119,7 @@ bool PostfixIncrementFix::canChangePostfixToPrefix( const CXXOperatorCallExpr* o return canChangeInConditionStatement( op, dyn_cast< ForStmt >( parents[ parent_pos ] )->getCond(), parents, parent_pos ); default: - report( DiagnosticsEngine::Fatal, "cannot analyze operator++ (plugin needs fixing) [loplugin]", + report( DiagnosticsEngine::Fatal, "cannot analyze operator++ (plugin needs fixing)", op->getLocStart()) << parents[ parent_pos ]->getSourceRange(); // parents[ parent_pos ]->dump(); // parents[ std::max( parent_pos - 3, 0 ) ]->dump(); @@ -155,7 +155,7 @@ bool PostfixIncrementFix::shouldDoChange( const Expr* operand ) return true; default: { - report( DiagnosticsEngine::Fatal, "cannot analyze operator++ (plugin needs fixing) [loplugin]", + report( DiagnosticsEngine::Fatal, "cannot analyze operator++ (plugin needs fixing)", expr->getLocStart()) << operand->getSourceRange(); expr->dump(); operand->dump(); diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx index 051c1d7ae9f7..db4453c98ab5 100644 --- a/compilerplugins/clang/sallogareas.cxx +++ b/compilerplugins/clang/sallogareas.cxx @@ -70,7 +70,7 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call ) if( area->getKind() == StringLiteral::Ascii ) checkArea( area->getBytes(), area->getExprLoc()); else - report( DiagnosticsEngine::Warning, "unsupported string literal kind (plugin needs fixing?) [loplugin]", + report( DiagnosticsEngine::Warning, "unsupported string literal kind (plugin needs fixing?)", area->getLocStart()); return true; } @@ -87,11 +87,11 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call ) if( inMacro == "SAL_DEBUG" ) return true; // ok } - report( DiagnosticsEngine::Warning, "missing log area [loplugin]", + report( DiagnosticsEngine::Warning, "missing log area", call->getArg( 1 )->IgnoreParenImpCasts()->getLocStart()); return true; } - report( DiagnosticsEngine::Warning, "cannot analyse log area argument (plugin needs fixing?) [loplugin]", + report( DiagnosticsEngine::Warning, "cannot analyse log area argument (plugin needs fixing?)", call->getLocStart()); } } @@ -105,7 +105,7 @@ void SalLogAreas::checkArea( StringRef area, SourceLocation location ) readLogAreas(); if( !logAreas.count( area )) { - report( DiagnosticsEngine::Warning, "unknown log area '%0' (check or extend sal/inc/sal/log-areas.dox) [loplugin]", + report( DiagnosticsEngine::Warning, "unknown log area '%0' (check or extend sal/inc/sal/log-areas.dox)", location ) << area; } } @@ -130,7 +130,7 @@ void SalLogAreas::readLogAreas() } // If you get this error message, you possibly have too old icecream (ICECC_EXTRAFILES is needed). if( logAreas.empty()) - report( DiagnosticsEngine::Warning, "error reading log areas [loplugin]" ); + report( DiagnosticsEngine::Warning, "error reading log areas" ); } static Plugin::Registration< SalLogAreas > X( "sallogareas" ); diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx index 93ad85163607..d13c7266fe60 100644 --- a/compilerplugins/clang/unusedvariablecheck.cxx +++ b/compilerplugins/clang/unusedvariablecheck.cxx @@ -89,11 +89,11 @@ bool UnusedVariableCheck::VisitVarDecl( VarDecl* var ) if( const FunctionDecl* func = dyn_cast_or_null< FunctionDecl >( param->getParentFunctionOrMethod())) if( !func->doesThisDeclarationHaveABody()) return true; - report( DiagnosticsEngine::Warning, "unused parameter %0 [loplugin]", + report( DiagnosticsEngine::Warning, "unused parameter %0", var->getLocation()) << var->getDeclName(); } else - report( DiagnosticsEngine::Warning, "unused variable %0 [loplugin]", + report( DiagnosticsEngine::Warning, "unused variable %0", var->getLocation()) << var->getDeclName(); } } |