This commit is contained in:
parent
a336048d14
commit
b2b0962067
|
@ -10169,11 +10169,14 @@ void Tokenizer::simplifyNamespaceAliases()
|
|||
int scope = 0;
|
||||
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
bool isPrev{};
|
||||
if (tok->str() == "{")
|
||||
scope++;
|
||||
else if (tok->str() == "}")
|
||||
scope--;
|
||||
else if (Token::Match(tok, "namespace %name% =")) {
|
||||
else if (Token::Match(tok, "namespace %name% =") || (isPrev = Token::Match(tok->previous(), "namespace %name% ="))) {
|
||||
if (isPrev)
|
||||
tok = tok->previous();
|
||||
const std::string name(tok->next()->str());
|
||||
Token * tokNameStart = tok->tokAt(3);
|
||||
Token * tokNameEnd = tokNameStart;
|
||||
|
|
|
@ -1455,6 +1455,9 @@ private:
|
|||
"}"
|
||||
"namespace AB = A::B;" //duplicate declaration
|
||||
"}"));
|
||||
ASSERT_EQUALS(";",
|
||||
tok("namespace p = boost::python;\n"
|
||||
"namespace np = boost::numpy;\n"));
|
||||
|
||||
// redeclared nested namespace aliases
|
||||
TODO_ASSERT_EQUALS("namespace A { namespace B { void foo ( ) { bar ( A :: B :: ab ( ) ) ; { baz ( A :: a ( ) ) ; } bar ( A :: B :: ab ( ) ) ; } } }",
|
||||
|
|
Loading…
Reference in New Issue