@@ -4156,7 +4156,7 @@ void VariableMap::addVariable(const std::string& varname, bool globalNamespace)
41564156 it->second = ++mVarId ;
41574157}
41584158
4159- static bool setVarIdParseDeclaration (Token** tok, const VariableMap& variableMap, bool executableScope, bool cpp, bool c )
4159+ static bool setVarIdParseDeclaration (Token** tok, const VariableMap& variableMap, bool executableScope)
41604160{
41614161 const Token* const tok1 = *tok;
41624162 Token* tok2 = *tok;
@@ -4174,14 +4174,14 @@ static bool setVarIdParseDeclaration(Token** tok, const VariableMap& variableMap
41744174 tok2 = tok2->linkAt (1 )->next ();
41754175 continue ;
41764176 }
4177- if (cpp && Token::Match (tok2, " namespace|public|private|protected" ))
4177+ if (tok2-> isCpp () && Token::Match (tok2, " namespace|public|private|protected" ))
41784178 return false ;
4179- if (cpp && Token::simpleMatch (tok2, " decltype (" )) {
4179+ if (tok2-> isCpp () && Token::simpleMatch (tok2, " decltype (" )) {
41804180 typeCount = 1 ;
41814181 tok2 = tok2->linkAt (1 )->next ();
41824182 continue ;
41834183 }
4184- if (Token::Match (tok2, " struct|union|enum" ) || (!c && Token::Match (tok2, " class|typename" ))) {
4184+ if (Token::Match (tok2, " struct|union|enum" ) || (tok2-> isCpp () && Token::Match (tok2, " class|typename" ))) {
41854185 hasstruct = true ;
41864186 typeCount = 0 ;
41874187 singleNameCount = 0 ;
@@ -4197,8 +4197,8 @@ static bool setVarIdParseDeclaration(Token** tok, const VariableMap& variableMap
41974197 ++typeCount;
41984198 ++singleNameCount;
41994199 }
4200- } else if (!c && ((TemplateSimplifier::templateParameters (tok2) > 0 ) ||
4201- Token::simpleMatch (tok2, " < >" ) /* Ticket #4764 */ )) {
4200+ } else if (tok2-> isCpp () && ((TemplateSimplifier::templateParameters (tok2) > 0 ) ||
4201+ Token::simpleMatch (tok2, " < >" ) /* Ticket #4764 */ )) {
42024202 const Token *start = *tok;
42034203 if (Token::Match (start->previous (), " %or%|%oror%|&&|&|^|+|-|*|/" ))
42044204 return false ;
@@ -4263,7 +4263,7 @@ static bool setVarIdParseDeclaration(Token** tok, const VariableMap& variableMap
42634263 }
42644264 }
42654265
4266- if (cpp && tok3 && Token::simpleMatch (tok3->previous (), " ] (" ) &&
4266+ if (tok3 && tok3-> isCpp () && Token::simpleMatch (tok3->previous (), " ] (" ) &&
42674267 (Token::simpleMatch (tok3->link (), " ) {" ) || Token::Match (tok3->link (), " ) . %name%" )))
42684268 isLambdaArg = true ;
42694269 }
@@ -4683,7 +4683,7 @@ void Tokenizer::setVarIdPass1()
46834683 }
46844684
46854685 try { /* Ticket #8151 */
4686- decl = setVarIdParseDeclaration (&tok2, variableMap, scopeStack.top ().isExecutable , isCPP (), isC () );
4686+ decl = setVarIdParseDeclaration (&tok2, variableMap, scopeStack.top ().isExecutable );
46874687 } catch (const Token * errTok) {
46884688 syntaxError (errTok);
46894689 }
0 commit comments