@@ -2345,7 +2345,8 @@ void CheckStl::uselessCallsSubstrError(const Token *tok, SubstrErrorType type)
23452345
23462346void CheckStl::uselessCallsConstructorError (const Token *tok)
23472347{
2348- const std::string msg = " Inefficient constructor call: container '" + tok->str () + " ' is assigned a partial copy of itself. Use erase() or resize() instead." ;
2348+ const std::string container = tok ? tok->str () : " " ;
2349+ const std::string msg = " Inefficient constructor call: container '" + container + " ' is assigned a partial copy of itself. Use erase() or resize() instead." ;
23492350 reportError (tok, Severity::performance, " uselessCallsConstructor" , msg, CWE398, Certainty::normal);
23502351}
23512352
@@ -3451,6 +3452,7 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34513452 c.iteratorsError (nullptr , nullptr , " container" );
34523453 c.invalidContainerLoopError (nullptr , nullptr , ErrorPath{});
34533454 c.invalidContainerError (nullptr , nullptr , nullptr , ErrorPath{});
3455+ c.invalidContainerReferenceError (nullptr , nullptr , ErrorPath{});
34543456 c.mismatchingContainerIteratorError (nullptr , nullptr , nullptr );
34553457 c.mismatchingContainersError (nullptr , nullptr );
34563458 c.mismatchingContainerExpressionError (nullptr , nullptr );
@@ -3465,19 +3467,26 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34653467 c.string_c_strError (nullptr );
34663468 c.string_c_strReturn (nullptr );
34673469 c.string_c_strParam (nullptr , 0 );
3470+ c.string_c_strConstructor (nullptr );
3471+ c.string_c_strAssignment (nullptr );
3472+ c.string_c_strConcat (nullptr );
3473+ c.string_c_strStream (nullptr );
34683474 c.string_c_strThrowError (nullptr );
34693475 c.sizeError (nullptr );
34703476 c.missingComparisonError (nullptr , nullptr );
34713477 c.redundantIfRemoveError (nullptr );
34723478 c.uselessCallsReturnValueError (nullptr , " str" , " find" );
34733479 c.uselessCallsSwapError (nullptr , " str" );
34743480 c.uselessCallsSubstrError (nullptr , SubstrErrorType::COPY);
3481+ c.uselessCallsConstructorError (nullptr );
34753482 c.uselessCallsEmptyError (nullptr );
34763483 c.uselessCallsRemoveError (nullptr , " remove" );
34773484 c.dereferenceInvalidIteratorError (nullptr , " i" );
3485+ // TODO: derefInvalidIteratorRedundantCheck
34783486 c.eraseIteratorOutOfBoundsError (nullptr , nullptr );
34793487 c.useStlAlgorithmError (nullptr , " " );
34803488 c.knownEmptyContainerError (nullptr , " " );
34813489 c.globalLockGuardError (nullptr );
34823490 c.localMutexError (nullptr );
3491+ c.outOfBoundsIndexExpressionError (nullptr , nullptr );
34833492}
0 commit comments