Cppcheck
Classes | Typedefs | Enumerations | Functions
Core

Classes

class  AnalyzerInformation
 Analyzer information. More...
 
class  Check
 Interface class that cppcheck uses to communicate with the checks. More...
 
class  CheckMemoryLeak
 Base class for memory leaks checking. More...
 
class  CppCheck
 This is the base class which will use other classes to do static code analysis for C and C++ code to find possible errors or places that could be improved. More...
 
class  ErrorMessage
 Wrapper for error messages, provided by reportErr() More...
 
class  ErrorLogger
 This is an interface, which the class responsible of error logging should implement. More...
 
struct  InternalError
 Simple container to be thrown when internal error is detected. More...
 
class  TerminateException
 
struct  CWE
 
class  ImportProject
 Importing project settings. More...
 
class  Library
 Library definitions handling. More...
 
class  MathLib
 simple math functions that uses operands stored in std::string. More...
 
class  Path
 Path handling routines. More...
 
class  Platform
 Platform settings. More...
 
class  Preprocessor
 The cppcheck preprocessor. More...
 
class  SimpleEnableGroup< T >
 
class  Settings
 This is just a container for general settings so that we don't need to pass individual values to functions or constructors now or in the future when we might have even more detailed settings. More...
 
struct  Standards
 This is just a container for standards settings. More...
 
class  SuppressionList
 class for handling suppressions More...
 
struct  Suppressions
 
class  TemplateSimplifier
 Simplify templates from the preprocessed and partially simplified code. More...
 
class  Token
 The token list that the TokenList generates is a linked-list of this class. More...
 
class  Tokenizer
 The main purpose is to tokenize the source code. More...
 
struct  TokensFrontBack
 This struct stores pointers to the front and back tokens of the list this token is in. More...
 
class  TokenList
 

Typedefs

using ErrorPathItem = std::pair< const Token *, std::string >
 
using ErrorPath = std::list< ErrorPathItem >
 

Enumerations

enum class  Certainty { normal , inconclusive }
 
enum class  Checks { unusedFunction , missingInclude , internalCheck }
 
enum class  Severity {
  none , error , warning , style ,
  performance , portability , information , debug ,
  internal
}
 enum class for severity. More...
 

Functions

std::string replaceStr (std::string s, const std::string &from, const std::string &to)
 Replace substring. More...
 
CPPCHECKLIB void substituteTemplateFormatStatic (std::string &templateFormat)
 replaces the static parts of the location template More...
 
CPPCHECKLIB void substituteTemplateLocationStatic (std::string &templateLocation)
 replaces the static parts of the location template More...
 
CPPCHECKLIB std::string severityToString (Severity severity)
 
CPPCHECKLIB Severity severityFromString (const std::string &severity)
 
CPPCHECKLIB const Library::ContainergetLibraryContainer (const Token *tok)
 
std::shared_ptr< TokencreateTokenFromExpression (const std::string &returnValue, const Settings *settings, bool cpp, std::unordered_map< nonneg int, const Token * > *lookupVarId=nullptr)
 
MathLib::value operator+ (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator- (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator* (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator/ (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator% (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator& (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator| (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator^ (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator<< (const MathLib::value &v1, const MathLib::value &v2)
 
MathLib::value operator>> (const MathLib::value &v1, const MathLib::value &v2)
 
TokenfindTypeEnd (Token *tok)
 
TokenfindLambdaEndScope (Token *tok)
 
const TokenfindLambdaEndScope (const Token *tok)
 
template<>
CPPCHECKLIB std::string MathLib::toString (double value)
 

Detailed Description

Typedef Documentation

◆ ErrorPath

using ErrorPath = std::list<ErrorPathItem>

Definition at line 130 of file errortypes.h.

◆ ErrorPathItem

using ErrorPathItem = std::pair<const Token *, std::string>

Definition at line 129 of file errortypes.h.

Enumeration Type Documentation

◆ Certainty

enum Certainty
strong
Enumerator
normal 
inconclusive 

Definition at line 54 of file errortypes.h.

◆ Checks

enum Checks
strong
Enumerator
unusedFunction 
missingInclude 
internalCheck 

Definition at line 58 of file errortypes.h.

◆ Severity

enum Severity
strong

enum class for severity.

Used when reporting errors.

Enumerator
none 

No severity (default value).

error 

Programming error.

This indicates severe error like memory leak etc. The error is certain.

warning 

Warning.

Used for dangerous coding style that can cause severe runtime errors. For example: forgetting to initialize a member variable in a constructor.

style 

Style warning.

Used for general code cleanup recommendations. Fixing these will not fix any bugs but will make the code easier to maintain. For example: redundant code, unreachable code, etc.

performance 

Performance warning.

Not an error as is but suboptimal code and fixing it probably leads to faster performance of the compiled code.

portability 

Portability warning.

This warning indicates the code is not properly portable for different platforms and bitnesses (32/64 bit). If the code is meant to compile in different platforms and bitnesses these warnings should be fixed.

information 

Checking information.

Information message about the checking (process) itself. These messages inform about header files not found etc issues that are not errors in the code but something user needs to know.

debug 

Debug message.

Debug-mode message useful for the developers.

internal 

Internal message.

Message will not be shown to the user. Tracking what checkers is executed, tracking suppressed critical errors, etc.

Definition at line 63 of file errortypes.h.

Function Documentation

◆ createTokenFromExpression()

std::shared_ptr<Token> createTokenFromExpression ( const std::string &  returnValue,
const Settings settings,
bool  cpp,
std::unordered_map< nonneg int, const Token * > *  lookupVarId = nullptr 
)

◆ findLambdaEndScope() [1/2]

const Token* findLambdaEndScope ( const Token tok)

Definition at line 2748 of file token.cpp.

References findLambdaEndScope().

◆ findLambdaEndScope() [2/2]

Token* findLambdaEndScope ( Token tok)

◆ findTypeEnd()

Token* findTypeEnd ( Token tok)

Definition at line 2708 of file token.cpp.

References Token::link(), Token::Match(), and Token::next().

Referenced by findLambdaEndScope().

◆ getLibraryContainer()

CPPCHECKLIB const Library::Container* getLibraryContainer ( const Token tok)

◆ operator%()

MathLib::value operator% ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1335 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator&()

MathLib::value operator& ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1340 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator*()

MathLib::value operator* ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1325 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator+()

MathLib::value operator+ ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1315 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator-()

MathLib::value operator- ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1320 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator/()

MathLib::value operator/ ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1330 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator<<()

MathLib::value operator<< ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1355 of file mathlib.cpp.

References MathLib::value::shiftLeft().

◆ operator>>()

MathLib::value operator>> ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1360 of file mathlib.cpp.

References MathLib::value::shiftRight().

◆ operator^()

MathLib::value operator^ ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1350 of file mathlib.cpp.

References MathLib::value::calc().

◆ operator|()

MathLib::value operator| ( const MathLib::value v1,
const MathLib::value v2 
)

Definition at line 1345 of file mathlib.cpp.

References MathLib::value::calc().

◆ replaceStr()

std::string replaceStr ( std::string  s,
const std::string &  from,
const std::string &  to 
)

Replace substring.

Example replaceStr("1,NR,3", "NR", "2") => "1,2,3"

Definition at line 899 of file errorlogger.cpp.

Referenced by ErrorMessage::ErrorMessage(), CTU::FileInfo::getErrorPath(), and ErrorMessage::setmsg().

◆ severityFromString()

CPPCHECKLIB Severity severityFromString ( const std::string &  severity)

◆ severityToString()

CPPCHECKLIB std::string severityToString ( Severity  severity)

◆ substituteTemplateFormatStatic()

CPPCHECKLIB void substituteTemplateFormatStatic ( std::string &  templateFormat)

replaces the static parts of the location template

Definition at line 923 of file errorlogger.cpp.

References replaceColors(), and replaceSpecialChars().

Referenced by CmdLineParser::parseFromArgs().

◆ substituteTemplateLocationStatic()

CPPCHECKLIB void substituteTemplateLocationStatic ( std::string &  templateLocation)

replaces the static parts of the location template

Definition at line 929 of file errorlogger.cpp.

References replaceColors(), and replaceSpecialChars().

Referenced by CmdLineParser::parseFromArgs().

◆ toString()

template<>
CPPCHECKLIB std::string MathLib::toString ( double  value)
static