Fixed ticket #523 (Tokenizer: set varId for types with long namespaces)
FIXME: skip namespaces by the best way. http://sourceforge.net/apps/trac/cppcheck/ticket/533
This commit is contained in:
parent
681b836389
commit
5db677bc30
|
@ -748,7 +748,7 @@ void Tokenizer::setVarId()
|
||||||
if (tok->str() == "const")
|
if (tok->str() == "const")
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
|
|
||||||
if (Token::simpleMatch(tok, "std ::"))
|
while (Token::Match(tok, "%var% ::"))
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
|
|
||||||
// Skip template arguments..
|
// Skip template arguments..
|
||||||
|
@ -756,7 +756,7 @@ void Tokenizer::setVarId()
|
||||||
{
|
{
|
||||||
Token *tok2 = tok->tokAt(2);
|
Token *tok2 = tok->tokAt(2);
|
||||||
|
|
||||||
if (Token::simpleMatch(tok2, "std ::"))
|
while (Token::Match(tok2, "%var% ::"))
|
||||||
tok2 = tok2->tokAt(2);
|
tok2 = tok2->tokAt(2);
|
||||||
|
|
||||||
while (tok2 && (tok2->isName() || tok2->str() == "*" || tok2->str() == ","))
|
while (tok2 && (tok2->isName() || tok2->str() == "*" || tok2->str() == ","))
|
||||||
|
|
|
@ -1275,7 +1275,10 @@ private:
|
||||||
const std::string code("list<int> ints;\n"
|
const std::string code("list<int> ints;\n"
|
||||||
"list<int>::iterator it;\n"
|
"list<int>::iterator it;\n"
|
||||||
"std::vector<std::string> dirs;\n"
|
"std::vector<std::string> dirs;\n"
|
||||||
"std::map<int, int> coords;\n");
|
"std::map<int, int> coords;\n"
|
||||||
|
"std::tr1::unordered_map<int, int> xy;\n"
|
||||||
|
"std::list<boost::wave::token_id> tokens;\n"
|
||||||
|
);
|
||||||
|
|
||||||
// tokenize..
|
// tokenize..
|
||||||
Tokenizer tokenizer;
|
Tokenizer tokenizer;
|
||||||
|
@ -1289,7 +1292,10 @@ private:
|
||||||
"1: list < int > ints@1 ;\n"
|
"1: list < int > ints@1 ;\n"
|
||||||
"2: list < int > :: iterator it@2 ;\n"
|
"2: list < int > :: iterator it@2 ;\n"
|
||||||
"3: std :: vector < std :: string > dirs@3 ;\n"
|
"3: std :: vector < std :: string > dirs@3 ;\n"
|
||||||
"4: std :: map < int , int > coords@4 ;\n");
|
"4: std :: map < int , int > coords@4 ;\n"
|
||||||
|
"5: std :: tr1 :: unordered_map < int , int > xy@5 ;\n"
|
||||||
|
"6: std :: list < boost :: wave :: token_id > tokens@6 ;\n"
|
||||||
|
);
|
||||||
|
|
||||||
ASSERT_EQUALS(expected, actual);
|
ASSERT_EQUALS(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue