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())
|
||||
{
|
||||
bool result = false;
|
||||
if ( Token::Match(tok, "++|--") ) {
|
||||
if ( Token::Match(tok->previous()->previous(), ";|{|}") && Token::Match(tok->next(), ";|)|,") ) {
|
||||
if (Token::Match(tok, "++|--"))
|
||||
{
|
||||
if (Token::Match(tok->previous()->previous(), ";|{|}") && Token::Match(tok->next(), ";|)|,"))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (tok->strAt(-2) == ",") {
|
||||
else if (tok->strAt(-2) == ",")
|
||||
{
|
||||
int i(1);
|
||||
while(tok->strAt(i) != ")") {
|
||||
if(tok->strAt(i) == ";") {
|
||||
while (tok->strAt(i) != ")")
|
||||
{
|
||||
if (tok->strAt(i) == ";")
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if (tok->strAt(-2) == "<<" && tok->strAt(1) == "<<") {
|
||||
else if (tok->strAt(-2) == "<<" && tok->strAt(1) == "<<")
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(result) {
|
||||
if (result)
|
||||
{
|
||||
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
|
||||
postfixOperatorError(tok);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
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
|
||||
postfixOperatorError(tok);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue