@@ -2350,7 +2350,8 @@ void CheckStl::uselessCallsSubstrError(const Token *tok, SubstrErrorType type)
23502350
23512351void CheckStl::uselessCallsConstructorError (const Token *tok)
23522352{
2353- const std::string msg = " Inefficient constructor call: container '" + tok->str () + " ' is assigned a partial copy of itself. Use erase() or resize() instead." ;
2353+ const std::string container = tok ? tok->str () : " " ;
2354+ const std::string msg = " Inefficient constructor call: container '" + container + " ' is assigned a partial copy of itself. Use erase() or resize() instead." ;
23542355 reportError (tok, Severity::performance, " uselessCallsConstructor" , msg, CWE398, Certainty::normal);
23552356}
23562357
@@ -3456,6 +3457,7 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34563457 c.iteratorsError (nullptr , nullptr , " container" );
34573458 c.invalidContainerLoopError (nullptr , nullptr , ErrorPath{});
34583459 c.invalidContainerError (nullptr , nullptr , nullptr , ErrorPath{});
3460+ c.invalidContainerReferenceError (nullptr , nullptr , ErrorPath{});
34593461 c.mismatchingContainerIteratorError (nullptr , nullptr , nullptr );
34603462 c.mismatchingContainersError (nullptr , nullptr );
34613463 c.mismatchingContainerExpressionError (nullptr , nullptr );
@@ -3470,19 +3472,26 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34703472 c.string_c_strError (nullptr );
34713473 c.string_c_strReturn (nullptr );
34723474 c.string_c_strParam (nullptr , 0 );
3475+ c.string_c_strConstructor (nullptr );
3476+ c.string_c_strAssignment (nullptr );
3477+ c.string_c_strConcat (nullptr );
3478+ c.string_c_strStream (nullptr );
34733479 c.string_c_strThrowError (nullptr );
34743480 c.sizeError (nullptr );
34753481 c.missingComparisonError (nullptr , nullptr );
34763482 c.redundantIfRemoveError (nullptr );
34773483 c.uselessCallsReturnValueError (nullptr , " str" , " find" );
34783484 c.uselessCallsSwapError (nullptr , " str" );
34793485 c.uselessCallsSubstrError (nullptr , SubstrErrorType::COPY);
3486+ c.uselessCallsConstructorError (nullptr );
34803487 c.uselessCallsEmptyError (nullptr );
34813488 c.uselessCallsRemoveError (nullptr , " remove" );
34823489 c.dereferenceInvalidIteratorError (nullptr , " i" );
3490+ // TODO: derefInvalidIteratorRedundantCheck
34833491 c.eraseIteratorOutOfBoundsError (nullptr , nullptr );
34843492 c.useStlAlgorithmError (nullptr , " " );
34853493 c.knownEmptyContainerError (nullptr , " " );
34863494 c.globalLockGuardError (nullptr );
34873495 c.localMutexError (nullptr );
3496+ c.outOfBoundsIndexExpressionError (nullptr , nullptr );
34883497}
0 commit comments