fix #2692 (False positive: if parsed as function in operator >>)
This commit is contained in:
parent
1aca09a8bf
commit
e9a23d9cb5
|
@ -9578,7 +9578,7 @@ void Tokenizer::simplifyOperatorName()
|
|||
par = par->next();
|
||||
done = false;
|
||||
}
|
||||
if (Token::Match(par, "[<>+-*&/=.!]") || Token::Match(par, "==|!=|<=|>="))
|
||||
if (Token::Match(par, "[<>+-*&/=.!]") || Token::Match(par, "==|!=|<=|>=|>>|<<"))
|
||||
{
|
||||
op += par->str();
|
||||
par = par->next();
|
||||
|
|
|
@ -323,6 +323,7 @@ private:
|
|||
TEST_CASE(simplifyOperatorName2);
|
||||
TEST_CASE(simplifyOperatorName3);
|
||||
TEST_CASE(simplifyOperatorName4);
|
||||
TEST_CASE(simplifyOperatorName5);
|
||||
|
||||
// Some simple cleanups of unhandled macros in the global scope
|
||||
TEST_CASE(removeMacrosInGlobalScope);
|
||||
|
@ -5617,6 +5618,17 @@ private:
|
|||
ASSERT_EQUALS(result, tokenizeAndStringify(code,false));
|
||||
}
|
||||
|
||||
void simplifyOperatorName5()
|
||||
{
|
||||
const char code1[] = "std::istream & operator >> (std::istream & s, Fred &f);";
|
||||
const char result1[] = "std :: istream & operator>> ( std :: istream & s , Fred & f ) ;";
|
||||
ASSERT_EQUALS(result1, tokenizeAndStringify(code1,false));
|
||||
|
||||
const char code2[] = "std::ostream & operator << (std::ostream & s, const Fred &f);";
|
||||
const char result2[] = "std :: ostream & operator<< ( std :: ostream & s , const Fred & f ) ;";
|
||||
ASSERT_EQUALS(result2, tokenizeAndStringify(code2,false));
|
||||
}
|
||||
|
||||
void removeMacrosInGlobalScope()
|
||||
{
|
||||
// remove some unhandled macros in the global scope.
|
||||
|
|
Loading…
Reference in New Issue