From 9aa8a49677295811f99b3c0ba64cd15fd1602903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 21 Nov 2011 18:04:42 +0100 Subject: [PATCH] Tokenizer::setVarId: fixed 'using' bug --- lib/tokenize.cpp | 4 ++++ test/testtokenize.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 774ec66de..ca4fce114 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3425,6 +3425,10 @@ void Tokenizer::setVarId() continue; } + if (tok->str() == "using") { + continue; + } + if (Token::Match(tok, "goto %any% ;")) continue; diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 2dd4918dc..6954c6422 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -192,6 +192,7 @@ private: TEST_CASE(varid40); // ticket #3279 TEST_CASE(varid41); // ticket #3340 (varid for union type) TEST_CASE(varid42); // ticket #3316 (varid for array) + TEST_CASE(varid43); TEST_CASE(varidFunctionCall1); TEST_CASE(varidFunctionCall2); TEST_CASE(varidFunctionCall3); @@ -3061,6 +3062,13 @@ private: tokenizeDebugListing(code)); } + void varid43() { + const std::string code("namespace fruit { using banana; }"); + ASSERT_EQUALS("\n\n##file 0\n" + "1: namespace fruit { using banana ; }\n", + tokenizeDebugListing(code)); + } + void varidFunctionCall1() { const std::string code("void f() {\n" " int x;\n"