Fixed #898 (Tokenizer: remove unneeded const after *)
This commit is contained in:
parent
442584151b
commit
58c54d2ed4
|
@ -1788,6 +1788,12 @@ void Tokenizer::simplifySizeof()
|
|||
|
||||
void Tokenizer::simplifyTokenList()
|
||||
{
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
if (Token::simpleMatch(tok, "* const"))
|
||||
tok->deleteNext();
|
||||
}
|
||||
|
||||
simplifyNamespaces();
|
||||
|
||||
simplifyGoto();
|
||||
|
|
|
@ -135,6 +135,8 @@ private:
|
|||
TEST_CASE(simplify_numeric_condition);
|
||||
|
||||
TEST_CASE(pointeralias);
|
||||
|
||||
TEST_CASE(reduceConstness);
|
||||
}
|
||||
|
||||
std::string tok(const char code[], bool simplify = true)
|
||||
|
@ -2148,6 +2150,12 @@ private:
|
|||
ASSERT_EQUALS(expected, tok(code));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reduceConstness()
|
||||
{
|
||||
ASSERT_EQUALS("char * p ;", tok("char * const p;"));
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestSimplifyTokens)
|
||||
|
|
Loading…
Reference in New Issue