Fixed #5773: Don't prepend "std::" to function definitions
This commit is contained in:
parent
c0fc47643f
commit
edd84c0906
|
@ -9573,7 +9573,7 @@ void Tokenizer::simplifyNamespaceStd()
|
|||
|
||||
for (const Token* tok = Token::findsimplematch(list.front(), "using namespace std ;"); tok; tok = tok->next()) {
|
||||
bool insert = false;
|
||||
if (Token::Match(tok, "%var% (") && !Token::Match(tok->previous(), ".|::") && stdFunctions.find(tok->str()) != stdFunctions.end())
|
||||
if (Token::Match(tok, "%var% (") && !Token::Match(tok->previous(), ".|::") && !Token::Match(tok->linkAt(1)->next(), "%var%|{") && stdFunctions.find(tok->str()) != stdFunctions.end())
|
||||
insert = true;
|
||||
else if (Token::Match(tok, "%var% <") && !Token::Match(tok->previous(), ".|::") && stdTemplates.find(tok->str()) != stdTemplates.end())
|
||||
insert = true;
|
||||
|
|
|
@ -7795,6 +7795,20 @@ private:
|
|||
static const char expected13[] = "try { }\n"
|
||||
"catch ( std :: exception & exception ) { }";
|
||||
ASSERT_EQUALS(expected13, tokenizeAndStringify(code13, false));
|
||||
|
||||
// #5773 (Don't prepend 'std ::' to function definitions)
|
||||
static const char code14[] = "using namespace std;\n"
|
||||
"class C {\n"
|
||||
" void search() {}\n"
|
||||
" void search() const {}\n"
|
||||
" void search() THROW_MACRO {}\n"
|
||||
"};";
|
||||
static const char expected14[] = "class C {\n"
|
||||
"void search ( ) { }\n"
|
||||
"void search ( ) const { }\n"
|
||||
"void search ( ) THROW_MACRO { }\n"
|
||||
"} ;";
|
||||
ASSERT_EQUALS(expected14, tokenizeAndStringify(code14, false));
|
||||
}
|
||||
|
||||
void microsoftMFC() {
|
||||
|
|
Loading…
Reference in New Issue