Support lambdas in simplifyCompoundAssignment (#7571)
This commit is contained in:
parent
87372ccd58
commit
a808549af0
|
@ -33,8 +33,8 @@ namespace {
|
||||||
|
|
||||||
// CWE IDs used:
|
// CWE IDs used:
|
||||||
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
|
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
|
||||||
static const struct CWE CWE467(467U); // Use of sizeof() on a Pointer Type
|
static const struct CWE CWE467(467U); // Use of sizeof() on a Pointer Type
|
||||||
static const struct CWE CWE682(682U); // Incorrect Calculation
|
static const struct CWE CWE682(682U); // Incorrect Calculation
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void CheckSizeof::checkSizeofForNumericParameter()
|
void CheckSizeof::checkSizeofForNumericParameter()
|
||||||
|
|
|
@ -4659,7 +4659,7 @@ void Tokenizer::simplifyCompoundAssignment()
|
||||||
// Only enclose rhs in parentheses if there is some operator
|
// Only enclose rhs in parentheses if there is some operator
|
||||||
bool someOperator = false;
|
bool someOperator = false;
|
||||||
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
|
||||||
if (tok2->str() == "(")
|
if (tok2->link() && Token::Match(tok2, "{|[|("))
|
||||||
tok2 = tok2->link();
|
tok2 = tok2->link();
|
||||||
|
|
||||||
if (Token::Match(tok2->next(), "[;)]")) {
|
if (Token::Match(tok2->next(), "[;)]")) {
|
||||||
|
|
|
@ -362,6 +362,9 @@ private:
|
||||||
|
|
||||||
// #3469
|
// #3469
|
||||||
ASSERT_EQUALS("; a = a + ( b = 1 ) ;", tok("; a += b = 1;"));
|
ASSERT_EQUALS("; a = a + ( b = 1 ) ;", tok("; a += b = 1;"));
|
||||||
|
|
||||||
|
// #7571
|
||||||
|
ASSERT_EQUALS("; foo = foo + [ & ] ( ) { } ;", tok("; foo += [&]() {int i;};"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue