diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 70c8fe873..cdd2090c3 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2583,12 +2583,6 @@ static void setVarIdClassFunction(const std::string &classname, } -// Variable declarations can't start with "return" etc. -static const std::set notstart_c = make_container< std::set > () - << "goto" << "NOT" << "return" << "sizeof"<< "typedef"; -static const std::set notstart_cpp = make_container< std::set > () - << notstart_c - << "delete" << "friend" << "new" << "throw" << "using" << "virtual" << "explicit" << "const_cast" << "dynamic_cast" << "reinterpret_cast" << "static_cast" ; void Tokenizer::setVarId() { @@ -2600,6 +2594,21 @@ void Tokenizer::setVarId() setPodTypes(); + setVarIdPass1(); + + setVarIdPass2(); +} + + +// Variable declarations can't start with "return" etc. +static const std::set notstart_c = make_container< std::set > () + << "goto" << "NOT" << "return" << "sizeof"<< "typedef"; +static const std::set notstart_cpp = make_container< std::set > () + << notstart_c + << "delete" << "friend" << "new" << "throw" << "using" << "virtual" << "explicit" << "const_cast" << "dynamic_cast" << "reinterpret_cast" << "static_cast" ; + +void Tokenizer::setVarIdPass1() +{ // Variable declarations can't start with "return" etc. const std::set& notstart = (isC()) ? notstart_c : notstart_cpp; @@ -2841,10 +2850,11 @@ void Tokenizer::setVarId() tok = tok->previous(); } } +} - // Clear the structMembers because it will be used when member functions - // are parsed. The old info is not bad, it is just redundant. - structMembers.clear(); +void Tokenizer::setVarIdPass2() +{ + std::map > structMembers; // Member functions and variables in this source std::list allMemberFunctions; diff --git a/lib/tokenize.h b/lib/tokenize.h index 0ed769ab8..2954e090f 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -111,6 +111,8 @@ public: /** Set variable id */ void setVarId(); + void setVarIdPass1(); + void setVarIdPass2(); /** * Basic simplification of tokenlist