@@ -109,30 +109,19 @@ class CPPCHECKLIB Library {
109109
110110 // TODO: get rid of this
111111 /* * get allocation info for function by name (deprecated, use other alloc) */
112- const AllocFunc* getAllocFuncInfo (const char name[]) const {
113- return getAllocDealloc (mAlloc , name);
114- }
112+ const AllocFunc* getAllocFuncInfo (const char name[]) const ;
115113
116114 // TODO: get rid of this
117115 /* * get deallocation info for function by name (deprecated, use other alloc) */
118- const AllocFunc* getDeallocFuncInfo (const char name[]) const {
119- return getAllocDealloc (mDealloc , name);
120- }
116+ const AllocFunc* getDeallocFuncInfo (const char name[]) const ;
121117
122118 // TODO: get rid of this
123119 /* * get allocation id for function by name (deprecated, use other alloc) */
124- // cppcheck-suppress unusedFunction
125- int allocId (const char name[]) const {
126- const AllocFunc* af = getAllocDealloc (mAlloc , name);
127- return af ? af->groupId : 0 ;
128- }
120+ int allocId (const char name[]) const ;
129121
130122 // TODO: get rid of this
131123 /* * get deallocation id for function by name (deprecated, use other alloc) */
132- int deallocId (const char name[]) const {
133- const AllocFunc* af = getAllocDealloc (mDealloc , name);
134- return af ? af->groupId : 0 ;
135- }
124+ int deallocId (const char name[]) const ;
136125
137126 static bool isCompliantValidationExpression (const char * p);
138127
@@ -267,7 +256,7 @@ class CPPCHECKLIB Library {
267256 static Yield yieldFrom (const std::string& yieldName);
268257 static Action actionFrom (const std::string& actionName);
269258 };
270- std::unordered_map<std::string, Container> containers;
259+ const std::unordered_map<std::string, Container>& containers () const ;
271260 const Container* detectContainer (const Token* typeStart) const ;
272261 const Container* detectIterator (const Token* typeStart) const ;
273262 const Container* detectContainerOrIterator (const Token* typeStart, bool * isIterator = nullptr , bool withoutStd = false ) const ;
@@ -327,7 +316,7 @@ class CPPCHECKLIB Library {
327316 };
328317
329318 const Function *getFunction (const Token *ftok) const ;
330- std::unordered_map<std::string, Function> functions;
319+ const std::unordered_map<std::string, Function>& functions () const ;
331320 bool isUse (const std::string& functionName) const ;
332321 bool isLeakIgnore (const std::string& functionName) const ;
333322 bool isFunctionConst (const std::string& functionName, bool pure) const ;
@@ -377,9 +366,7 @@ class CPPCHECKLIB Library {
377366
378367 bool processMarkupAfterCode (const std::string &path) const ;
379368
380- const std::set<std::string> &markupExtensions () const {
381- return mMarkupExtensions ;
382- }
369+ const std::set<std::string> &markupExtensions () const ;
383370
384371 bool reportErrors (const std::string &path) const ;
385372
@@ -394,19 +381,11 @@ class CPPCHECKLIB Library {
394381
395382 bool iskeyword (const std::string &file, const std::string &keyword) const ;
396383
397- bool isexporter (const std::string &prefix) const {
398- return mExporters .find (prefix) != mExporters .end ();
399- }
384+ bool isexporter (const std::string &prefix) const ;
400385
401- bool isexportedprefix (const std::string &prefix, const std::string &token) const {
402- const std::map<std::string, ExportedFunctions>::const_iterator it = mExporters .find (prefix);
403- return (it != mExporters .end () && it->second .isPrefix (token));
404- }
386+ bool isexportedprefix (const std::string &prefix, const std::string &token) const ;
405387
406- bool isexportedsuffix (const std::string &prefix, const std::string &token) const {
407- const std::map<std::string, ExportedFunctions>::const_iterator it = mExporters .find (prefix);
408- return (it != mExporters .end () && it->second .isSuffix (token));
409- }
388+ bool isexportedsuffix (const std::string &prefix, const std::string &token) const ;
410389
411390 bool isimporter (const std::string& file, const std::string &importer) const ;
412391
@@ -416,20 +395,11 @@ class CPPCHECKLIB Library {
416395 static bool isContainerYield (const Token* const cond, Library::Container::Yield y, const std::string& fallback = emptyString);
417396 static Library::Container::Yield getContainerYield (const Token* const cond);
418397
419- bool isreflection (const std::string &token) const {
420- return mReflection .find (token) != mReflection .end ();
421- }
398+ bool isreflection (const std::string &token) const ;
422399
423- int reflectionArgument (const std::string &token) const {
424- const std::map<std::string, int >::const_iterator it = mReflection .find (token);
425- if (it != mReflection .end ())
426- return it->second ;
427- return -1 ;
428- }
400+ int reflectionArgument (const std::string &token) const ;
429401
430- bool isentrypoint (const std::string &func) const {
431- return func == " main" || mEntrypoints .find (func) != mEntrypoints .end ();
432- }
402+ bool isentrypoint (const std::string &func) const ;
433403
434404 std::set<std::string> defines; // to provide some library defines
435405
@@ -438,7 +408,7 @@ class CPPCHECKLIB Library {
438408 bool unique = false ;
439409 };
440410
441- std::unordered_map<std::string, SmartPointer> smartPointers;
411+ const std::unordered_map<std::string, SmartPointer>& smartPointers () const ;
442412 bool isSmartPointer (const Token *tok) const ;
443413 const SmartPointer* detectSmartPointer (const Token* tok, bool withoutStd = false ) const ;
444414
@@ -447,10 +417,7 @@ class CPPCHECKLIB Library {
447417 char sign;
448418 enum class Type { NO, BOOL, CHAR, SHORT, INT, LONG, LONGLONG } stdtype;
449419 };
450- const PodType *podtype (const std::string &name) const {
451- const std::unordered_map<std::string, PodType>::const_iterator it = mPodTypes .find (name);
452- return (it != mPodTypes .end ()) ? &(it->second ) : nullptr ;
453- }
420+ const PodType *podtype (const std::string &name) const ;
454421
455422 struct PlatformType {
456423 bool operator == (const PlatformType & type) const {
@@ -482,17 +449,7 @@ class CPPCHECKLIB Library {
482449 std::map<std::string, PlatformType> mPlatformTypes ;
483450 };
484451
485- const PlatformType *platform_type (const std::string &name, const std::string & platform) const {
486- const std::map<std::string, Platform>::const_iterator it = mPlatforms .find (platform);
487- if (it != mPlatforms .end ()) {
488- const PlatformType * const type = it->second .platform_type (name);
489- if (type)
490- return type;
491- }
492-
493- const std::map<std::string, PlatformType>::const_iterator it2 = mPlatformTypes .find (name);
494- return (it2 != mPlatformTypes .end ()) ? &(it2->second ) : nullptr ;
495- }
452+ const PlatformType *platform_type (const std::string &name, const std::string & platform) const ;
496453
497454 /* *
498455 * Get function name for function call
@@ -566,6 +523,9 @@ class CPPCHECKLIB Library {
566523 int mOffset {};
567524 std::set<std::string> mBlocks ;
568525 };
526+ std::unordered_map<std::string, Container> mContainers ;
527+ std::unordered_map<std::string, Function> mFunctions ;
528+ std::unordered_map<std::string, SmartPointer> mSmartPointers ;
569529 enum class FalseTrueMaybe { False, True, Maybe };
570530 int mAllocId {};
571531 std::set<std::string> mFiles ;
0 commit comments