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