#6276 clang: -fsanitize=integer warnings. Fix unwanted integer overflow in TemplateSimplifier::useDefaultArgumentValues() and Tokenizer::simplifyQtSignalsSlots()

This commit is contained in:
Alexander Mai 2015-05-03 15:21:58 +02:00
parent 71cb8e9f64
commit 6f96634759
2 changed files with 7 additions and 5 deletions

View File

@ -569,9 +569,10 @@ void TemplateSimplifier::useDefaultArgumentValues(const std::list<Token *> &temp
if (tok->str() == ">") {
if (Token::Match(tok, "> class|struct %name%"))
classname = tok->strAt(2);
--templateParmDepth;
if (0 == templateParmDepth)
if (templateParmDepth<2)
break;
else
--templateParmDepth;
}
// next template parameter
@ -601,7 +602,7 @@ void TemplateSimplifier::useDefaultArgumentValues(const std::list<Token *> &temp
// count the parameters..
tok = tok->next();
unsigned int usedpar = TemplateSimplifier::templateParameters(tok);
const unsigned int usedpar = TemplateSimplifier::templateParameters(tok);
tok = tok->findClosingBracket();
if (tok && tok->str() == ">") {

View File

@ -9860,9 +9860,10 @@ void Tokenizer::simplifyQtSignalsSlots()
else
tok2 = tok2->link();
} else if (tok2->str() == "}") {
--indentlevel;
if (indentlevel == 0)
if (indentlevel<2)
break;
else
--indentlevel;
}
if (tok2->strAt(1) == "Q_OBJECT") {