@@ -1406,8 +1406,8 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
14061406 tok1 = tok1->link ()->tokAt (-2 );
14071407 }
14081408
1409- // skip over const, noexcept, throw and override specifiers
1410- while (Token::Match (tok2, " const|noexcept|throw|override|final" )) {
1409+ // skip over const, noexcept, throw, override, final and volatile specifiers
1410+ while (Token::Match (tok2, " const|noexcept|throw|override|final|volatile " )) {
14111411 tok2 = tok2->next ();
14121412 if (tok2 && tok2->str () == " (" )
14131413 tok2 = tok2->link ()->next ();
@@ -1646,9 +1646,9 @@ void Variable::evaluate(const Library* lib)
16461646 tok = tok->next ();
16471647 }
16481648
1649- while (Token::Match (_start, " static|const %any%" ))
1649+ while (Token::Match (_start, " static|const|volatile %any%" ))
16501650 _start = _start->next ();
1651- while (_end && _end->previous () && _end-> str () == " const" )
1651+ while (_end && _end->previous () && Token::Match (_end, " const|volatile " ) )
16521652 _end = _end->previous ();
16531653
16541654 if (_start) {
@@ -1793,6 +1793,8 @@ Function::Function(const Tokenizer *_tokenizer, const Token *tok, const Scope *s
17931793 setFlag (fHasOverrideSpecifier , true );
17941794 else if (tok->str () == " final" )
17951795 setFlag (fHasFinalSpecifier , true );
1796+ else if (tok->str () == " volatile" )
1797+ isVolatile (true );
17961798 else if (tok->str () == " noexcept" ) {
17971799 isNoExcept (!Token::simpleMatch (tok->next (), " ( false )" ));
17981800 if (tok->next ()->str () == " (" )
@@ -2703,6 +2705,7 @@ void SymbolDatabase::printOut(const char *title) const
27032705 std::cout << " hasLvalRefQual: " << func->hasLvalRefQualifier () << std::endl;
27042706 std::cout << " hasRvalRefQual: " << func->hasRvalRefQualifier () << std::endl;
27052707 std::cout << " isVariadic: " << func->isVariadic () << std::endl;
2708+ std::cout << " isVolatile: " << func->isVolatile () << std::endl;
27062709 std::cout << " attributes:" ;
27072710 if (func->isAttributeConst ())
27082711 std::cout << " const " ;
@@ -3057,7 +3060,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
30573060
30583061 const Token *typeTok = startTok;
30593062 // skip over stuff to get to type
3060- while (Token::Match (typeTok, " const|enum|struct|::" ))
3063+ while (Token::Match (typeTok, " const|volatile| enum|struct|::" ))
30613064 typeTok = typeTok->next ();
30623065 if (Token::Match (typeTok, " ,|)" )) { // #8333
30633066 symbolDatabase->_tokenizer ->syntaxError (typeTok);
@@ -3069,7 +3072,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
30693072
30703073 // check for argument with no name or missing varid
30713074 if (!endTok) {
3072- if (tok->previous ()->isName () && tok->strAt (-1 ) != " const" ) {
3075+ if (tok->previous ()->isName () && ! Token::Match ( tok->tokAt (-1 ), " const|volatile " ) ) {
30733076 if (tok->previous () != typeTok) {
30743077 nameTok = tok->previous ();
30753078 endTok = nameTok->previous ();
@@ -3100,7 +3103,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
31003103 }
31013104
31023105 // skip over stuff before type
3103- while (Token::Match (startTok, " enum|struct|const" ))
3106+ while (Token::Match (startTok, " enum|struct|const|volatile " ))
31043107 startTok = startTok->next ();
31053108
31063109 argumentList.emplace_back (nameTok, startTok, endTok, count++, Argument, argType, functionScope, &symbolDatabase->_settings ->library );
@@ -3434,8 +3437,8 @@ const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess, con
34343437 return next;
34353438 }
34363439
3437- // skip const|static|mutable|extern
3438- while (Token::Match (tok, " const|static|mutable|extern" )) {
3440+ // skip const|volatile| static|mutable|extern
3441+ while (Token::Match (tok, " const|volatile| static|mutable|extern" )) {
34393442 tok = tok->next ();
34403443 }
34413444
0 commit comments