Add support for simplifying user defined literal operator. (#1827)
This commit is contained in:
parent
a7478bcb5a
commit
eade2bb2c2
|
@ -10543,6 +10543,11 @@ void Tokenizer::simplifyOperatorName()
|
|||
op += ")";
|
||||
par = par->next();
|
||||
done = false;
|
||||
} else if (Token::Match(par, "\"\" %name% (")) {
|
||||
op += "\"\"";
|
||||
op += par->strAt(1);
|
||||
par = par->tokAt(2);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -398,6 +398,7 @@ private:
|
|||
TEST_CASE(simplifyOperatorName10); // #8746 - using a::operator=
|
||||
TEST_CASE(simplifyOperatorName11); // #8889
|
||||
TEST_CASE(simplifyOperatorName12); // #9110
|
||||
TEST_CASE(simplifyOperatorName13); // user defined literal
|
||||
|
||||
TEST_CASE(simplifyNullArray);
|
||||
|
||||
|
@ -6227,6 +6228,12 @@ private:
|
|||
tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
void simplifyOperatorName13() { // user defined literal
|
||||
const char code[] = "unsigned long operator""_numch(const char *ch, unsigned long size);";
|
||||
ASSERT_EQUALS("unsigned long operator""_numch ( const char * ch , unsigned long size ) ;",
|
||||
tokenizeAndStringify(code));
|
||||
}
|
||||
|
||||
void simplifyNullArray() {
|
||||
ASSERT_EQUALS("* ( foo . bar [ 5 ] ) = x ;", tokenizeAndStringify("0[foo.bar[5]] = x;"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue