Cppcheck
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tokenize.h
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2015 Daniel Marjam√§ki and Cppcheck team.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 //---------------------------------------------------------------------------
20 #ifndef tokenizeH
21 #define tokenizeH
22 //---------------------------------------------------------------------------
23 
24 #include "errorlogger.h"
25 #include "tokenlist.h"
26 #include "config.h"
27 
28 #include <string>
29 #include <map>
30 #include <set>
31 #include <list>
32 #include <ctime>
33 
34 class Settings;
35 class SymbolDatabase;
36 class TimerResults;
37 
38 /// @addtogroup Core
39 /// @{
40 
41 /** @brief The main purpose is to tokenize the source code. It also has functions that simplify the token list */
43 
44  friend class TestSimplifyTokens;
45  friend class TestSimplifyTypedef;
46  friend class TestTokenizer;
47 public:
48  Tokenizer();
49  Tokenizer(const Settings * settings, ErrorLogger *errorLogger);
50  ~Tokenizer();
51 
53  m_timerResults = tr;
54  }
55 
56  /** Is the code C. Used for bailouts */
57  bool isC() const {
58  return list.isC();
59  }
60 
61  /** Is the code CPP. Used for bailouts */
62  bool isCPP() const {
63  return list.isCPP();
64  }
65 
66  /**
67  * Check if inner scope ends with a call to a noreturn function
68  * \param endScopeToken The '}' token
69  * \param unknown set to true if it's unknown if the scope is noreturn
70  * \return true if scope ends with a function call that might be 'noreturn'
71  */
72  bool IsScopeNoReturn(const Token *endScopeToken, bool *unknown = nullptr) const;
73 
74  /**
75  * Tokenize code
76  * @param code input stream for code, e.g.
77  * \code
78  * #file "p.h"
79  * class Foo
80  * {
81  * private:
82  * void Bar();
83  * };
84  *
85  * #endfile
86  * void Foo::Bar()
87  * {
88  * }
89  * \endcode
90  *
91  * @param FileName The filename
92  * @param configuration E.g. "A" for code where "#ifdef A" is true
93  * @param noSymbolDB_AST Disable creation of SymbolDatabase and AST
94  * @return false if source code contains syntax errors
95  */
96  bool tokenize(std::istream &code,
97  const char FileName[],
98  const std::string &configuration = emptyString,
99  bool noSymbolDB_AST = false);
100  /**
101  * tokenize condition and run simple simplifications on it
102  * @param code code
103  * @return true if success.
104  */
105  bool tokenizeCondition(const std::string &code);
106 
107  /** Set variable id */
108  void setVarId();
109 
110  /**
111  * Basic simplification of tokenlist
112  *
113  * @param FileName The filename to run; used to do
114  * markup checks.
115  *
116  * @return false if there is an error that requires aborting
117  * the checking of this file.
118  */
119  bool simplifyTokenList1(const char FileName[]);
120 
121  /**
122  * Most aggressive simplification of tokenlist
123  *
124  * @return false if there is an error that requires aborting
125  * the checking of this file.
126  */
127  bool simplifyTokenList2();
128 
129  /**
130  * Deletes dead code between 'begin' and 'end'.
131  * In general not everything can be erased, such as:
132  * - code after labels;
133  * - code outside the scope where the function is called;
134  * - code after a change of scope caused by 'switch(...);'
135  * instructions, like 'case %any%;' or 'default;'
136  * Also, if the dead code contains a 'switch' block
137  * and inside it there's a label, the function removes all
138  * the 'switch(..)' tokens and every occurrence of 'case %any%; | default;'
139  * expression, such as the 'switch' block is reduced to a simple block.
140  *
141  * @param begin Tokens after this have a possibility to be erased.
142  * @param end Tokens before this have a possibility to be erased.
143  */
144  static void eraseDeadCode(Token *begin, const Token *end);
145 
146  /**
147  * Simplify '* & ( %name% ) =' or any combination of '* &' and '()'
148  * parentheses around '%name%' to '%name% ='
149  */
150  void simplifyMulAndParens();
151 
152  /**
153  * Calculates sizeof value for given type.
154  * @param type Token which will contain e.g. "int", "*", or string.
155  * @return sizeof for given type, or 0 if it can't be calculated.
156  */
157  unsigned int sizeOfType(const Token *type) const;
158 
159  /**
160  * Try to determine if function parameter is passed by value by looking
161  * at the function declaration.
162  * @param fpar token for function parameter in the function call
163  * @return true if the parameter is passed by value. if unsure, false is returned
164  */
165  bool isFunctionParameterPassedByValue(const Token *fpar) const;
166 
167  /**
168  * get error messages that the tokenizer generate
169  */
170  static void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings);
171 
172  /** Simplify assignment in function call "f(x=g());" => "x=g();f(x);"
173  */
174  void simplifyAssignmentInFunctionCall();
175 
176  /** Simplify assignment where rhs is a block : "x=({123;});" => "{x=123;}" */
177  void simplifyAssignmentBlock();
178 
179  /**
180  * Simplify constant calculations such as "1+2" => "3"
181  * @return true if modifications to token-list are done.
182  * false if no modifications are done.
183  */
184  bool simplifyCalculations();
185 
186  /**
187  * Simplify dereferencing a pointer offset by a number:
188  * "*(ptr + num)" => "ptr[num]"
189  * "*(ptr - num)" => "ptr[-num]"
190  */
191  void simplifyOffsetPointerDereference();
192 
193  /**
194  * Simplify referencing a pointer offset:
195  * "Replace "&str[num]" => "(str + num)"
196  */
197  void simplifyOffsetPointerReference();
198 
199  /** Insert array size where it isn't given */
200  void arraySize();
201 
202  /** Simplify labels and 'case|default' syntaxes.
203  */
204  void simplifyLabelsCaseDefault();
205 
206  /** Remove macros in global scope */
207  void removeMacrosInGlobalScope();
208 
209  /** Remove undefined macro in class definition:
210  * class DLLEXPORT Fred { };
211  * class Fred FINAL : Base { };
212  */
213  void removeMacroInClassDef();
214 
215  /** Remove unknown macro in variable declarations: PROGMEM char x; */
216  void removeMacroInVarDecl();
217 
218  /** Remove redundant assignment */
219  void removeRedundantAssignment();
220 
221  /** Simplifies some realloc usage like
222  * 'x = realloc (0, n);' => 'x = malloc(n);'
223  * 'x = realloc (y, 0);' => 'x = 0; free(y);'
224  */
225  void simplifyRealloc();
226 
227  /** Add parentheses for sizeof: sizeof x => sizeof(x) */
228  void sizeofAddParentheses();
229 
230  /**
231  * Replace sizeof() to appropriate size.
232  * @return true if modifications to token-list are done.
233  * false if no modifications are done.
234  */
235  bool simplifySizeof();
236 
237  /**
238  * Simplify variable declarations (split up)
239  * \param only_k_r_fpar Only simplify K&R function parameters
240  */
241  void simplifyVarDecl(bool only_k_r_fpar);
242  void simplifyVarDecl(Token * tokBegin, Token * tokEnd, bool only_k_r_fpar);
243 
244  /**
245  * Simplify variable initialization
246  * '; int *p(0);' => '; int *p = 0;'
247  */
248  void simplifyInitVar();
249  Token * initVar(Token * tok);
250 
251  /**
252  * Convert platform dependent types to standard types.
253  * 32 bits: size_t -> unsigned long
254  * 64 bits: size_t -> unsigned long long
255  */
256  void simplifyPlatformTypes();
257 
258  /**
259  * Collapse compound standard types into a single token.
260  * unsigned long long int => long _isUnsigned=true,_isLong=true
261  */
262  void simplifyStdType();
263 
264  /**
265  * Simplify easy constant '?:' operation
266  * Example: 0 ? (2/0) : 0 => 0
267  * @return true if something is modified
268  * false if nothing is done.
269  */
270  bool simplifyConstTernaryOp();
271 
272  /**
273  * Simplify compound assignments
274  * Example: ";a+=b;" => ";a=a+b;"
275  */
276  void simplifyCompoundAssignment();
277 
278  /**
279  * Simplify the location of "static" and "const" qualifiers in
280  * a variable declaration or definition.
281  * Example: "int static const a;" => "static const a;"
282  * Example: "long long const static b;" => "static const long long b;"
283  */
284  void simplifyStaticConst();
285 
286  /**
287  * Simplify assignments in "if" and "while" conditions
288  * Example: "if(a=b);" => "a=b;if(a);"
289  * Example: "while(a=b) { f(a); }" => "a = b; while(a){ f(a); a = b; }"
290  * Example: "do { f(a); } while(a=b);" => "do { f(a); a = b; } while(a);"
291  */
292  void simplifyIfAndWhileAssign();
293 
294  /**
295  * Simplify multiple assignments.
296  * Example: "a = b = c = 0;" => "a = 0; b = 0; c = 0;"
297  */
298  void simplifyVariableMultipleAssign();
299 
300  /**
301  * simplify if-not
302  * Example: "if(0==x);" => "if(!x);"
303  */
304  void simplifyIfNot();
305 
306  /**
307  * simplify if-not NULL
308  * Example: "if(0!=x);" => "if(x);"
309  * Special case: 'x = (0 != x);' is removed.
310  */
311  void simplifyIfNotNull();
312 
313  /** @brief simplify if (a) { if (a) */
314  void simplifyIfSameInnerCondition();
315 
316  /**
317  * Simplify the 'C Alternative Tokens'
318  * Examples:
319  * "if(s and t)" => "if(s && t)"
320  * "while((r bitand s) and not t)" => while((r & s) && !t)"
321  * "a and_eq b;" => "a &= b;"
322  */
323  bool simplifyCAlternativeTokens();
324 
325  /**
326  * Simplify comma into a semicolon when possible:
327  * - "delete a, delete b" => "delete a; delete b;"
328  * - "a = 0, b = 0;" => "a = 0; b = 0;"
329  * - "return a(), b;" => "a(); return b;"
330  */
331  void simplifyComma();
332 
333  /** Add braces to an if-block, for-block, etc.
334  * @return true if no syntax errors
335  */
336  bool simplifyAddBraces();
337 
338  /** Add braces to an if-block, for-block, etc.
339  * for command starting at token including else-block
340  * @return last token of command
341  * or input token in case of an error where no braces are added
342  * or NULL when syntaxError is called
343  */
344  Token * simplifyAddBracesToCommand(Token * tok);
345 
346  /** Add pair of braces to an single if-block, else-block, for-block, etc.
347  * for command starting at token
348  * @return last token of command
349  * or input token in case of an error where no braces are added
350  * or NULL when syntaxError is called
351  */
352  Token * simplifyAddBracesPair(Token *tok, bool commandWithCondition);
353 
354  /**
355  * typedef A mytype;
356  * mytype c;
357  *
358  * Becomes:
359  * typedef A mytype;
360  * A c;
361  */
362  void simplifyTypedef();
363 
364  /**
365  * Simplify float casts (float)1 => 1.0
366  */
367  void simplifyFloatCasts();
368 
369  /**
370  * Simplify casts
371  */
372  void simplifyCasts();
373 
374  /**
375  * Change (multiple) arrays to (multiple) pointers.
376  */
377  void simplifyUndefinedSizeArray();
378 
379  /**
380  * A simplify function that replaces a variable with its value in cases
381  * when the value is known. e.g. "x=10; if(x)" => "x=10;if(10)"
382  *
383  * @return true if modifications to token-list are done.
384  * false if no modifications are done.
385  */
386  bool simplifyKnownVariables();
387 
388  /**
389  * Utility function for simplifyKnownVariables. Get data about an
390  * assigned variable.
391  */
392  static bool simplifyKnownVariablesGetData(unsigned int varid, Token **_tok2, Token **_tok3, std::string &value, unsigned int &valueVarId, bool &valueIsPointer, bool floatvar);
393 
394  /**
395  * utility function for simplifyKnownVariables. Perform simplification
396  * of a given variable
397  */
398  bool simplifyKnownVariablesSimplify(Token **tok2, Token *tok3, unsigned int varid, const std::string &structname, std::string &value, unsigned int valueVarId, bool valueIsPointer, const Token * const valueToken, int indentlevel) const;
399 
400  /** Simplify useless C++ empty namespaces, like: 'namespace %name% { }'*/
401  void simplifyEmptyNamespaces();
402 
403  /** Simplify redundant code placed after control flow statements :
404  * 'return', 'throw', 'goto', 'break' and 'continue'
405  */
406  void simplifyFlowControl();
407 
408  /** Expand nested strcat() calls. */
409  void simplifyNestedStrcat();
410 
411  /** Simplify "if else" */
412  void elseif();
413 
414  /** Simplify conditions
415  * @return true if something is modified
416  * false if nothing is done.
417  */
418  bool simplifyConditions();
419 
420  /** Remove redundant code, e.g. if( false ) { int a; } should be
421  * removed, because it is never executed.
422  * @return true if something is modified
423  * false if nothing is done.
424  */
425  bool removeRedundantConditions();
426 
427  /**
428  * Remove redundant for:
429  * "for (x=0;x<1;x++) { }" => "{ x = 1; }"
430  */
431  void removeRedundantFor();
432 
433 
434  /**
435  * Reduces "; ;" to ";", except in "( ; ; )"
436  */
437  void removeRedundantSemicolons();
438 
439  /** Simplify function calls - constant return value
440  * @return true if something is modified
441  * false if nothing is done.
442  */
443  bool simplifyFunctionReturn();
444 
445  /** Struct initialization */
446  void simplifyStructInit();
447 
448  /** Struct simplification
449  * "struct S { } s;" => "struct S { }; S s;"
450  */
451 
452  void simplifyStructDecl();
453 
454  /**
455  * Remove redundant parentheses:
456  * - "((x))" => "(x)"
457  * - "(function())" => "function()"
458  * - "(delete x)" => "delete x"
459  * - "(delete [] x)" => "delete [] x"
460  * @return true if modifications to token-list are done.
461  * false if no modifications are done.
462  */
463  bool simplifyRedundantParentheses();
464 
465  void simplifyCharAt();
466 
467  /** Simplify references */
468  void simplifyReference();
469 
470  /**
471  * Simplify functions like "void f(x) int x; {"
472  * into "void f(int x) {"
473  */
474  void simplifyFunctionParameters();
475 
476  /**
477  * Simplify templates
478  */
479  void simplifyTemplates();
480 
481  void simplifyDoublePlusAndDoubleMinus();
482 
483  void simplifyRedundantConsecutiveBraces();
484 
485  void simplifyArrayAccessSyntax();
486 
487  void simplifyParameterVoid();
488 
489  void fillTypeSizes();
490 
491  void combineOperators();
492 
493  void combineStrings();
494 
495  void concatenateDoubleSharp();
496 
497  void simplifyFileAndLineMacro();
498 
499  void simplifyNull();
500 
501  void concatenateNegativeNumberAndAnyPositive();
502 
503  void simplifyExternC();
504 
505  void simplifyRoundCurlyParentheses();
506 
507  void simplifyDebugNew();
508 
509  void simplifySQL();
510 
511  bool hasEnumsWithTypedef();
512 
513  void simplifyDefaultAndDeleteInsideClass();
514 
515  void findComplicatedSyntaxErrorsInTemplates();
516 
517  /**
518  * Simplify e.g. 'atol("0")' into '0'
519  */
520  void simplifyMathFunctions();
521 
522  /**
523  * Simplify e.g. 'sin(0)' into '0'
524  */
525  void simplifyMathExpressions();
526 
527  /**
528  * Modify strings in the token list by replacing hex and oct
529  * values. E.g. "\x61" -> "a" and "\000" -> "\0"
530  * @param source The string to be modified, e.g. "\x61"
531  * @return Modified string, e.g. "a"
532  */
533  static std::string simplifyString(const std::string &source);
534 
535 private:
536 
537  /**
538  * Change "int const x;" into "const int x;"
539  */
540  void simplifyConst();
541 
542  /**
543  * simplify "while (0)"
544  */
545  void simplifyWhile0();
546 
547  /**
548  * Simplify while(func() && errno==EINTR)
549  */
550  void simplifyErrNoInWhile();
551 
552  /**
553  * Simplify while(func(f))
554  */
555  void simplifyFuncInWhile();
556 
557  /**
558  * Replace enum with constant value
559  */
560  void simplifyEnum();
561 
562  /**
563  * Remove "std::" before some function names
564  */
565  void simplifyStd();
566 
567  /** Simplify pointer to standard type (C only) */
568  void simplifyPointerToStandardType();
569 
570  /** Simplify function pointers */
571  void simplifyFunctionPointers();
572 
573  /**
574  * Remove exception specifications.
575  */
576  void removeExceptionSpecifications();
577 
578 
579  /**
580  * Send error message to error logger about internal bug.
581  * @param tok the token that this bug concerns.
582  */
583  void cppcheckError(const Token *tok) const;
584 
585  /**
586  * Setup links for tokens so that one can call Token::link().
587  */
588  void createLinks();
589 
590  /**
591  * Setup links between < and >.
592  */
593  void createLinks2();
594 
595 public:
596 
597  /** Syntax error */
598  void syntaxError(const Token *tok) const;
599 
600  /** Syntax error. Example: invalid number of ')' */
601  void syntaxError(const Token *tok, char c) const;
602 
603 private:
604 
605  /** Report that there is an unhandled "class x y {" code */
606  void unhandled_macro_class_x_y(const Token *tok) const;
607 
608  /**
609  * assert that tokens are ok - used during debugging for example
610  * to catch problems in simplifyTokenList1/2.
611  */
612  void validate() const;
613 
614  /**
615  * Remove __declspec()
616  */
617  void simplifyDeclspec();
618 
619  /**
620  * Remove calling convention
621  */
622  void simplifyCallingConvention();
623 
624  /**
625  * Remove __attribute__ ((?))
626  */
627  void simplifyAttribute();
628 
629  /**
630  * Remove keywords "volatile", "inline", "register", and "restrict"
631  */
632  void simplifyKeyword();
633 
634  /**
635  * Remove __asm
636  */
637  void simplifyAsm();
638 
639  /**
640  * asm heuristics, Put ^{} statements in asm()
641  */
642  void simplifyAsm2();
643 
644  /**
645  * Simplify bitfields - the field width is removed as we don't use it.
646  */
647  void simplifyBitfields();
648 
649  /**
650  * Remove __builtin_expect(...), likely(...), and unlikely(...)
651  */
652  void simplifyBuiltinExpect();
653 
654  /**
655  * Remove unnecessary member qualification
656  */
657  void removeUnnecessaryQualification();
658 
659  /**
660  * unnecessary member qualification error
661  */
662  void unnecessaryQualificationError(const Token *tok, const std::string &qualification) const;
663 
664  /**
665  * Add std:: in front of std classes, when using namespace std; was given
666  */
667  void simplifyNamespaceStd();
668 
669  /**
670  * Remove Microsoft MFC 'DECLARE_MESSAGE_MAP()'
671  */
672  void simplifyMicrosoftMFC();
673 
674  /**
675  * Convert Microsoft memory functions
676  * CopyMemory(dst, src, len) -> memcpy(dst, src, len)
677  * FillMemory(dst, len, val) -> memset(dst, val, len)
678  * MoveMemory(dst, src, len) -> memmove(dst, src, len)
679  * ZeroMemory(dst, len) -> memset(dst, 0, len)
680  */
681  void simplifyMicrosoftMemoryFunctions();
682 
683  /**
684  * Convert Microsoft string functions
685  * _tcscpy -> strcpy
686  */
687  void simplifyMicrosoftStringFunctions();
688 
689  /**
690  * Remove Borland code
691  */
692  void simplifyBorland();
693 
694  /**
695  * Remove Qt signals and slots
696  */
697  void simplifyQtSignalsSlots();
698 
699  /**
700  * Collapse operator name tokens into single token
701  * operator = => operator=
702  */
703  void simplifyOperatorName();
704 
705  /**
706  * Remove [[deprecated]] (C++14) from TokenList
707  */
708  void simplifyDeprecated();
709 
710  /**
711  * Replace strlen(str)
712  * @return true if any replacement took place, false else
713  * */
714  bool simplifyStrlen();
715 
716  /**
717  * check for duplicate enum definition
718  */
719  bool duplicateDefinition(Token **tokPtr, const Token *name) const;
720 
721  /**
722  * report error message
723  */
724  void reportError(const Token* tok, const Severity::SeverityType severity, const std::string& id, const std::string& msg, bool inconclusive = false) const;
725  void reportError(const std::list<const Token*>& callstack, Severity::SeverityType severity, const std::string& id, const std::string& msg, bool inconclusive = false) const;
726 
727  /**
728  * duplicate enum definition error
729  */
730  void duplicateEnumError(const Token *tok1, const Token *tok2, const std::string & type) const;
731 
732  bool duplicateTypedef(Token **tokPtr, const Token *name, const Token *typeDef, const std::set<std::string>& structs) const;
733  void duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string & type) const;
734 
735  /**
736  * Report error - duplicate declarations
737  */
738  void duplicateDeclarationError(const Token *tok1, const Token *tok2, const std::string &type) const;
739 
740  void unsupportedTypedef(const Token *tok) const;
741 
742 public:
743 
744  /** Was there templates in the code? */
745  bool codeWithTemplates() const {
746  return _codeWithTemplates;
747  }
748 
749 
750  void setSettings(const Settings *settings) {
751  _settings = settings;
752  list.setSettings(settings);
753  }
754 
756  return _symbolDatabase;
757  }
758  void createSymbolDatabase();
759  void deleteSymbolDatabase();
760 
761  void printDebugOutput() const;
762 
763  void dump(std::ostream &out) const;
764 
765  Token *deleteInvalidTypedef(Token *typeDef);
766 
767  /**
768  * Get variable count.
769  * @return number of variables
770  */
771  unsigned int varIdCount() const {
772  return _varId;
773  }
774 
775 
776  /**
777  * Simplify e.g. 'return(strncat(temp,"a",1));' into
778  * strncat(temp,"a",1); return temp;
779  */
780  void simplifyReturnStrncat();
781 
782  /**
783  * Output list of unknown types.
784  */
785  void printUnknownTypes() const;
786 
787 
788  /**
789  * Token list: stores all tokens.
790  */
792  // Implement tokens() as a wrapper for convinience when using the TokenList
793  const Token* tokens() const {
794  return list.front();
795  }
796 
797  /**
798  * Copy tokens.
799  * @param dest destination token where copied tokens will be inserted after
800  * @param first first token to copy
801  * @param last last token to copy
802  * @param one_line true=>copy all tokens to the same line as dest. false=>copy all tokens to dest while keeping the 'line breaks'
803  * @return new location of last token copied
804  */
805  static Token *copyTokens(Token *dest, const Token *first, const Token *last, bool one_line = true);
806 
807  /**
808  * Helper function to check whether number is zero (0 or 0.0 or 0E+0) or not?
809  * @param s the string to check
810  * @return true in case is is zero and false otherwise.
811  */
812  static bool isZeroNumber(const std::string &s);
813 
814  /**
815  * Helper function to check whether number is one (1 or 0.1E+1 or 1E+0) or not?
816  * @param s the string to check
817  * @return true in case is is one and false otherwise.
818  */
819  static bool isOneNumber(const std::string &s);
820 
821  /**
822  * Helper function to check whether number is two (2 or 0.2E+1 or 2E+0) or not?
823  * @param s the string to check
824  * @return true in case is is two and false otherwise.
825  */
826  static bool isTwoNumber(const std::string &s);
827 
828  /**
829  * Helper function to check for start of function execution scope.
830  * Do not use this in checks. Use the symbol database.
831  * @param tok --> pointer to end parentheses of parameter list
832  * @return pointer to start brace of function scope or nullptr if not start.
833  */
834  static const Token * startOfExecutableScope(const Token * tok);
835 
836 private:
837  /** Disable copy constructor, no implementation */
838  Tokenizer(const Tokenizer &);
839 
840  /** Disable assignment operator, no implementation */
841  Tokenizer &operator=(const Tokenizer &);
842 
843  Token * startOfFunction(Token * tok) const;
845  return const_cast<Token*>(startOfExecutableScope(const_cast<const Token *>(tok)));
846  }
847 
848  Token *processFunc(Token *tok2, bool inOperator) const;
849 
850  /** Set pod types */
851  void setPodTypes();
852 
853  /** settings */
855 
856  /** errorlogger */
858 
859  /** Symbol database that all checks etc can use */
861 
862  /** E.g. "A" for code where "#ifdef A" is true. This is used to
863  print additional information in error situations. */
864  std::string _configuration;
865 
866  /** sizeof information for known types */
867  std::map<std::string, unsigned int> _typeSize;
868 
869  /** variable count */
870  unsigned int _varId;
871 
872  /**
873  * was there any templates? templates that are "unused" are
874  * removed from the token list
875  */
877 
878  /**
879  * TimerResults
880  */
882 #ifdef MAXTIME
883  /** Tokenizer maxtime */
884  std::time_t maxtime;
885 #endif
886 };
887 
888 /// @}
889 
890 //---------------------------------------------------------------------------
891 #endif // tokenizeH