astyle formatting
This commit is contained in:
parent
96e99d347e
commit
e11d9f1628
|
@ -40,34 +40,44 @@ void CheckPostfixOperator::postfixOperator()
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if ( Token::Match(tok, "++|--") ) {
|
if (Token::Match(tok, "++|--"))
|
||||||
if ( Token::Match(tok->previous()->previous(), ";|{|}") && Token::Match(tok->next(), ";|)|,") ) {
|
{
|
||||||
|
if (Token::Match(tok->previous()->previous(), ";|{|}") && Token::Match(tok->next(), ";|)|,"))
|
||||||
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
else if (tok->strAt(-2) == ",") {
|
else if (tok->strAt(-2) == ",")
|
||||||
|
{
|
||||||
int i(1);
|
int i(1);
|
||||||
while(tok->strAt(i) != ")") {
|
while (tok->strAt(i) != ")")
|
||||||
if(tok->strAt(i) == ";") {
|
{
|
||||||
|
if (tok->strAt(i) == ";")
|
||||||
|
{
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (tok->strAt(-2) == "<<" && tok->strAt(1) == "<<") {
|
else if (tok->strAt(-2) == "<<" && tok->strAt(1) == "<<")
|
||||||
|
{
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result) {
|
if (result)
|
||||||
|
{
|
||||||
const Token *decltok = Token::findmatch(_tokenizer->tokens(), "%varid%", tok->previous()->varId());
|
const Token *decltok = Token::findmatch(_tokenizer->tokens(), "%varid%", tok->previous()->varId());
|
||||||
if (decltok && Token::Match(decltok->previous(), "iterator|const_iterator|reverse_iterator|const_reverse_iterator")) {
|
if (decltok && Token::Match(decltok->previous(), "iterator|const_iterator|reverse_iterator|const_reverse_iterator"))
|
||||||
|
{
|
||||||
// the variable is an iterator
|
// the variable is an iterator
|
||||||
postfixOperatorError(tok);
|
postfixOperatorError(tok);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
const std::string classDef = std::string("class ") + std::string(decltok->previous()->strAt(0));
|
const std::string classDef = std::string("class ") + std::string(decltok->previous()->strAt(0));
|
||||||
if (Token::findmatch(_tokenizer->tokens(), classDef.c_str())) {
|
if (Token::findmatch(_tokenizer->tokens(), classDef.c_str()))
|
||||||
|
{
|
||||||
// the variable is an instance of class
|
// the variable is an instance of class
|
||||||
postfixOperatorError(tok);
|
postfixOperatorError(tok);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue