Improved daca check for wrong detection of template right angle brackets

This commit is contained in:
Daniel Marjamäki 2020-11-30 20:00:38 +01:00
parent 26b4c803f7
commit f250e06df7
1 changed files with 6 additions and 4 deletions

View File

@ -5182,8 +5182,9 @@ void Tokenizer::splitTemplateRightAngleBrackets(bool check)
// Ticket #6181: normalize C++11 template parameter list closing syntax
if (tok->str() == "<" && mTemplateSimplifier->templateParameters(tok)) {
Token *endTok = tok->findClosingBracket();
if (check && endTok) {
reportError(tok, Severity::debug, "wrongSplitTemplateRightAngleBrackets", "bad closing bracket for !!!<!!!: " + getExpression(tok), false);
if (check) {
if (Token::Match(endTok, ">>|>>="))
reportError(tok, Severity::debug, "dacaWrongSplitTemplateRightAngleBrackets", "bad closing bracket for !!!<!!!: " + getExpression(tok), false);
continue;
}
if (endTok && endTok->str() == ">>") {
@ -5196,8 +5197,9 @@ void Tokenizer::splitTemplateRightAngleBrackets(bool check)
}
} else if (Token::Match(tok, "class|struct|union|=|:|public|protected|private %name% <")) {
Token *endTok = tok->tokAt(2)->findClosingBracket();
if (check && endTok) {
reportError(tok, Severity::debug, "wrongSplitTemplateRightAngleBrackets", "bad closing bracket for !!!<!!!: " + getExpression(tok), false);
if (check) {
if (Token::simpleMatch(endTok, ">>"))
reportError(tok, Severity::debug, "dacaWrongSplitTemplateRightAngleBrackets", "bad closing bracket for !!!<!!!: " + getExpression(tok), false);
continue;
}
if (Token::Match(endTok, ">> ;|{|%type%")) {