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