Cppcheck
|
Interface class that cppcheck uses to communicate with the checks. More...
#include <check.h>
Classes | |
class | FileInfo |
Base class used for whole-program analysis. More... | |
Public Member Functions | |
Check (const std::string &aname) | |
This constructor is used when registering the CheckClass. More... | |
virtual | ~Check () |
Check (const Check &)=delete | |
Check & | operator= (const Check &)=delete |
virtual void | runChecks (const Tokenizer &, ErrorLogger *)=0 |
run checks, the token list is not simplified More... | |
virtual void | getErrorMessages (ErrorLogger *errorLogger, const Settings *settings) const =0 |
get error messages More... | |
const std::string & | name () const |
class name, used to generate documentation More... | |
virtual std::string | classInfo () const =0 |
get information about this class, used to generate documentation More... | |
virtual FileInfo * | getFileInfo (const Tokenizer &, const Settings &) const |
virtual FileInfo * | loadFileInfoFromXml (const tinyxml2::XMLElement *xmlElement) const |
virtual bool | analyseWholeProgram (const CTU::FileInfo *ctu, const std::list< FileInfo * > &fileInfo, const Settings &, ErrorLogger &) |
Static Public Member Functions | |
static std::list< Check * > & | instances () |
List of registered check classes. More... | |
static void | writeToErrorList (const ErrorMessage &errmsg) |
Write given error to stdout in xml format. More... | |
Protected Member Functions | |
Check (std::string aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) | |
This constructor is used when running checks. More... | |
void | reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg) |
report an error More... | |
void | reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty) |
report an error More... | |
void | reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg) |
report an error More... | |
void | reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty) |
report an error More... | |
void | reportError (const ErrorPath &errorPath, Severity severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty) |
void | logChecker (const char id[]) |
log checker More... | |
ErrorPath | getErrorPath (const Token *errtok, const ValueFlow::Value *value, std::string bug) const |
bool | wrongData (const Token *tok, const char *str) |
Use WRONG_DATA in checkers when you check for wrong data. More... | |
Static Protected Member Functions | |
static std::string | getMessageId (const ValueFlow::Value &value, const char id[]) |
Protected Attributes | |
const Tokenizer *const | mTokenizer {} |
const Settings *const | mSettings {} |
ErrorLogger *const | mErrorLogger {} |
Private Attributes | |
const std::string | mName |
Interface class that cppcheck uses to communicate with the checks.
All checking classes must inherit from this class
|
explicit |
This constructor is used when registering the CheckClass.
Definition at line 37 of file check.cpp.
References instances(), and name().
|
inlineprotected |
|
delete |
|
inlinevirtual |
Reimplemented in CheckUninitVar, CheckNullPointer, CheckClass, and CheckBufferOverrun.
|
pure virtual |
get information about this class, used to generate documentation
Implemented in CheckVaarg, CheckUnusedVar, CheckUninitVar, CheckType, CheckString, CheckStl, CheckSizeof, CheckPostfixOperator, CheckOther, CheckNullPointer, CheckMemoryLeakNoVar, CheckMemoryLeakStructMember, CheckMemoryLeakInClass, CheckMemoryLeakInFunction, CheckLeakAutoVar, CheckIO, CheckInternal, CheckFunctions, CheckExceptionSafety, CheckCondition, CheckClass, CheckBufferOverrun, CheckBoost, CheckBool, CheckAutoVariables, CheckAssert, and Check64BitPortability.
|
pure virtual |
get error messages
Implemented in CheckVaarg, CheckUnusedVar, CheckUninitVar, CheckType, CheckString, CheckStl, CheckSizeof, CheckPostfixOperator, CheckOther, CheckNullPointer, CheckLeakAutoVar, CheckIO, CheckInternal, CheckFunctions, CheckExceptionSafety, CheckCondition, CheckClass, CheckBufferOverrun, CheckBoost, CheckBool, CheckAutoVariables, CheckAssert, Check64BitPortability, CheckMemoryLeakNoVar, CheckMemoryLeakInClass, CheckMemoryLeakInFunction, and CheckMemoryLeakStructMember.
|
protected |
Definition at line 111 of file check.cpp.
References ValueFlow::Value::condition, ValueFlow::Value::errorPath, Token::expressionString(), mSettings, Settings::templateLocation, Settings::verbose, and Settings::xml.
Referenced by CheckOther::accessMovedError(), CheckCondition::alwaysTrueFalseError(), CheckBufferOverrun::arrayIndexError(), CheckBufferOverrun::bufferOverflowError(), CheckStl::dereferenceInvalidIteratorError(), CheckAutoVariables::errorInvalidDeallocation(), CheckType::floatToIntegerOverflowError(), CheckType::integerOverflowError(), CheckFunctions::invalidFunctionArgError(), CheckOther::knownArgumentError(), CheckOther::knownPointerToBoolError(), CheckBufferOverrun::negativeIndexError(), CheckStl::negativeIndexError(), CheckBufferOverrun::negativeMemoryAllocationSizeError(), CheckNullPointer::nullPointerError(), CheckStl::outOfBoundsError(), CheckBufferOverrun::pointerArithmeticError(), CheckNullPointer::pointerArithmeticError(), CheckOther::pointerLessThanZeroError(), CheckOther::pointerPositiveError(), CheckNullPointer::redundantConditionWarning(), CheckType::signConversionError(), CheckType::tooBigBitwiseShiftError(), CheckType::tooBigSignedBitwiseShiftError(), CheckOther::unsignedLessThanZeroError(), CheckOther::unsignedPositiveError(), and CheckOther::zerodivError().
Reimplemented in CheckUninitVar, CheckNullPointer, CheckClass, and CheckBufferOverrun.
|
staticprotected |
Definition at line 102 of file check.cpp.
References ValueFlow::Value::condition, and ValueFlow::Value::safe.
Referenced by CheckType::integerOverflowError(), and CheckType::signConversionError().
|
static |
List of registered check classes.
This is used by Cppcheck to run checks and generate documentation
Definition at line 89 of file check.cpp.
Referenced by CppCheck::analyseWholeProgram(), Check(), CppCheck::checkNormalTokens(), CppCheck::getErrorMessages(), and CmdLineParser::parseFromArgs().
|
inlinevirtual |
Reimplemented in CheckUninitVar, CheckNullPointer, CheckClass, and CheckBufferOverrun.
|
protected |
log checker
Definition at line 129 of file check.cpp.
References internal, and reportError().
Referenced by CheckCondition::alwaysTrueFalse(), CheckBufferOverrun::analyseWholeProgram(), CheckClass::analyseWholeProgram(), CheckNullPointer::analyseWholeProgram(), CheckBufferOverrun::argumentSize(), CheckNullPointer::arithmetic(), CheckBufferOverrun::arrayIndex(), CheckBufferOverrun::arrayIndexThenCheck(), CheckAssert::assertWithSideEffects(), CheckAutoVariables::assignFunctionArg(), CheckCondition::assignIf(), CheckAutoVariables::autoVariables(), CheckBufferOverrun::bufferOverflow(), CheckLeakAutoVar::check(), CheckMemoryLeakInClass::check(), CheckMemoryLeakStructMember::check(), CheckMemoryLeakNoVar::check(), CheckUninitVar::check(), CheckOther::checkAccessOfMovedVariable(), CheckString::checkAlwaysTrueOrFalseStringCompare(), CheckBool::checkAssignBoolToFloat(), CheckBool::checkAssignBoolToPointer(), CheckCondition::checkAssignmentInCondition(), CheckCondition::checkBadBitmaskCheck(), CheckBool::checkBitwiseOnBoolean(), CheckBoost::checkBoostForeachModification(), CheckOther::checkCastIntToCharAndBack(), CheckExceptionSafety::checkCatchExceptionByValue(), CheckOther::checkCharVariable(), CheckOther::checkComparePointers(), CheckCondition::checkCompareValueOutOfTypeRange(), CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(), CheckBool::checkComparisonOfBoolExpressionWithInt(), CheckBool::checkComparisonOfBoolWithBool(), CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfFuncReturningBool(), CheckClass::checkConst(), CheckOther::checkConstPointer(), CheckOther::checkConstVariable(), CheckIO::checkCoutCerrMisusage(), CheckStl::checkDereferenceInvalidIterator(), CheckStl::checkDereferenceInvalidIterator2(), CheckOther::checkDuplicateBranch(), CheckCondition::checkDuplicateConditionalAssign(), CheckOther::checkDuplicateExpression(), CheckClass::checkDuplInheritedMembers(), CheckOther::checkEvaluationOrder(), CheckClass::checkExplicitConstructors(), CheckIO::checkFileUsage(), CheckStl::checkFindInsert(), CheckType::checkFloatToIntegerOverflow(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckOther::checkFuncArgNamesDifferent(), CheckUnusedVar::checkFunctionVariableUsage(), CheckFunctions::checkIgnoredReturnValue(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckCondition::checkIncorrectLogicOperator(), CheckString::checkIncorrectStringCompare(), CheckBool::checkIncrementBoolean(), CheckType::checkIntegerOverflow(), CheckOther::checkInterlockedDecrement(), CheckOther::checkInvalidFree(), CheckCondition::checkInvalidTestForOverflow(), CheckOther::checkKnownArgument(), CheckOther::checkKnownPointerToBool(), CheckType::checkLongCast(), CheckFunctions::checkMathFunctions(), CheckClass::checkMemset(), CheckFunctions::checkMissingReturn(), CheckOther::checkMisusedScopedObject(), CheckCondition::checkModuloAlwaysTrueFalse(), CheckOther::checkModuloOfOne(), CheckStl::checkMutexes(), CheckOther::checkNanInArithmeticExpression(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkOverlappingWrite(), CheckClass::checkOverride(), CheckOther::checkPassByReference(), CheckCondition::checkPointerAdditionResultNotNull(), CheckFunctions::checkProhibitedFunctions(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckOther::checkRedundantPointerOp(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnByReference(), CheckClass::checkSelfInitialization(), CheckOther::checkShadowVariables(), CheckType::checkSignConversion(), CheckOther::checkSignOfUnsignedVariable(), CheckSizeof::checkSizeofForArrayParameter(), CheckSizeof::checkSizeofForNumericParameter(), CheckSizeof::checkSizeofForPointerSize(), CheckUnusedVar::checkStructMemberUsage(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousSemicolon(), CheckString::checkSuspiciousStringCompare(), CheckClass::checkThisUseAfterFree(), CheckType::checkTooBigBitwiseShift(), CheckOther::checkUnreachableCode(), CheckClass::checkUnsafeClassRefMember(), CheckOther::checkUnusedLabel(), CheckClass::checkUselessOverride(), CheckOther::checkVarFuncNullUB(), CheckOther::checkVariableScope(), CheckAutoVariables::checkVarLifetime(), CheckClass::checkVirtualFunctionCallInConstructor(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::checkZeroDivision(), CheckOther::clarifyCalculation(), CheckCondition::clarifyCondition(), CheckOther::clarifyStatement(), CheckCondition::comparison(), CheckClass::constructors(), CheckClass::copyconstructors(), CheckExceptionSafety::deallocThrow(), CheckExceptionSafety::destructors(), CheckCondition::duplicateCondition(), CheckStl::erase(), CheckStl::eraseIteratorOutOfBounds(), CheckStl::if_find(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckStl::invalidContainer(), CheckFunctions::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckStl::iterators(), CheckStl::knownEmptyContainer(), CheckFunctions::memsetInvalid2ndParam(), CheckFunctions::memsetZeroBytes(), CheckStl::mismatchingContainerIterator(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckCondition::multiCondition(), CheckCondition::multiCondition2(), CheckBufferOverrun::negativeArraySize(), CheckStl::negativeIndex(), CheckExceptionSafety::nothrowThrows(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointer(), CheckBufferOverrun::objectIndex(), CheckClass::operatorEqRetRefThis(), CheckClass::operatorEqToSelf(), CheckStl::outOfBounds(), CheckStl::outOfBoundsIndexExpression(), CheckString::overlappingStrcmp(), CheckBool::pointerArithBool(), CheckBufferOverrun::pointerArithmetic(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), CheckClass::privateFunctions(), CheckOther::redundantBitwiseOperationInSwitchError(), CheckStl::redundantCondition(), CheckExceptionSafety::rethrowNoCurrentException(), CheckFunctions::returnLocalStdMove(), CheckBool::returnValueOfFunctionReturningBool(), CheckStl::size(), CheckSizeof::sizeofCalculation(), CheckSizeof::sizeofFunction(), CheckSizeof::sizeofsizeof(), CheckSizeof::sizeofVoid(), CheckString::sprintfOverlappingData(), CheckStl::stlBoundaries(), CheckStl::stlOutOfBounds(), CheckStl::string_c_str(), CheckString::stringLiteralWrite(), CheckBufferOverrun::stringNotZeroTerminated(), CheckString::strPlusChar(), CheckSizeof::suspiciousSizeofCalculation(), CheckClass::thisSubtraction(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckStl::uselessCalls(), CheckFunctions::useStandardLibrary(), CheckStl::useStlAlgorithm(), CheckVaarg::va_list_usage(), CheckVaarg::va_start_argument(), CheckUninitVar::valueFlowUninit(), CheckClass::virtualDestructor(), and CheckOther::warningOldStylePointerCast().
|
inline |
class name, used to generate documentation
Definition at line 88 of file check.h.
Referenced by Check(), CheckClass::getFileInfo(), CheckStl::invalidContainerReferenceError(), CheckClass::loadFileInfoFromXml(), and CheckBufferOverrun::objectIndexError().
|
protected |
Definition at line 73 of file check.cpp.
References Tokenizer::list, mErrorLogger, mTokenizer, ErrorLogger::reportErr(), and writeToErrorList().
|
protected |
report an error
Definition at line 64 of file check.cpp.
References Tokenizer::list, mErrorLogger, mTokenizer, ErrorLogger::reportErr(), and writeToErrorList().
|
inlineprotected |
report an error
Definition at line 138 of file check.h.
Referenced by CheckOther::accessMovedError(), CheckUnusedVar::allocatedButUnusedVariableError(), CheckCondition::alwaysTrueFalseError(), CheckString::alwaysTrueFalseStringCompareError(), CheckString::alwaysTrueStringVariableCompareError(), CheckBufferOverrun::argumentSizeError(), CheckSizeof::arithOperationsOnVoidPointerError(), CheckBufferOverrun::arrayIndexError(), CheckBufferOverrun::arrayIndexThenCheckError(), CheckBool::assignBoolToFloatError(), CheckBool::assignBoolToPointerError(), CheckCondition::assignIfError(), Check64BitPortability::assignmentAddressToIntegerError(), CheckAssert::assignmentInAssertError(), CheckCondition::assignmentInCondition(), Check64BitPortability::assignmentIntegerToAddressError(), CheckCondition::badBitmaskCheckError(), CheckBool::bitwiseOnBooleanError(), CheckBoost::boostForeachError(), CheckBufferOverrun::bufferOverflowError(), CheckExceptionSafety::catchExceptionByValueError(), CheckOther::charBitOpError(), CheckOther::checkCastIntToCharAndBackError(), CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError(), CheckClass::checkConstError2(), CheckStl::checkFindInsertError(), CheckUnusedVar::checkFunctionVariableUsage(), CheckFunctions::checkLibraryMatchFunctions(), CheckOther::checkModuloOfOneError(), CheckFunctions::checkProhibitedFunctions(), CheckUninitVar::checkScopeForVariable(), CheckOther::clarifyCalculationError(), CheckCondition::clarifyConditionError(), CheckOther::clarifyStatementError(), CheckOther::commaSeparatedReturnError(), CheckOther::comparePointersError(), CheckCondition::compareValueOutOfTypeRangeError(), CheckCondition::comparisonError(), CheckBool::comparisonOfBoolExpressionWithIntError(), CheckBool::comparisonOfBoolWithBoolError(), CheckBool::comparisonOfBoolWithInvalidComparator(), CheckBool::comparisonOfFuncReturningBoolError(), CheckBool::comparisonOfTwoFuncsReturningBoolError(), CheckLeakAutoVar::configurationInfo(), CheckOther::constStatementError(), CheckOther::constVariableError(), CheckClass::copyConstructorShallowCopyError(), CheckClass::copyCtorAndEqOperatorError(), CheckFunctions::copyElisionError(), CheckIO::coutCerrMisusageError(), CheckOther::cstyleCastError(), CheckLeakAutoVar::deallocReturnError(), CheckExceptionSafety::deallocThrowError(), CheckStl::dereferenceErasedError(), CheckStl::dereferenceInvalidIteratorError(), CheckExceptionSafety::destructorsError(), CheckSizeof::divideBySizeofError(), CheckSizeof::divideSizeofError(), CheckLeakAutoVar::doubleFreeError(), CheckOther::duplicateAssignExpressionError(), CheckOther::duplicateBranchError(), CheckOther::duplicateBreakError(), CheckCondition::duplicateConditionalAssignError(), CheckCondition::duplicateConditionError(), CheckOther::duplicateExpressionError(), CheckOther::duplicateExpressionTernaryError(), CheckOther::duplicateValueTernaryError(), CheckClass::duplInheritedMembersError(), CheckStl::eraseIteratorOutOfBoundsError(), CheckAutoVariables::errorAutoVariableAssignment(), CheckAutoVariables::errorDanglingReference(), CheckAutoVariables::errorDanglingTemporaryLifetime(), CheckAutoVariables::errorDanglingTempReference(), CheckAutoVariables::errorDanglngLifetime(), CheckAutoVariables::errorInvalidDeallocation(), CheckAutoVariables::errorInvalidLifetime(), CheckAutoVariables::errorReturnDanglingLifetime(), CheckAutoVariables::errorReturnReference(), CheckAutoVariables::errorReturnTempReference(), CheckAutoVariables::errorUselessAssignmentArg(), CheckAutoVariables::errorUselessAssignmentPtrArg(), CheckIO::fflushOnInputStreamError(), CheckType::floatToIntegerOverflowError(), CheckOther::funcArgNamesDifferent(), CheckOther::funcArgOrderDifferent(), CheckMemoryLeakNoVar::functionCallLeak(), CheckFunctions::getErrorMessages(), CheckStl::globalLockGuardError(), CheckCondition::identicalConditionAfterEarlyExitError(), CheckCondition::identicalInnerConditionError(), CheckStl::if_findError(), CheckFunctions::ignoredReturnErrorCode(), CheckFunctions::ignoredReturnValueError(), CheckIO::incompatibleFileOpenError(), CheckOther::incompleteArrayFillError(), CheckCondition::incorrectLogicOperatorError(), CheckString::incorrectStringBooleanError(), CheckString::incorrectStringCompareError(), CheckBool::incrementBooleanError(), CheckClass::initializerListError(), CheckType::integerOverflowError(), CheckStl::invalidContainerError(), CheckStl::invalidContainerLoopError(), CheckStl::invalidContainerReferenceError(), CheckOther::invalidFreeError(), CheckFunctions::invalidFunctionArgBoolError(), CheckFunctions::invalidFunctionArgError(), CheckFunctions::invalidFunctionArgStrError(), CheckStl::invalidIteratorError(), CheckIO::invalidLengthModifierError(), CheckOther::invalidPointerCastError(), CheckIO::invalidPrintfArgTypeError_float(), CheckIO::invalidPrintfArgTypeError_n(), CheckIO::invalidPrintfArgTypeError_p(), CheckIO::invalidPrintfArgTypeError_s(), CheckIO::invalidPrintfArgTypeError_sint(), CheckIO::invalidPrintfArgTypeError_uint(), CheckIO::invalidScanfArgTypeError_float(), CheckIO::invalidScanfArgTypeError_int(), CheckIO::invalidScanfArgTypeError_s(), CheckIO::invalidScanfError(), CheckIO::invalidScanfFormatWidthError(), CheckCondition::invalidTestForOverflow(), CheckIO::ioWithoutPositioningError(), CheckStl::iteratorsError(), CheckOther::knownArgumentError(), CheckStl::knownEmptyContainerError(), CheckOther::knownPointerToBoolError(), CheckStl::localMutexError(), logChecker(), CheckType::longCastAssignError(), CheckType::longCastReturnError(), CheckClass::mallocOnClassError(), CheckClass::mallocOnClassWarning(), CheckFunctions::mathfunctionCallWarning(), CheckClass::memsetError(), CheckClass::memsetErrorFloat(), CheckClass::memsetErrorReference(), CheckFunctions::memsetFloatError(), CheckFunctions::memsetValueOutOfRangeError(), CheckFunctions::memsetZeroBytesError(), CheckCondition::mismatchingBitAndError(), CheckStl::mismatchingContainerExpressionError(), CheckStl::mismatchingContainerIteratorError(), CheckStl::mismatchingContainersError(), CheckStl::missingComparisonError(), CheckClass::missingMemberCopyError(), CheckFunctions::missingReturnError(), CheckOther::misusedScopeObjectError(), CheckCondition::moduloAlwaysTrueFalseError(), CheckSizeof::multiplySizeofError(), CheckOther::nanInArithmeticExpressionError(), CheckBufferOverrun::negativeArraySizeError(), CheckOther::negativeBitwiseShiftError(), CheckBufferOverrun::negativeIndexError(), CheckStl::negativeIndexError(), CheckBufferOverrun::negativeMemoryAllocationSizeError(), CheckClass::noConstructorError(), CheckClass::noCopyConstructorError(), CheckClass::noDestructorError(), CheckExceptionSafety::noexceptThrowError(), CheckClass::noExplicitConstructorError(), CheckClass::noOperatorEqError(), CheckNullPointer::nullPointerError(), CheckBufferOverrun::objectIndexError(), CheckClass::operatorEqMissingReturnStatementError(), CheckClass::operatorEqRetRefThisError(), CheckClass::operatorEqShouldBeLeftUnimplementedError(), CheckClass::operatorEqToSelfError(), CheckClass::operatorEqVarError(), CheckCondition::oppositeElseIfConditionError(), CheckOther::oppositeExpressionError(), CheckCondition::oppositeInnerConditionError(), CheckStl::outOfBoundsError(), CheckStl::outOfBoundsIndexExpressionError(), CheckCondition::overlappingElseIfConditionError(), CheckString::overlappingStrcmpError(), CheckOther::overlappingWriteFunction(), CheckOther::overlappingWriteUnion(), CheckClass::overrideError(), CheckOther::passedByValueError(), CheckCondition::pointerAdditionResultNotNullError(), CheckBool::pointerArithBoolError(), CheckBufferOverrun::pointerArithmeticError(), CheckNullPointer::pointerArithmeticError(), CheckOther::pointerLessThanZeroError(), CheckOther::pointerPositiveError(), CheckPostfixOperator::postfixOperatorError(), CheckMemoryLeakInClass::publicAllocationError(), CheckClass::pureVirtualFunctionCallInConstructorError(), CheckOther::raceAfterInterlockedDecrementError(), CheckIO::readWriteOnlyFileError(), CheckOther::redundantAssignmentError(), CheckOther::redundantAssignmentInSwitchError(), CheckOther::redundantBitwiseOperationInSwitchError(), CheckCondition::redundantConditionError(), CheckNullPointer::redundantConditionWarning(), CheckOther::redundantContinueError(), CheckOther::redundantCopyError(), CheckStl::redundantIfRemoveError(), CheckOther::redundantInitializationError(), CheckOther::redundantPointerOpError(), CheckVaarg::referenceAs_va_start_error(), CheckExceptionSafety::rethrowCopyError(), CheckExceptionSafety::rethrowNoCurrentExceptionError(), CheckClass::returnByReferenceError(), Check64BitPortability::returnIntegerError(), Check64BitPortability::returnPointerError(), CheckBool::returnValueBoolError(), CheckMemoryLeakNoVar::returnValueNotUsedError(), CheckStl::sameIteratorExpressionError(), CheckIO::seekOnAppendedFileError(), CheckOther::selfAssignmentError(), CheckClass::selfInitializationError(), CheckOther::shadowError(), CheckAssert::sideEffectInAssertError(), CheckType::signConversionError(), CheckOther::signedCharArrayIndexError(), CheckStl::sizeError(), CheckSizeof::sizeofCalculationError(), CheckSizeof::sizeofDereferencedVoidPointerError(), CheckSizeof::sizeofForArrayParameterError(), CheckSizeof::sizeofForNumericParameterError(), CheckSizeof::sizeofForPointerError(), CheckSizeof::sizeofFunctionError(), CheckSizeof::sizeofsizeofError(), CheckSizeof::sizeofVoidError(), CheckString::sprintfOverlappingDataError(), CheckStl::stlBoundariesError(), CheckStl::stlOutOfBoundsError(), CheckStl::string_c_strAssignment(), CheckStl::string_c_strConcat(), CheckStl::string_c_strConstructor(), CheckStl::string_c_strError(), CheckStl::string_c_strParam(), CheckStl::string_c_strReturn(), CheckStl::string_c_strStream(), CheckStl::string_c_strThrowError(), CheckString::stringLiteralWriteError(), CheckString::strPlusCharError(), CheckClass::suggestInitializationList(), CheckOther::suspiciousCaseInSwitchError(), CheckOther::suspiciousSemicolonError(), CheckString::suspiciousStringCompareError(), CheckString::suspiciousStringCompareError_char(), CheckBufferOverrun::terminateStrncpyError(), CheckClass::thisSubtractionError(), CheckClass::thisUseAfterFree(), CheckType::tooBigBitwiseShiftError(), CheckType::tooBigSignedBitwiseShiftError(), CheckUnusedVar::unassignedVariableError(), CheckExceptionSafety::unhandledExceptionSpecificationError(), CheckUninitVar::uninitdataError(), CheckUninitVar::uninitStructMemberError(), CheckClass::uninitVarError(), CheckUninitVar::uninitvarError(), CheckOther::unknownEvaluationOrder(), CheckOther::unknownSignCharArrayIndexError(), CheckOther::unreachableCodeError(), CheckUnusedVar::unreadVariableError(), CheckMemoryLeakNoVar::unsafeArgAllocError(), CheckMemoryLeakInClass::unsafeClassError(), CheckClass::unsafeClassRefMemberError(), CheckOther::unsignedLessThanZeroError(), CheckOther::unsignedPositiveError(), CheckOther::unusedLabelError(), CheckClass::unusedPrivateFunctionError(), CheckUnusedVar::unusedStructMemberError(), CheckUnusedVar::unusedVariableError(), CheckIO::useClosedFileError(), CheckStl::uselessCallsConstructorError(), CheckStl::uselessCallsEmptyError(), CheckStl::uselessCallsRemoveError(), CheckStl::uselessCallsReturnValueError(), CheckStl::uselessCallsSubstrError(), CheckStl::uselessCallsSwapError(), CheckClass::uselessOverrideError(), CheckFunctions::useStandardLibraryError(), CheckStl::useStlAlgorithmError(), CheckVaarg::va_end_missingError(), CheckVaarg::va_list_usedBeforeStartedError(), CheckVaarg::va_start_subsequentCallsError(), CheckOther::varFuncNullUBError(), CheckOther::variableScopeError(), CheckClass::virtualDestructorError(), CheckClass::virtualFunctionCallInConstructorError(), CheckIO::writeReadOnlyFileError(), wrongData(), CheckVaarg::wrongParameterTo_va_start_error(), CheckIO::wrongPrintfScanfArgumentsError(), CheckIO::wrongPrintfScanfPosixParameterPositionError(), and CheckOther::zerodivError().
|
pure virtual |
run checks, the token list is not simplified
Implemented in CheckVaarg, CheckUnusedVar, CheckUninitVar, CheckType, CheckString, CheckStl, CheckSizeof, CheckPostfixOperator, CheckOther, CheckNullPointer, CheckMemoryLeakNoVar, CheckMemoryLeakStructMember, CheckMemoryLeakInClass, CheckMemoryLeakInFunction, CheckLeakAutoVar, CheckIO, CheckInternal, CheckFunctions, CheckExceptionSafety, CheckCondition, CheckClass, CheckBufferOverrun, CheckBoost, CheckBool, CheckAutoVariables, CheckAssert, and Check64BitPortability.
|
static |
Write given error to stdout in xml format.
This is for for printout out the error list with –errorlist
errmsg | Error message to write |
Definition at line 58 of file check.cpp.
References ErrorMessage::toXML().
Referenced by CheckMemoryLeak::reportErr(), and reportError().
|
protected |
Use WRONG_DATA in checkers when you check for wrong data.
That will call this method
Definition at line 82 of file check.cpp.
References Settings::daca, debug, mSettings, and reportError().
|
protected |
Definition at line 135 of file check.h.
Referenced by CheckLeakAutoVar::deallocUseError(), CheckLeakAutoVar::leakError(), CheckLeakAutoVar::mismatchError(), and reportError().
|
protected |
Definition at line 134 of file check.h.
Referenced by CheckUnusedVar::allocatedButUnusedVariableError(), CheckCondition::alwaysTrueFalse(), CheckBufferOverrun::argumentSize(), CheckNullPointer::arithmetic(), CheckBufferOverrun::arrayIndex(), CheckBufferOverrun::arrayIndexError(), CheckBufferOverrun::arrayIndexThenCheck(), CheckAssert::assertWithSideEffects(), CheckAutoVariables::assignFunctionArg(), CheckCondition::assignIf(), CheckCondition::assignIfParseScope(), CheckAutoVariables::autoVariables(), CheckBufferOverrun::bufferOverflow(), CheckLeakAutoVar::changeAllocStatusIfRealloc(), CheckLeakAutoVar::check(), CheckMemoryLeakStructMember::check(), CheckOther::checkAccessOfMovedVariable(), CheckString::checkAlwaysTrueOrFalseStringCompare(), CheckBool::checkAssignBoolToFloat(), CheckCondition::checkAssignmentInCondition(), CheckCondition::checkBadBitmaskCheck(), CheckBool::checkBitwiseOnBoolean(), CheckOther::checkCastIntToCharAndBack(), CheckExceptionSafety::checkCatchExceptionByValue(), CheckOther::checkCharVariable(), CheckOther::checkCommaSeparatedReturn(), CheckOther::checkComparePointers(), CheckCondition::checkCompareValueOutOfTypeRange(), CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(), CheckBool::checkComparisonOfBoolExpressionWithInt(), CheckBool::checkComparisonOfBoolWithBool(), CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfFuncReturningBool(), CheckClass::checkConst(), CheckClass::checkConstFunc(), CheckOther::checkConstPointer(), CheckOther::checkConstVariable(), CheckClass::checkCopyCtorAndEqOperator(), CheckStl::checkDereferenceInvalidIterator(), CheckStl::checkDereferenceInvalidIterator2(), CheckOther::checkDuplicateBranch(), CheckCondition::checkDuplicateConditionalAssign(), CheckOther::checkDuplicateExpression(), CheckClass::checkDuplInheritedMembers(), CheckOther::checkEvaluationOrder(), CheckClass::checkExplicitConstructors(), CheckIO::checkFileUsage(), CheckStl::checkFindInsert(), CheckStl::checkFindInsertError(), CheckType::checkFloatToIntegerOverflow(), CheckIO::checkFormatString(), CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckMemoryLeakNoVar::checkForUnusedReturnValue(), CheckOther::checkFuncArgNamesDifferent(), CheckUnusedVar::checkFunctionVariableUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckFunctions::checkIgnoredReturnValue(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckCondition::checkIncorrectLogicOperator(), CheckString::checkIncorrectStringCompare(), CheckBool::checkIncrementBoolean(), CheckOther::checkInnerScope(), CheckType::checkIntegerOverflow(), CheckOther::checkInterlockedDecrement(), CheckOther::checkInvalidFree(), CheckCondition::checkInvalidTestForOverflow(), CheckStl::checkIteratorPair(), CheckOther::checkKnownArgument(), CheckOther::checkKnownPointerToBool(), CheckFunctions::checkLibraryMatchFunctions(), CheckType::checkLongCast(), CheckFunctions::checkMathFunctions(), CheckClass::checkMemset(), CheckClass::checkMemsetType(), CheckFunctions::checkMissingReturn(), CheckOther::checkMisusedScopedObject(), CheckCondition::checkModuloAlwaysTrueFalse(), CheckOther::checkModuloOfOne(), CheckStl::checkMutexes(), CheckOther::checkNanInArithmeticExpression(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkOverlappingWrite(), CheckClass::checkOverride(), CheckOther::checkPassByReference(), CheckCondition::checkPointerAdditionResultNotNull(), CheckFunctions::checkProhibitedFunctions(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckOther::checkRedundantPointerOp(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnByReference(), CheckClass::checkReturnPtrThis(), CheckUninitVar::checkScope(), CheckLeakAutoVar::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkShadowVariables(), CheckType::checkSignConversion(), CheckOther::checkSignOfUnsignedVariable(), CheckSizeof::checkSizeofForArrayParameter(), CheckSizeof::checkSizeofForNumericParameter(), CheckSizeof::checkSizeofForPointerSize(), CheckUnusedVar::checkStructMemberUsage(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousSemicolon(), CheckString::checkSuspiciousStringCompare(), CheckClass::checkThisUseAfterFree(), CheckLeakAutoVar::checkTokenInsideExpression(), CheckType::checkTooBigBitwiseShift(), CheckOther::checkUnreachableCode(), CheckClass::checkUnsafeClassRefMember(), CheckOther::checkUnusedLabel(), CheckClass::checkUselessOverride(), CheckOther::checkVarFuncNullUB(), CheckOther::checkVariableScope(), CheckAutoVariables::checkVarLifetimeScope(), CheckClass::checkVirtualFunctionCallInConstructor(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::checkZeroDivision(), CheckOther::clarifyCalculation(), CheckCondition::clarifyCondition(), CheckOther::clarifyStatement(), CheckCondition::comparison(), CheckLeakAutoVar::configurationInfo(), CheckClass::constructors(), CheckOther::constStatementError(), CheckClass::copyconstructors(), CheckExceptionSafety::deallocThrow(), CheckLeakAutoVar::deallocUseError(), CheckStl::dereferenceInvalidIteratorError(), CheckExceptionSafety::destructors(), CheckCondition::duplicateCondition(), CheckLeakAutoVar::functionCall(), CheckBufferOverrun::getBufferSize(), getErrorPath(), CheckClass::getVirtualFunctionCalls(), CheckClass::hasAllocation(), CheckStl::if_find(), CheckStl::if_findError(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckClass::initializeVarList(), CheckStl::invalidContainer(), CheckFunctions::invalidFunctionUsage(), CheckIO::invalidLengthModifierError(), CheckOther::invalidPointerCast(), CheckIO::invalidPrintfArgTypeError_float(), CheckIO::invalidPrintfArgTypeError_n(), CheckIO::invalidPrintfArgTypeError_p(), CheckIO::invalidPrintfArgTypeError_s(), CheckIO::invalidPrintfArgTypeError_sint(), CheckIO::invalidPrintfArgTypeError_uint(), CheckIO::invalidScanf(), CheckIO::invalidScanfArgTypeError_float(), CheckIO::invalidScanfArgTypeError_int(), CheckIO::invalidScanfArgTypeError_s(), CheckIO::invalidScanfFormatWidthError(), CheckStl::isContainerSize(), CheckStl::isContainerSizeGE(), CheckUninitVar::isFunctionParUsage(), CheckUnusedVar::isFunctionWithoutSideEffects(), CheckMemoryLeakStructMember::isMalloc(), CheckUninitVar::isMemberVariableAssignment(), CheckCondition::isOverlappingCond(), CheckNullPointer::isPointerDeRef(), CheckUninitVar::isVariableUsage(), CheckStl::iterators(), CheckStl::knownEmptyContainer(), CheckLeakAutoVar::leakError(), CheckFunctions::memsetInvalid2ndParam(), CheckFunctions::memsetZeroBytes(), CheckLeakAutoVar::mismatchError(), CheckStl::mismatchingContainerIterator(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckCondition::multiCondition(), CheckCondition::multiCondition2(), CheckBufferOverrun::negativeArraySize(), CheckStl::negativeIndex(), CheckBufferOverrun::negativeIndexError(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckNullPointer::nullPointerError(), CheckBufferOverrun::objectIndex(), CheckClass::operatorEqRetRefThis(), CheckClass::operatorEqToSelf(), CheckStl::outOfBounds(), CheckString::overlappingStrcmp(), CheckBufferOverrun::pointerArithmetic(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), CheckClass::privateFunctions(), CheckOther::redundantBitwiseOperationInSwitchError(), CheckStl::redundantCondition(), CheckLeakAutoVar::ret(), CheckFunctions::returnLocalStdMove(), CheckBool::returnValueOfFunctionReturningBool(), CheckStl::size(), CheckSizeof::sizeofCalculation(), CheckSizeof::sizeofFunction(), CheckSizeof::sizeofsizeof(), CheckSizeof::sizeofVoid(), CheckString::sprintfOverlappingData(), CheckStl::stlBoundaries(), CheckStl::string_c_str(), CheckString::stringLiteralWrite(), CheckBufferOverrun::stringNotZeroTerminated(), CheckSizeof::suspiciousSizeofCalculation(), CheckClass::thisSubtraction(), CheckType::tooBigSignedBitwiseShiftError(), CheckUnusedVar::unassignedVariableError(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckUninitVar::uninitvarError(), CheckOther::unreachableCodeError(), CheckUnusedVar::unreadVariableError(), CheckMemoryLeakInClass::unsafeClassError(), CheckOther::unusedLabelError(), CheckUnusedVar::unusedVariableError(), CheckStl::uselessCalls(), CheckFunctions::useStandardLibrary(), CheckStl::useStlAlgorithm(), CheckVaarg::va_list_usage(), CheckVaarg::va_start_argument(), CheckUninitVar::valueFlowUninit(), CheckMemoryLeakInClass::variable(), CheckClass::virtualDestructor(), CheckClass::virtualDestructorError(), CheckClass::virtualFunctionCallInConstructorError(), CheckOther::warningOldStylePointerCast(), wrongData(), CheckIO::wrongPrintfScanfArgumentsError(), and CheckIO::wrongPrintfScanfPosixParameterPositionError().
|
protected |
Definition at line 133 of file check.h.
Referenced by CheckCondition::alwaysTrueFalse(), CheckBufferOverrun::argumentSize(), CheckNullPointer::arithmetic(), CheckBufferOverrun::arrayIndex(), CheckBufferOverrun::arrayIndexThenCheck(), CheckAssert::assertWithSideEffects(), CheckAutoVariables::assignFunctionArg(), CheckCondition::assignIf(), CheckAutoVariables::autoVariables(), CheckBufferOverrun::bufferOverflow(), CheckLeakAutoVar::check(), CheckMemoryLeakInClass::check(), CheckMemoryLeakStructMember::check(), CheckMemoryLeakNoVar::check(), CheckUninitVar::check(), CheckOther::checkAccessOfMovedVariable(), CheckString::checkAlwaysTrueOrFalseStringCompare(), CheckBool::checkAssignBoolToFloat(), CheckBool::checkAssignBoolToPointer(), CheckCondition::checkAssignmentInCondition(), CheckCondition::checkBadBitmaskCheck(), CheckBool::checkBitwiseOnBoolean(), CheckBoost::checkBoostForeachModification(), CheckOther::checkCastIntToCharAndBack(), CheckExceptionSafety::checkCatchExceptionByValue(), CheckOther::checkCharVariable(), CheckOther::checkCommaSeparatedReturn(), CheckOther::checkComparePointers(), CheckCondition::checkCompareValueOutOfTypeRange(), CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(), CheckBool::checkComparisonOfBoolExpressionWithInt(), CheckBool::checkComparisonOfBoolWithBool(), CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfFuncReturningBool(), CheckClass::checkConstFunc(), CheckOther::checkConstPointer(), CheckOther::checkConstVariable(), CheckIO::checkCoutCerrMisusage(), CheckStl::checkDereferenceInvalidIterator(), CheckStl::checkDereferenceInvalidIterator2(), CheckOther::checkDuplicateBranch(), CheckCondition::checkDuplicateConditionalAssign(), CheckOther::checkDuplicateExpression(), CheckOther::checkEvaluationOrder(), CheckIO::checkFileUsage(), CheckStl::checkFindInsert(), CheckType::checkFloatToIntegerOverflow(), CheckIO::checkFormatString(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckOther::checkFuncArgNamesDifferent(), CheckUnusedVar::checkFunctionVariableUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckFunctions::checkIgnoredReturnValue(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckCondition::checkIncorrectLogicOperator(), CheckString::checkIncorrectStringCompare(), CheckBool::checkIncrementBoolean(), CheckType::checkIntegerOverflow(), CheckOther::checkInterlockedDecrement(), CheckOther::checkInvalidFree(), CheckCondition::checkInvalidTestForOverflow(), CheckOther::checkKnownArgument(), CheckOther::checkKnownPointerToBool(), CheckFunctions::checkLibraryMatchFunctions(), CheckType::checkLongCast(), CheckFunctions::checkMathFunctions(), CheckFunctions::checkMissingReturn(), CheckOther::checkMisusedScopedObject(), CheckCondition::checkModuloAlwaysTrueFalse(), CheckOther::checkModuloOfOne(), CheckStl::checkMutexes(), CheckOther::checkNanInArithmeticExpression(), CheckOther::checkNegativeBitwiseShift(), CheckOther::checkOverlappingWrite(), CheckOther::checkPassByReference(), CheckCondition::checkPointerAdditionResultNotNull(), CheckFunctions::checkProhibitedFunctions(), CheckMemoryLeakInFunction::checkReallocUsage(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckOther::checkRedundantPointerOp(), CheckExceptionSafety::checkRethrowCopy(), CheckUninitVar::checkScope(), CheckLeakAutoVar::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckOther::checkShadowVariables(), CheckType::checkSignConversion(), CheckOther::checkSignOfUnsignedVariable(), CheckSizeof::checkSizeofForArrayParameter(), CheckSizeof::checkSizeofForNumericParameter(), CheckSizeof::checkSizeofForPointerSize(), CheckUninitVar::checkStruct(), CheckUnusedVar::checkStructMemberUsage(), CheckMemoryLeakStructMember::checkStructVariable(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousSemicolon(), CheckString::checkSuspiciousStringCompare(), CheckType::checkTooBigBitwiseShift(), CheckOther::checkUnreachableCode(), CheckOther::checkUnusedLabel(), CheckOther::checkVarFuncNullUB(), CheckOther::checkVariableScope(), CheckAutoVariables::checkVarLifetime(), CheckIO::checkWrongPrintfScanfArguments(), CheckOther::checkZeroDivision(), CheckOther::clarifyCalculation(), CheckCondition::clarifyCondition(), CheckOther::clarifyStatement(), CheckCondition::comparison(), CheckExceptionSafety::deallocThrow(), CheckLeakAutoVar::deallocUseError(), CheckExceptionSafety::destructors(), CheckCondition::duplicateCondition(), CheckStl::erase(), CheckStl::eraseIteratorOutOfBounds(), CheckStl::if_find(), CheckStl::invalidContainer(), CheckFunctions::invalidFunctionUsage(), CheckOther::invalidPointerCast(), CheckIO::invalidScanf(), CheckCondition::isAliased(), CheckStl::iterators(), CheckStl::knownEmptyContainer(), CheckLeakAutoVar::leakError(), CheckFunctions::memsetInvalid2ndParam(), CheckFunctions::memsetZeroBytes(), CheckLeakAutoVar::mismatchError(), CheckStl::mismatchingContainerIterator(), CheckStl::mismatchingContainers(), CheckStl::missingComparison(), CheckCondition::multiCondition(), CheckCondition::multiCondition2(), CheckBufferOverrun::negativeArraySize(), CheckStl::negativeIndex(), CheckExceptionSafety::nothrowThrows(), CheckNullPointer::nullConstantDereference(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckBufferOverrun::objectIndex(), CheckStl::outOfBounds(), CheckStl::outOfBoundsIndexExpression(), CheckString::overlappingStrcmp(), CheckBool::pointerArithBool(), CheckBufferOverrun::pointerArithmetic(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), CheckOther::redundantBitwiseOperationInSwitchError(), CheckStl::redundantCondition(), reportError(), CheckLeakAutoVar::ret(), CheckExceptionSafety::rethrowNoCurrentException(), CheckFunctions::returnLocalStdMove(), CheckBool::returnValueOfFunctionReturningBool(), CheckStl::size(), CheckSizeof::sizeofCalculation(), CheckSizeof::sizeofFunction(), CheckSizeof::sizeofsizeof(), CheckSizeof::sizeofVoid(), CheckString::sprintfOverlappingData(), CheckStl::stlBoundaries(), CheckStl::stlOutOfBounds(), CheckStl::string_c_str(), CheckString::stringLiteralWrite(), CheckBufferOverrun::stringNotZeroTerminated(), CheckString::strPlusChar(), CheckSizeof::suspiciousSizeofCalculation(), CheckClass::thisSubtraction(), CheckType::tooBigSignedBitwiseShiftError(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckStl::uselessCalls(), CheckFunctions::useStandardLibrary(), CheckStl::useStlAlgorithm(), CheckVaarg::va_list_usage(), CheckVaarg::va_start_argument(), CheckUninitVar::valueFlowUninit(), CheckClass::virtualDestructor(), and CheckOther::warningOldStylePointerCast().