Cppcheck
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Library Class Reference

Library definitions handling. More...

#include <library.h>

Classes

struct  AllocFunc
 
struct  ArgumentChecks
 
class  CodeBlock
 
class  Container
 
class  Error
 
class  ExportedFunctions
 
struct  Function
 
struct  NonOverlappingData
 
struct  Platform
 
struct  PlatformType
 
struct  PodType
 
struct  SmartPointer
 
struct  WarnInfo
 

Public Types

enum class  ErrorCode {
  OK , FILE_NOT_FOUND , BAD_XML , UNKNOWN_ELEMENT ,
  MISSING_ATTRIBUTE , BAD_ATTRIBUTE_VALUE , UNSUPPORTED_FORMAT , DUPLICATE_PLATFORM_TYPE ,
  PLATFORM_TYPE_REDEFINED , DUPLICATE_DEFINE
}
 
enum class  UseRetValType { NONE , DEFAULT , ERROR_CODE }
 
enum class  TypeCheck { def , check , suppress , checkFiniteLifetime }
 Suppress/check a type. More...
 

Public Member Functions

 Library ()=default
 
Error load (const char exename[], const char path[])
 
Error load (const tinyxml2::XMLDocument &doc)
 
const AllocFuncgetAllocFuncInfo (const Token *tok) const
 get allocation info for function More...
 
const AllocFuncgetDeallocFuncInfo (const Token *tok) const
 get deallocation info for function More...
 
const AllocFuncgetReallocFuncInfo (const Token *tok) const
 get reallocation info for function More...
 
int getAllocId (const Token *tok, int arg) const
 get allocation id for function More...
 
int getDeallocId (const Token *tok, int arg) const
 get deallocation id for function More...
 
int getReallocId (const Token *tok, int arg) const
 get reallocation id for function More...
 
const AllocFuncgetAllocFuncInfo (const char name[]) const
 get allocation info for function by name (deprecated, use other alloc) More...
 
const AllocFuncgetDeallocFuncInfo (const char name[]) const
 get deallocation info for function by name (deprecated, use other alloc) More...
 
int allocId (const char name[]) const
 get allocation id for function by name (deprecated, use other alloc) More...
 
int deallocId (const char name[]) const
 get deallocation id for function by name (deprecated, use other alloc) More...
 
bool formatstr_function (const Token *ftok) const
 
int formatstr_argno (const Token *ftok) const
 
bool formatstr_scan (const Token *ftok) const
 
bool formatstr_secure (const Token *ftok) const
 
const NonOverlappingDatagetNonOverlappingData (const Token *ftok) const
 
const WarnInfogetWarnInfo (const Token *ftok) const
 
bool isNotLibraryFunction (const Token *ftok) const
 
bool matchArguments (const Token *ftok, const std::string &functionName) const
 
UseRetValType getUseRetValType (const Token *ftok) const
 
const std::string & returnValue (const Token *ftok) const
 
const std::string & returnValueType (const Token *ftok) const
 
int returnValueContainer (const Token *ftok) const
 
std::vector< MathLib::bigintunknownReturnValues (const Token *ftok) const
 
bool isnoreturn (const Token *ftok) const
 
bool isnotnoreturn (const Token *ftok) const
 
bool isScopeNoReturn (const Token *end, std::string *unknownFunc) const
 
const ContainerdetectContainer (const Token *typeStart) const
 
const ContainerdetectIterator (const Token *typeStart) const
 
const ContainerdetectContainerOrIterator (const Token *typeStart, bool *isIterator=nullptr, bool withoutStd=false) const
 
const FunctiongetFunction (const Token *ftok) const
 
bool isUse (const std::string &functionName) const
 
bool isLeakIgnore (const std::string &functionName) const
 
bool isFunctionConst (const std::string &functionName, bool pure) const
 
bool isFunctionConst (const Token *ftok) const
 
bool isboolargbad (const Token *ftok, int argnr) const
 
bool isnullargbad (const Token *ftok, int argnr) const
 
bool isuninitargbad (const Token *ftok, int argnr, int indirect=0, bool *hasIndirect=nullptr) const
 
bool isargformatstr (const Token *ftok, int argnr) const
 
bool isargstrz (const Token *ftok, int argnr) const
 
bool isIntArgValid (const Token *ftok, int argnr, const MathLib::bigint argvalue) const
 
bool isFloatArgValid (const Token *ftok, int argnr, double argvalue) const
 
const std::string & validarg (const Token *ftok, int argnr) const
 
const ArgumentChecks::IteratorInfogetArgIteratorInfo (const Token *ftok, int argnr) const
 
bool hasminsize (const Token *ftok) const
 
const std::vector< ArgumentChecks::MinSize > * argminsizes (const Token *ftok, int argnr) const
 
ArgumentChecks::Direction getArgDirection (const Token *ftok, int argnr) const
 
bool markupFile (const std::string &path) const
 
bool processMarkupAfterCode (const std::string &path) const
 
const std::set< std::string > & markupExtensions () const
 
bool reportErrors (const std::string &path) const
 
bool ignorefunction (const std::string &functionName) const
 
bool isexecutableblock (const std::string &file, const std::string &token) const
 
int blockstartoffset (const std::string &file) const
 
const std::string & blockstart (const std::string &file) const
 
const std::string & blockend (const std::string &file) const
 
bool iskeyword (const std::string &file, const std::string &keyword) const
 
bool isexporter (const std::string &prefix) const
 
bool isexportedprefix (const std::string &prefix, const std::string &token) const
 
bool isexportedsuffix (const std::string &prefix, const std::string &token) const
 
bool isimporter (const std::string &file, const std::string &importer) const
 
const TokengetContainerFromYield (const Token *tok, Container::Yield yield) const
 
const TokengetContainerFromAction (const Token *tok, Container::Action action) const
 
bool isreflection (const std::string &token) const
 
int reflectionArgument (const std::string &token) const
 
bool isentrypoint (const std::string &func) const
 
bool isSmartPointer (const Token *tok) const
 
const SmartPointerdetectSmartPointer (const Token *tok, bool withoutStd=false) const
 
const PodTypepodtype (const std::string &name) const
 
const PlatformTypeplatform_type (const std::string &name, const std::string &platform) const
 
std::string getFunctionName (const Token *ftok) const
 Get function name for function call. More...
 
TypeCheck getTypeCheck (std::string check, std::string typeName) const
 
bool hasAnyTypeCheck (const std::string &typeName) const
 

Static Public Member Functions

static bool isCompliantValidationExpression (const char *p)
 
static bool ismemory (const int id)
 is allocation type memory? More...
 
static bool ismemory (const AllocFunc *const func)
 
static bool isresource (const int id)
 is allocation type resource? More...
 
static bool isresource (const AllocFunc *const func)
 
static bool isContainerYield (const Token *const cond, Library::Container::Yield y, const std::string &fallback=emptyString)
 
static Library::Container::Yield getContainerYield (const Token *const cond)
 

Public Attributes

std::map< std::string, WarnInfofunctionwarn
 
std::unordered_map< std::string, Containercontainers
 
std::unordered_map< std::string, Functionfunctions
 
std::set< std::string > defines
 
std::unordered_map< std::string, SmartPointersmartPointers
 

Private Types

enum class  FalseTrueMaybe { False , True , Maybe }
 
enum  DetectContainer { ContainerOnly , IteratorOnly , Both }
 

Private Member Functions

Error loadFunction (const tinyxml2::XMLElement *const node, const std::string &name, std::set< std::string > &unknown_elements)
 
const ArgumentChecksgetarg (const Token *ftok, int argnr) const
 
std::string getFunctionName (const Token *ftok, bool &error) const
 
const Library::ContainerdetectContainerInternal (const Token *typeStart, DetectContainer detect, bool *isIterator=nullptr, bool withoutStd=false) const
 

Static Private Member Functions

static const AllocFuncgetAllocDealloc (const std::map< std::string, AllocFunc > &data, const std::string &name)
 

Private Attributes

int mAllocId {}
 
std::set< std::string > mFiles
 
std::map< std::string, AllocFuncmAlloc
 
std::map< std::string, AllocFuncmDealloc
 
std::map< std::string, AllocFuncmRealloc
 
std::unordered_map< std::string, FalseTrueMaybemNoReturn
 
std::map< std::string, std::string > mReturnValue
 
std::map< std::string, std::string > mReturnValueType
 
std::map< std::string, int > mReturnValueContainer
 
std::map< std::string, std::vector< MathLib::bigint > > mUnknownReturnValues
 
std::map< std::string, bool > mReportErrors
 
std::map< std::string, bool > mProcessAfterCode
 
std::set< std::string > mMarkupExtensions
 
std::map< std::string, std::set< std::string > > mKeywords
 
std::unordered_map< std::string, CodeBlockmExecutableBlocks
 
std::map< std::string, ExportedFunctionsmExporters
 
std::map< std::string, std::set< std::string > > mImporters
 
std::map< std::string, int > mReflection
 
std::unordered_map< std::string, PodTypemPodTypes
 
std::map< std::string, PlatformTypemPlatformTypes
 
std::map< std::string, PlatformmPlatforms
 
std::map< std::pair< std::string, std::string >, TypeCheckmTypeChecks
 
std::unordered_map< std::string, NonOverlappingDatamNonOverlappingData
 
std::unordered_set< std::string > mEntrypoints
 

Friends

class TestSymbolDatabase
 
class TestSingleExecutorBase
 
class TestThreadExecutorBase
 
class TestProcessExecutorBase
 

Detailed Description

Library definitions handling.

Definition at line 52 of file library.h.

Member Enumeration Documentation

◆ DetectContainer

Enumerator
ContainerOnly 
IteratorOnly 
Both 

Definition at line 604 of file library.h.

◆ ErrorCode

enum Library::ErrorCode
strong
Enumerator
OK 
FILE_NOT_FOUND 
BAD_XML 
UNKNOWN_ELEMENT 
MISSING_ATTRIBUTE 
BAD_ATTRIBUTE_VALUE 
UNSUPPORTED_FORMAT 
DUPLICATE_PLATFORM_TYPE 
PLATFORM_TYPE_REDEFINED 
DUPLICATE_DEFINE 

Definition at line 62 of file library.h.

◆ FalseTrueMaybe

enum Library::FalseTrueMaybe
strongprivate
Enumerator
False 
True 
Maybe 

Definition at line 569 of file library.h.

◆ TypeCheck

enum Library::TypeCheck
strong

Suppress/check a type.

Enumerator
def 
check 
suppress 
checkFiniteLifetime 

Definition at line 503 of file library.h.

◆ UseRetValType

Enumerator
NONE 
DEFAULT 
ERROR_CODE 

Definition at line 182 of file library.h.

Constructor & Destructor Documentation

◆ Library()

Library::Library ( )
default

Member Function Documentation

◆ allocId()

int Library::allocId ( const char  name[]) const
inline

get allocation id for function by name (deprecated, use other alloc)

Definition at line 125 of file library.h.

References Library::AllocFunc::groupId.

◆ argminsizes()

const std::vector<ArgumentChecks::MinSize>* Library::argminsizes ( const Token ftok,
int  argnr 
) const
inline

Definition at line 369 of file library.h.

References Library::ArgumentChecks::minsizes.

Referenced by CheckBufferOverrun::bufferOverflow().

◆ blockend()

const std::string & Library::blockend ( const std::string &  file) const

◆ blockstart()

const std::string & Library::blockstart ( const std::string &  file) const

◆ blockstartoffset()

int Library::blockstartoffset ( const std::string &  file) const

◆ deallocId()

int Library::deallocId ( const char  name[]) const
inline

get deallocation id for function by name (deprecated, use other alloc)

Definition at line 132 of file library.h.

References Library::AllocFunc::groupId.

Referenced by CheckMemoryLeak::getAllocationType(), CheckMemoryLeak::getDeallocationType(), and CheckMemoryLeak::getReallocationType().

◆ detectContainer()

const Library::Container * Library::detectContainer ( const Token typeStart) const

◆ detectContainerInternal()

const Library::Container * Library::detectContainerInternal ( const Token typeStart,
DetectContainer  detect,
bool *  isIterator = nullptr,
bool  withoutStd = false 
) const
private

◆ detectContainerOrIterator()

const Library::Container * Library::detectContainerOrIterator ( const Token typeStart,
bool *  isIterator = nullptr,
bool  withoutStd = false 
) const

◆ detectIterator()

const Library::Container * Library::detectIterator ( const Token typeStart) const

Definition at line 1236 of file library.cpp.

References detectContainerInternal(), and IteratorOnly.

Referenced by CheckStl::stlBoundaries().

◆ detectSmartPointer()

const Library::SmartPointer * Library::detectSmartPointer ( const Token tok,
bool  withoutStd = false 
) const

◆ formatstr_argno()

int Library::formatstr_argno ( const Token ftok) const

◆ formatstr_function()

bool Library::formatstr_function ( const Token ftok) const

◆ formatstr_scan()

bool Library::formatstr_scan ( const Token ftok) const

◆ formatstr_secure()

bool Library::formatstr_secure ( const Token ftok) const

Definition at line 1403 of file library.cpp.

References functions, and getFunctionName().

Referenced by CheckIO::checkWrongPrintfScanfArguments().

◆ getAllocDealloc()

static const AllocFunc* Library::getAllocDealloc ( const std::map< std::string, AllocFunc > &  data,
const std::string &  name 
)
inlinestaticprivate

Definition at line 599 of file library.h.

Referenced by getAllocFuncInfo(), getDeallocFuncInfo(), and getReallocFuncInfo().

◆ getAllocFuncInfo() [1/2]

const AllocFunc* Library::getAllocFuncInfo ( const char  name[]) const
inline

get allocation info for function by name (deprecated, use other alloc)

Definition at line 112 of file library.h.

◆ getAllocFuncInfo() [2/2]

const Library::AllocFunc * Library::getAllocFuncInfo ( const Token tok) const

◆ getAllocId()

int Library::getAllocId ( const Token tok,
int  arg 
) const

get allocation id for function

Definition at line 1104 of file library.cpp.

References Library::AllocFunc::arg, getAllocFuncInfo(), and Library::AllocFunc::groupId.

Referenced by CheckMemoryLeak::getAllocationType().

◆ getarg()

const Library::ArgumentChecks * Library::getarg ( const Token ftok,
int  argnr 
) const
private

◆ getArgDirection()

Library::ArgumentChecks::Direction Library::getArgDirection ( const Token ftok,
int  argnr 
) const

◆ getArgIteratorInfo()

const ArgumentChecks::IteratorInfo* Library::getArgIteratorInfo ( const Token ftok,
int  argnr 
) const
inline

◆ getContainerFromAction()

const Token * Library::getContainerFromAction ( const Token tok,
Container::Action  action 
) const

◆ getContainerFromYield()

const Token * Library::getContainerFromYield ( const Token tok,
Container::Yield  yield 
) const

◆ getContainerYield()

Library::Container::Yield Library::getContainerYield ( const Token *const  cond)
static

◆ getDeallocFuncInfo() [1/2]

const AllocFunc* Library::getDeallocFuncInfo ( const char  name[]) const
inline

get deallocation info for function by name (deprecated, use other alloc)

Definition at line 118 of file library.h.

◆ getDeallocFuncInfo() [2/2]

const Library::AllocFunc * Library::getDeallocFuncInfo ( const Token tok) const

◆ getDeallocId()

int Library::getDeallocId ( const Token tok,
int  arg 
) const

get deallocation id for function

Definition at line 1111 of file library.cpp.

References Library::AllocFunc::arg, getDeallocFuncInfo(), and Library::AllocFunc::groupId.

Referenced by CheckMemoryLeak::getDeallocationType().

◆ getFunction()

const Library::Function * Library::getFunction ( const Token ftok) const

◆ getFunctionName() [1/2]

std::string Library::getFunctionName ( const Token ftok) const

◆ getFunctionName() [2/2]

std::string Library::getFunctionName ( const Token ftok,
bool &  error 
) const
private

◆ getNonOverlappingData()

const Library::NonOverlappingData * Library::getNonOverlappingData ( const Token ftok) const

◆ getReallocFuncInfo()

const Library::AllocFunc * Library::getReallocFuncInfo ( const Token tok) const

◆ getReallocId()

int Library::getReallocId ( const Token tok,
int  arg 
) const

get reallocation id for function

Definition at line 1118 of file library.cpp.

References Library::AllocFunc::arg, getReallocFuncInfo(), and Library::AllocFunc::groupId.

Referenced by CheckMemoryLeak::getReallocationType().

◆ getTypeCheck()

Library::TypeCheck Library::getTypeCheck ( std::string  check,
std::string  typeName 
) const

◆ getUseRetValType()

Library::UseRetValType Library::getUseRetValType ( const Token ftok) const

◆ getWarnInfo()

const Library::WarnInfo * Library::getWarnInfo ( const Token ftok) const

◆ hasAnyTypeCheck()

bool Library::hasAnyTypeCheck ( const std::string &  typeName) const

Definition at line 1757 of file library.cpp.

References mTypeChecks.

◆ hasminsize()

bool Library::hasminsize ( const Token ftok) const

Definition at line 1485 of file library.cpp.

References functions, getFunctionName(), and isNotLibraryFunction().

Referenced by CheckBufferOverrun::bufferOverflow().

◆ ignorefunction()

bool Library::ignorefunction ( const std::string &  functionName) const

Definition at line 1513 of file library.cpp.

References functions.

Referenced by CheckClass::getVirtualFunctionCalls().

◆ isargformatstr()

bool Library::isargformatstr ( const Token ftok,
int  argnr 
) const
inline

Definition at line 344 of file library.h.

References Library::ArgumentChecks::formatstr.

Referenced by checkBufferSize().

◆ isargstrz()

bool Library::isargstrz ( const Token ftok,
int  argnr 
) const
inline

Definition at line 349 of file library.h.

References Library::ArgumentChecks::strz.

Referenced by CheckFunctions::invalidFunctionUsage().

◆ isboolargbad()

bool Library::isboolargbad ( const Token ftok,
int  argnr 
) const
inline

Definition at line 336 of file library.h.

References Library::ArgumentChecks::notbool.

Referenced by CheckFunctions::invalidFunctionUsage().

◆ isCompliantValidationExpression()

bool Library::isCompliantValidationExpression ( const char *  p)
static

Definition at line 1333 of file library.cpp.

References error.

Referenced by loadFunction().

◆ isContainerYield()

bool Library::isContainerYield ( const Token *const  cond,
Library::Container::Yield  y,
const std::string &  fallback = emptyString 
)
static

◆ isentrypoint()

bool Library::isentrypoint ( const std::string &  func) const
inline

◆ isexecutableblock()

bool Library::isexecutableblock ( const std::string &  file,
const std::string &  token 
) const

◆ isexportedprefix()

bool Library::isexportedprefix ( const std::string &  prefix,
const std::string &  token 
) const
inline

Definition at line 401 of file library.h.

Referenced by CheckUnusedFunctions::parseTokens().

◆ isexportedsuffix()

bool Library::isexportedsuffix ( const std::string &  prefix,
const std::string &  token 
) const
inline

Definition at line 406 of file library.h.

Referenced by CheckUnusedFunctions::parseTokens().

◆ isexporter()

bool Library::isexporter ( const std::string &  prefix) const
inline

Definition at line 397 of file library.h.

Referenced by CheckUnusedFunctions::parseTokens().

◆ isFloatArgValid()

bool Library::isFloatArgValid ( const Token ftok,
int  argnr,
double  argvalue 
) const

◆ isFunctionConst() [1/2]

bool Library::isFunctionConst ( const std::string &  functionName,
bool  pure 
) const

◆ isFunctionConst() [2/2]

bool Library::isFunctionConst ( const Token ftok) const

◆ isimporter()

bool Library::isimporter ( const std::string &  file,
const std::string &  importer 
) const

Definition at line 1657 of file library.cpp.

References Path::getFilenameExtensionInLowerCase(), and mImporters.

Referenced by CheckUnusedFunctions::parseTokens().

◆ isIntArgValid()

bool Library::isIntArgValid ( const Token ftok,
int  argnr,
const MathLib::bigint  argvalue 
) const

◆ iskeyword()

bool Library::iskeyword ( const std::string &  file,
const std::string &  keyword 
) const

Definition at line 1650 of file library.cpp.

References Path::getFilenameExtensionInLowerCase(), and mKeywords.

Referenced by CheckUnusedFunctions::parseTokens().

◆ isLeakIgnore()

bool Library::isLeakIgnore ( const std::string &  functionName) const

◆ ismemory() [1/2]

static bool Library::ismemory ( const AllocFunc *const  func)
inlinestatic

Definition at line 143 of file library.h.

References Library::AllocFunc::groupId.

◆ ismemory() [2/2]

static bool Library::ismemory ( const int  id)
inlinestatic

◆ isnoreturn()

bool Library::isnoreturn ( const Token ftok) const

◆ isNotLibraryFunction()

bool Library::isNotLibraryFunction ( const Token ftok) const

◆ isnotnoreturn()

bool Library::isnotnoreturn ( const Token ftok) const

◆ isnullargbad()

bool Library::isnullargbad ( const Token ftok,
int  argnr 
) const

◆ isreflection()

bool Library::isreflection ( const std::string &  token) const
inline

Definition at line 419 of file library.h.

Referenced by CheckUnusedFunctions::parseTokens().

◆ isresource() [1/2]

static bool Library::isresource ( const AllocFunc *const  func)
inlinestatic

Definition at line 151 of file library.h.

References Library::AllocFunc::groupId.

◆ isresource() [2/2]

static bool Library::isresource ( const int  id)
inlinestatic

is allocation type resource?

Definition at line 148 of file library.h.

Referenced by CheckLeakAutoVar::doubleFreeError(), CheckLeakAutoVar::leakError(), and load().

◆ isScopeNoReturn()

bool Library::isScopeNoReturn ( const Token end,
std::string *  unknownFunc 
) const

◆ isSmartPointer()

bool Library::isSmartPointer ( const Token tok) const

◆ isuninitargbad()

bool Library::isuninitargbad ( const Token ftok,
int  argnr,
int  indirect = 0,
bool *  hasIndirect = nullptr 
) const

◆ isUse()

bool Library::isUse ( const std::string &  functionName) const

Definition at line 1520 of file library.cpp.

References functions.

Referenced by CheckLeakAutoVar::checkScope().

◆ load() [1/2]

Library::Error Library::load ( const char  exename[],
const char  path[] 
)

◆ load() [2/2]

Library::Error Library::load ( const tinyxml2::XMLDocument &  doc)

Definition at line 193 of file library.cpp.

References Library::Container::actionFrom(), Library::AllocFunc::arg, Library::Container::arrayLike_indexOp, BAD_ATTRIBUTE_VALUE, BAD_XML, Library::PodType::BOOL, Library::AllocFunc::bufferSize, Library::AllocFunc::bufferSizeArg1, Library::AllocFunc::bufferSizeArg2, Library::AllocFunc::calloc, Library::PodType::CHAR, check, checkFiniteLifetime, containers, defines, DUPLICATE_DEFINE, DUPLICATE_PLATFORM_TYPE, emptyString, Library::Container::endPattern, endsWith(), Library::Error::errorcode, Library::Container::functions, functions, getnames(), Library::AllocFunc::groupId, Library::Container::hasInitializerListConstructor, Library::AllocFunc::initData, Library::PodType::INT, ismemory(), isresource(), Library::Container::itEndPattern, loadFunction(), Library::PodType::LONG, Library::PodType::LONGLONG, Library::AllocFunc::malloc, mAlloc, mAllocId, Library::PlatformType::mConstPtr, mDealloc, mEntrypoints, mExecutableBlocks, mExporters, mImporters, MISSING_ATTRIBUTE, mKeywords, Library::PlatformType::mLong, mMarkupExtensions, mPlatforms, mPlatformTypes, mPodTypes, Library::PlatformType::mPointer, mProcessAfterCode, Library::PlatformType::mPtrPtr, mRealloc, mReflection, mReportErrors, Library::PlatformType::mSigned, Library::PlatformType::mType, mTypeChecks, Library::PlatformType::mUnsigned, Library::Container::RangeItemRecordTypeItem::name, Library::SmartPointer::name, Library::PodType::NO, Library::Container::NO_ACTION, Library::Container::NO_YIELD, Library::AllocFunc::none, OK, Library::Container::opLessAllowed, platform_type(), PLATFORM_TYPE_REDEFINED, Library::Container::rangeItemRecordType, Library::AllocFunc::reallocArg, Library::PodType::SHORT, sign(), Library::PodType::sign, Library::PodType::size, Library::Container::size_templateArgNo, smartPointers, Library::Container::startPattern, Library::Container::startPattern2, Library::Container::stdAssociativeLike, Library::Container::stdStringLike, Library::PodType::stdtype, Library::AllocFunc::strdup, suppress, Library::Container::RangeItemRecordTypeItem::templateParameter, Library::Container::type_templateArgNo, Library::SmartPointer::unique, UNKNOWN_ELEMENT, Library::Container::unstableErase, Library::Container::unstableInsert, UNSUPPORTED_FORMAT, Library::Container::view, and Library::Container::yieldFrom().

◆ loadFunction()

Library::Error Library::loadFunction ( const tinyxml2::XMLElement *const  node,
const std::string &  name,
std::set< std::string > &  unknown_elements 
)
private

Definition at line 676 of file library.cpp.

References Library::Container::actionFrom(), Library::Function::argumentChecks, Library::ArgumentChecks::MinSize::ARGVALUE, BAD_ATTRIBUTE_VALUE, Standards::c, Standards::C89, Library::ArgumentChecks::IteratorInfo::container, Library::Function::containerAction, Library::Function::containerYield, Library::NonOverlappingData::countArg, Standards::cpp, Standards::CPP03, DEFAULT, Library::ArgumentChecks::DIR_IN, Library::ArgumentChecks::DIR_INOUT, Library::ArgumentChecks::DIR_OUT, Library::ArgumentChecks::direction, ERROR_CODE, False, Library::ArgumentChecks::IteratorInfo::first, Library::ArgumentChecks::formatstr, Library::Function::formatstr, Library::Function::formatstr_scan, Library::Function::formatstr_secure, functions, functionwarn, getnames(), Library::Function::ignore, isCompliantValidationExpression(), Library::Function::isconst, Library::Function::ispure, Library::ArgumentChecks::IteratorInfo::it, Library::ArgumentChecks::iteratorInfo, Library::ArgumentChecks::IteratorInfo::last, Library::Function::leakignore, Maybe, Library::WarnInfo::message, Library::ArgumentChecks::minsizes, MISSING_ATTRIBUTE, mNonOverlappingData, mNoReturn, mReturnValue, mReturnValueContainer, mReturnValueType, Library::ArgumentChecks::MinSize::MUL, mUnknownReturnValues, Library::Container::NO_ACTION, Library::Container::NO_YIELD, Library::ArgumentChecks::notbool, Library::ArgumentChecks::notnull, Library::ArgumentChecks::notuninit, OK, Library::ArgumentChecks::optional, Library::NonOverlappingData::ptr1Arg, Library::NonOverlappingData::ptr2Arg, Library::Function::returnType, Standards::setC(), Standards::setCPP(), Library::WarnInfo::severity, severityFromString(), Library::NonOverlappingData::sizeArg, Library::ArgumentChecks::MinSize::SIZEOF, Library::WarnInfo::standards, Library::ArgumentChecks::MinSize::STRLEN, Library::NonOverlappingData::strlenArg, Library::ArgumentChecks::strz, True, unknownReturnValues(), Library::Function::useretval, Library::ArgumentChecks::valid, Library::ArgumentChecks::MinSize::VALUE, Library::ArgumentChecks::variadic, and Library::Container::yieldFrom().

Referenced by load().

◆ markupExtensions()

const std::set<std::string>& Library::markupExtensions ( ) const
inline

Definition at line 380 of file library.h.

Referenced by CmdLineParser::fillSettingsFromArgs().

◆ markupFile()

bool Library::markupFile ( const std::string &  path) const

◆ matchArguments()

bool Library::matchArguments ( const Token ftok,
const std::string &  functionName 
) const

Definition at line 1301 of file library.cpp.

References functions, and numberOfArgumentsWithoutAst().

Referenced by getFunctionName(), and isNotLibraryFunction().

◆ platform_type()

const PlatformType* Library::platform_type ( const std::string &  name,
const std::string &  platform 
) const
inline

Definition at line 485 of file library.h.

Referenced by ValueType::fromLibraryType(), and load().

◆ podtype()

const PodType* Library::podtype ( const std::string &  name) const
inline

◆ processMarkupAfterCode()

bool Library::processMarkupAfterCode ( const std::string &  path) const

Definition at line 1598 of file library.cpp.

References Path::getFilenameExtensionInLowerCase(), and mProcessAfterCode.

◆ reflectionArgument()

int Library::reflectionArgument ( const std::string &  token) const
inline

Definition at line 423 of file library.h.

Referenced by CheckUnusedFunctions::parseTokens().

◆ reportErrors()

bool Library::reportErrors ( const std::string &  path) const

Definition at line 1604 of file library.cpp.

References Path::getFilenameExtensionInLowerCase(), and mReportErrors.

Referenced by Executor::hasToLog(), and CppCheck::reportErr().

◆ returnValue()

const std::string & Library::returnValue ( const Token ftok) const

◆ returnValueContainer()

int Library::returnValueContainer ( const Token ftok) const

Definition at line 1458 of file library.cpp.

References getFunctionName(), isNotLibraryFunction(), and mReturnValueContainer.

Referenced by valueFlowLifetimeFunction().

◆ returnValueType()

const std::string & Library::returnValueType ( const Token ftok) const

◆ unknownReturnValues()

std::vector< MathLib::bigint > Library::unknownReturnValues ( const Token ftok) const

◆ validarg()

const std::string& Library::validarg ( const Token ftok,
int  argnr 
) const
inline

Definition at line 357 of file library.h.

References emptyString, and Library::ArgumentChecks::valid.

Referenced by CheckFunctions::invalidFunctionUsage().

Friends And Related Function Documentation

◆ TestProcessExecutorBase

friend class TestProcessExecutorBase
friend

Definition at line 57 of file library.h.

◆ TestSingleExecutorBase

friend class TestSingleExecutorBase
friend

Definition at line 55 of file library.h.

◆ TestSymbolDatabase

friend class TestSymbolDatabase
friend

Definition at line 54 of file library.h.

◆ TestThreadExecutorBase

friend class TestThreadExecutorBase
friend

Definition at line 56 of file library.h.

Member Data Documentation

◆ containers

std::unordered_map<std::string, Container> Library::containers

Definition at line 270 of file library.h.

Referenced by detectContainerInternal(), and load().

◆ defines

std::set<std::string> Library::defines

Definition at line 434 of file library.h.

Referenced by createDUI(), and load().

◆ functions

std::unordered_map<std::string, Function> Library::functions

◆ functionwarn

std::map<std::string, WarnInfo> Library::functionwarn

Definition at line 174 of file library.h.

Referenced by CheckFunctions::getErrorMessages(), getWarnInfo(), and loadFunction().

◆ mAlloc

std::map<std::string, AllocFunc> Library::mAlloc
private

Definition at line 572 of file library.h.

Referenced by getAllocFuncInfo(), and load().

◆ mAllocId

int Library::mAllocId {}
private

Definition at line 570 of file library.h.

Referenced by load().

◆ mDealloc

std::map<std::string, AllocFunc> Library::mDealloc
private

Definition at line 573 of file library.h.

Referenced by getDeallocFuncInfo(), and load().

◆ mEntrypoints

std::unordered_set<std::string> Library::mEntrypoints
private

Definition at line 593 of file library.h.

Referenced by load().

◆ mExecutableBlocks

std::unordered_map<std::string, CodeBlock> Library::mExecutableBlocks
private

Definition at line 584 of file library.h.

Referenced by blockend(), blockstart(), blockstartoffset(), isexecutableblock(), and load().

◆ mExporters

std::map<std::string, ExportedFunctions> Library::mExporters
private

Definition at line 585 of file library.h.

Referenced by load().

◆ mFiles

std::set<std::string> Library::mFiles
private

Definition at line 571 of file library.h.

Referenced by load().

◆ mImporters

std::map<std::string, std::set<std::string> > Library::mImporters
private

Definition at line 586 of file library.h.

Referenced by isimporter(), and load().

◆ mKeywords

std::map<std::string, std::set<std::string> > Library::mKeywords
private

Definition at line 583 of file library.h.

Referenced by iskeyword(), and load().

◆ mMarkupExtensions

std::set<std::string> Library::mMarkupExtensions
private

Definition at line 582 of file library.h.

Referenced by load(), and markupFile().

◆ mNonOverlappingData

std::unordered_map<std::string, NonOverlappingData> Library::mNonOverlappingData
private

Definition at line 592 of file library.h.

Referenced by getNonOverlappingData(), and loadFunction().

◆ mNoReturn

std::unordered_map<std::string, FalseTrueMaybe> Library::mNoReturn
private

Definition at line 575 of file library.h.

Referenced by isnoreturn(), isnotnoreturn(), and loadFunction().

◆ mPlatforms

std::map<std::string, Platform> Library::mPlatforms
private

Definition at line 590 of file library.h.

Referenced by load().

◆ mPlatformTypes

std::map<std::string, PlatformType> Library::mPlatformTypes
private

Definition at line 589 of file library.h.

Referenced by load().

◆ mPodTypes

std::unordered_map<std::string, PodType> Library::mPodTypes
private

Definition at line 588 of file library.h.

Referenced by load().

◆ mProcessAfterCode

std::map<std::string, bool> Library::mProcessAfterCode
private

Definition at line 581 of file library.h.

Referenced by load(), and processMarkupAfterCode().

◆ mRealloc

std::map<std::string, AllocFunc> Library::mRealloc
private

Definition at line 574 of file library.h.

Referenced by getReallocFuncInfo(), and load().

◆ mReflection

std::map<std::string, int> Library::mReflection
private

Definition at line 587 of file library.h.

Referenced by load().

◆ mReportErrors

std::map<std::string, bool> Library::mReportErrors
private

Definition at line 580 of file library.h.

Referenced by load(), and reportErrors().

◆ mReturnValue

std::map<std::string, std::string> Library::mReturnValue
private

Definition at line 576 of file library.h.

Referenced by loadFunction(), and returnValue().

◆ mReturnValueContainer

std::map<std::string, int> Library::mReturnValueContainer
private

Definition at line 578 of file library.h.

Referenced by loadFunction(), and returnValueContainer().

◆ mReturnValueType

std::map<std::string, std::string> Library::mReturnValueType
private

Definition at line 577 of file library.h.

Referenced by loadFunction(), and returnValueType().

◆ mTypeChecks

std::map<std::pair<std::string,std::string>, TypeCheck> Library::mTypeChecks
private

Definition at line 591 of file library.h.

Referenced by getTypeCheck(), hasAnyTypeCheck(), and load().

◆ mUnknownReturnValues

std::map<std::string, std::vector<MathLib::bigint> > Library::mUnknownReturnValues
private

Definition at line 579 of file library.h.

Referenced by loadFunction(), and unknownReturnValues().

◆ smartPointers

std::unordered_map<std::string, SmartPointer> Library::smartPointers

Definition at line 441 of file library.h.

Referenced by detectSmartPointer(), load(), and SymbolDatabase::setValueTypeInTokenList().


The documentation for this class was generated from the following files: